From 3474f3db5737218ca403885e94826a07ddc915b2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Oct 2009 13:13:27 +0200 Subject: Fix compilation on Solaris. No semi-colons allowed after Q_PROPERTY. Reviewed-by: Trust Me --- examples/opengl/pbuffers/cube.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/opengl/pbuffers/cube.h b/examples/opengl/pbuffers/cube.h index 1974f4f..c882f1f 100644 --- a/examples/opengl/pbuffers/cube.h +++ b/examples/opengl/pbuffers/cube.h @@ -109,9 +109,9 @@ protected: class Cube : public QObject, public Tile { Q_OBJECT - Q_PROPERTY(qreal range READ range WRITE setRange); - Q_PROPERTY(qreal altitude READ altitude WRITE setAltitude); - Q_PROPERTY(qreal rotation READ rotation WRITE setRotation); + Q_PROPERTY(qreal range READ range WRITE setRange) + Q_PROPERTY(qreal altitude READ altitude WRITE setAltitude) + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation) public: Cube(const QVector3D &loc = QVector3D()); ~Cube(); -- cgit v0.12 From b8b13494ed151595c5fc104572655f667870e6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 5 Oct 2009 13:14:11 +0200 Subject: Made X11 pixmap backend's fromImage() check for Qt::NoOpaqueDetection. Reviewed-by: Gunnar --- src/gui/image/qpixmap_x11.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 92a7e7d..74543a0 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -387,7 +387,14 @@ struct QX11AlphaDetector return hasAlpha(); } - QX11AlphaDetector(const QImage *i) : image(i), checked(false), has(false) { } + QX11AlphaDetector(const QImage *i, Qt::ImageConversionFlags flags) + : image(i), checked(false), has(false) + { + if (flags & Qt::NoOpaqueDetection) { + checked = true; + has = image->hasAlphaChannel(); + } + } const QImage *image; mutable bool checked; @@ -427,7 +434,7 @@ void QX11PixmapData::fromImage(const QImage &img, return; } - QX11AlphaDetector alphaCheck(&img); + QX11AlphaDetector alphaCheck(&img, flags); int dd = alphaCheck.hasXRenderAndAlpha() ? 32 : xinfo.depth(); if (qt_x11_preferred_pixmap_depth) -- cgit v0.12 From 239eb516641ec6f99a5f4134042d3ab9c27c0a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 5 Oct 2009 12:24:42 +0200 Subject: Improved performance in raster window surface for 16-bit displays. Greatly improves performance in flush() for the non-MITSHM case on 16-bit displays. Instead of converting the whole image to a pixmap only convert the sub-rect that's needed. Reviewed-by: Gunnar --- src/gui/painting/qwindowsurface_raster.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 592b34c..2f7e879 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -219,11 +219,14 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi const QImage &src = d->image->image; br = br.intersected(src.rect()); if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) { + Q_ASSERT(src.depth() >= 16); + const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8), + br.width(), br.height(), src.bytesPerLine(), src.format()); QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); data->xinfo = widget->x11Info(); - data->fromImage(src, Qt::AutoColor); + data->fromImage(sub_src, Qt::NoOpaqueDetection); QPixmap pm = QPixmap(data); - XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, br.x() , br.y() , br.width(), br.height(), wbr.x(), wbr.y()); + XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y()); } else { // qpaintengine_x11.cpp extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth); -- cgit v0.12 From 53ea5e98eab90ee9e3ae23e3b67e8993e6c2b31c 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 --- 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 c5a8d26d2337c3ed01f66783b69c5090c515be38 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 14 Sep 2009 13:21:22 +0200 Subject: Fix whatsThis breakage when using custom style sheet font When setting a large font using style sheets, the whats this popup size calculation would be incorrect resulting in half visible lables. By calling ensurePolished before showing the label, we ensure that this will be properly handled. We also added a new test case for whatsThis in tst_qtooltip Task-number: QTBUG-2416 Reviewed-by: ogoffart --- src/gui/kernel/qwhatsthis.cpp | 2 +- tests/auto/qtooltip/tst_qtooltip.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index 5e5e56f..0da3a9b 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -194,9 +194,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor #ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); #endif - QRect r; doc = 0; + ensurePolished(); // Ensures style sheet font before size calc if (Qt::mightBeRichText(text)) { doc = new QTextDocument(); doc->setUndoRedoEnabled(false); diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp index 283effa..fc76069 100644 --- a/tests/auto/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/qtooltip/tst_qtooltip.cpp @@ -66,6 +66,7 @@ private slots: // task-specific tests below me void task183679_data(); void task183679(); + void whatsThis(); void setPalette(); }; @@ -131,6 +132,27 @@ void tst_QToolTip::task183679() QCOMPARE(QToolTip::isVisible(), visible); } +#include + +void tst_QToolTip::whatsThis() +{ + qApp->setStyleSheet( "QWidget { font-size: 72px; }" ); + QWhatsThis::showText(QPoint(0,0), "THis is text"); + QTest::qWait(400); + QWidget *whatsthis = 0; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget->inherits("QWhatsThat")) { + whatsthis = widget; + break; + } + } + QVERIFY(whatsthis); + QVERIFY(whatsthis->isVisible()); + QVERIFY(whatsthis->height() > 100); // Test QTBUG-2416 + qApp->setStyleSheet(""); +} + + void tst_QToolTip::setPalette() { //the previous test may still have a tooltip pending for deletion -- cgit v0.12 From 452c49a6e238e8069583933acf8a2b8f3ee33c31 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 30 Sep 2009 13:25:47 +1000 Subject: Allow GridView key navigation to be overridden. Also add GridView example. --- examples/declarative/gridview/gridview.qml | 60 ++++++++ .../declarative/gridview/pics/AddressBook_48.png | Bin 0 -> 3350 bytes .../declarative/gridview/pics/AudioPlayer_48.png | Bin 0 -> 3806 bytes examples/declarative/gridview/pics/Camera_48.png | Bin 0 -> 3540 bytes examples/declarative/gridview/pics/DateBook_48.png | Bin 0 -> 2610 bytes examples/declarative/gridview/pics/EMail_48.png | Bin 0 -> 3655 bytes examples/declarative/gridview/pics/TodoList_48.png | Bin 0 -> 3429 bytes .../declarative/gridview/pics/VideoPlayer_48.png | Bin 0 -> 4151 bytes src/declarative/fx/qfxgridview.cpp | 160 +++++++++++++++------ src/declarative/fx/qfxgridview.h | 6 + src/declarative/fx/qfxlistview.cpp | 12 ++ 11 files changed, 198 insertions(+), 40 deletions(-) create mode 100644 examples/declarative/gridview/gridview.qml create mode 100644 examples/declarative/gridview/pics/AddressBook_48.png create mode 100644 examples/declarative/gridview/pics/AudioPlayer_48.png create mode 100644 examples/declarative/gridview/pics/Camera_48.png create mode 100644 examples/declarative/gridview/pics/DateBook_48.png create mode 100644 examples/declarative/gridview/pics/EMail_48.png create mode 100644 examples/declarative/gridview/pics/TodoList_48.png create mode 100644 examples/declarative/gridview/pics/VideoPlayer_48.png diff --git a/examples/declarative/gridview/gridview.qml b/examples/declarative/gridview/gridview.qml new file mode 100644 index 0000000..2e5110a --- /dev/null +++ b/examples/declarative/gridview/gridview.qml @@ -0,0 +1,60 @@ +import Qt 4.6 + +Rectangle { + width: 300; height: 400; color: "white" + + ListModel { + id: AppModel + ListElement { + name: "Music" + icon: "AudioPlayer_48.png" + } + ListElement { + name: "Movies" + icon: "VideoPlayer_48.png" + } + ListElement { + name: "Camera" + icon: "Camera_48.png" + } + ListElement { + name: "Calendar" + icon: "DateBook_48.png" + } + ListElement { + name: "Messaging" + icon: "EMail_48.png" + } + ListElement { + name: "Todo List" + icon: "TodoList_48.png" + } + ListElement { + name: "Contacts" + icon: "AddressBook_48.png" + } + } + + Component { + id: AppDelegate + Item { + width: 100; height: 100 + Image { id: Icon; y: 20; anchors.horizontalCenter: parent.horizontalCenter; source: icon } + Text { anchors.top: Icon.bottom; anchors.horizontalCenter: parent.horizontalCenter; text: name } + } + } + + Component { + id: AppHighlight + Rectangle { width: 80; height: 80; color: "#FFFF88" } + } + + GridView { + id: List1 + anchors.fill: parent + cellWidth: 100; cellHeight: 100 + model: AppModel; delegate: AppDelegate + highlight: AppHighlight + focus: true + } +} diff --git a/examples/declarative/gridview/pics/AddressBook_48.png b/examples/declarative/gridview/pics/AddressBook_48.png new file mode 100644 index 0000000..1ab7c8e Binary files /dev/null and b/examples/declarative/gridview/pics/AddressBook_48.png differ diff --git a/examples/declarative/gridview/pics/AudioPlayer_48.png b/examples/declarative/gridview/pics/AudioPlayer_48.png new file mode 100644 index 0000000..f4b8689 Binary files /dev/null and b/examples/declarative/gridview/pics/AudioPlayer_48.png differ diff --git a/examples/declarative/gridview/pics/Camera_48.png b/examples/declarative/gridview/pics/Camera_48.png new file mode 100644 index 0000000..c76b524 Binary files /dev/null and b/examples/declarative/gridview/pics/Camera_48.png differ diff --git a/examples/declarative/gridview/pics/DateBook_48.png b/examples/declarative/gridview/pics/DateBook_48.png new file mode 100644 index 0000000..58f5787 Binary files /dev/null and b/examples/declarative/gridview/pics/DateBook_48.png differ diff --git a/examples/declarative/gridview/pics/EMail_48.png b/examples/declarative/gridview/pics/EMail_48.png new file mode 100644 index 0000000..d6d84a6 Binary files /dev/null and b/examples/declarative/gridview/pics/EMail_48.png differ diff --git a/examples/declarative/gridview/pics/TodoList_48.png b/examples/declarative/gridview/pics/TodoList_48.png new file mode 100644 index 0000000..0988448 Binary files /dev/null and b/examples/declarative/gridview/pics/TodoList_48.png differ diff --git a/examples/declarative/gridview/pics/VideoPlayer_48.png b/examples/declarative/gridview/pics/VideoPlayer_48.png new file mode 100644 index 0000000..52638c5 Binary files /dev/null and b/examples/declarative/gridview/pics/VideoPlayer_48.png differ diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 1095dc1..3bfc799 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -593,11 +593,11 @@ void QFxGridViewPrivate::createHighlight() highlight = new FxGridItem(item, q); highlightXAnimator = new QmlEaseFollow(q); highlightXAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("x"))); - highlightXAnimator->setVelocity(400); + highlightXAnimator->setDuration(150); highlightXAnimator->setEnabled(autoHighlight); highlightYAnimator = new QmlEaseFollow(q); highlightYAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("y"))); - highlightYAnimator->setVelocity(400); + highlightYAnimator->setDuration(150); highlightYAnimator->setEnabled(autoHighlight); } else { delete highlightContext; @@ -1064,54 +1064,134 @@ qreal QFxGridView::maxXExtent() const Q_D(const QFxGridView); if (d->flow == QFxGridView::LeftToRight) return QFxFlickable::maxXExtent(); - return -(d->endPosition() - height()); + return -(d->endPosition() - width()); } void QFxGridView::keyPressEvent(QKeyEvent *event) { Q_D(QFxGridView); + QFxFlickable::keyPressEvent(event); + if (event->isAccepted()) + return; + if (d->model && d->model->count() && d->interactive) { - if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Up) - || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Left)) { - if (currentIndex() >= d->columns || d->wrap) { - d->moveReason = QFxGridViewPrivate::Key; - int index = currentIndex() - d->columns; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); - event->accept(); - return; - } - } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Down) - || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Right)) { - if (currentIndex() < d->model->count() - d->columns || d->wrap) { - d->moveReason = QFxGridViewPrivate::Key; - int index = currentIndex()+d->columns; - setCurrentIndex(index < d->model->count() ? index : 0); - event->accept(); - return; - } - } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Left) - || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Up)) { - if (currentIndex() > 0 || d->wrap) { - d->moveReason = QFxGridViewPrivate::Key; - int index = currentIndex() - 1; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); - event->accept(); - return; - } - } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Right) - || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Down)) { - if (currentIndex() < d->model->count() - 1 || d->wrap) { - d->moveReason = QFxGridViewPrivate::Key; - int index = currentIndex() + 1; - setCurrentIndex(index < d->model->count() ? index : 0); - event->accept(); - return; - } + d->moveReason = QFxGridViewPrivate::Key; + int oldCurrent = currentIndex(); + switch (event->key()) { + case Qt::Key_Up: + moveCurrentIndexUp(); + break; + case Qt::Key_Down: + moveCurrentIndexDown(); + break; + case Qt::Key_Left: + moveCurrentIndexLeft(); + break; + case Qt::Key_Right: + moveCurrentIndexRight(); + break; + default: + break; + } + if (oldCurrent != currentIndex()) { + event->accept(); + return; } } d->moveReason = QFxGridViewPrivate::Other; event->ignore(); - QFxFlickable::keyPressEvent(event); +} + +/*! + \qmlmethod GridView::moveCurrentIndexUp + + Move the currentIndex up one item in the view. + The current index will wrap if keyNavigationWraps is true and it + is currently at the end. +*/ +void QFxGridView::moveCurrentIndexUp() +{ + Q_D(QFxGridView); + if (d->flow == QFxGridView::LeftToRight) { + if (currentIndex() >= d->columns || d->wrap) { + int index = currentIndex() - d->columns; + setCurrentIndex(index >= 0 ? index : d->model->count()-1); + } + } else { + if (currentIndex() > 0 || d->wrap) { + int index = currentIndex() - 1; + setCurrentIndex(index >= 0 ? index : d->model->count()-1); + } + } +} + +/*! + \qmlmethod GridView::moveCurrentIndexDown + + Move the currentIndex down one item in the view. + The current index will wrap if keyNavigationWraps is true and it + is currently at the end. +*/ +void QFxGridView::moveCurrentIndexDown() +{ + Q_D(QFxGridView); + if (d->flow == QFxGridView::LeftToRight) { + if (currentIndex() < d->model->count() - d->columns || d->wrap) { + int index = currentIndex()+d->columns; + setCurrentIndex(index < d->model->count() ? index : 0); + } + } else { + if (currentIndex() < d->model->count() - 1 || d->wrap) { + int index = currentIndex() + 1; + setCurrentIndex(index < d->model->count() ? index : 0); + } + } +} + +/*! + \qmlmethod GridView::moveCurrentIndexLeft + + Move the currentIndex left one item in the view. + The current index will wrap if keyNavigationWraps is true and it + is currently at the end. +*/ +void QFxGridView::moveCurrentIndexLeft() +{ + Q_D(QFxGridView); + if (d->flow == QFxGridView::LeftToRight) { + if (currentIndex() > 0 || d->wrap) { + int index = currentIndex() - 1; + setCurrentIndex(index >= 0 ? index : d->model->count()-1); + } + } else { + if (currentIndex() >= d->columns || d->wrap) { + int index = currentIndex() - d->columns; + setCurrentIndex(index >= 0 ? index : d->model->count()-1); + } + } +} + +/*! + \qmlmethod GridView::moveCurrentIndexRight + + Move the currentIndex right one item in the view. + The current index will wrap if keyNavigationWraps is true and it + is currently at the end. +*/ +void QFxGridView::moveCurrentIndexRight() +{ + Q_D(QFxGridView); + if (d->flow == QFxGridView::LeftToRight) { + if (currentIndex() < d->model->count() - 1 || d->wrap) { + int index = currentIndex() + 1; + setCurrentIndex(index < d->model->count() ? index : 0); + } + } else { + if (currentIndex() < d->model->count() - d->columns || d->wrap) { + int index = currentIndex()+d->columns; + setCurrentIndex(index < d->model->count() ? index : 0); + } + } } void QFxGridView::componentComplete() diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 996141f..08a7565 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -112,6 +112,12 @@ public: static QFxGridViewAttached *qmlAttachedProperties(QObject *); +public Q_SLOTS: + void moveCurrentIndexUp(); + void moveCurrentIndexDown(); + void moveCurrentIndexLeft(); + void moveCurrentIndexRight(); + Q_SIGNALS: void countChanged(); void currentIndexChanged(); diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 3584892..71fa2ea 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1372,6 +1372,12 @@ void QFxListView::keyPressEvent(QKeyEvent *event) event->ignore(); } +/*! + \qmlmethod ListView::incrementCurrentIndex + + Increments the current index. The current index will wrap + if keyNavigationWraps is true and it is currently at the end. +*/ void QFxListView::incrementCurrentIndex() { Q_D(QFxListView); @@ -1381,6 +1387,12 @@ void QFxListView::incrementCurrentIndex() } } +/*! + \qmlmethod ListView::decrementCurrentIndex + + Decrements the current index. The current index will wrap + if keyNavigationWraps is true and it is currently at the beginning. +*/ void QFxListView::decrementCurrentIndex() { Q_D(QFxListView); -- cgit v0.12 From 1248d9cda792b100215237ed64305b5f659b5424 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 30 Sep 2009 14:40:25 +1000 Subject: Have repeater handle items being added/removed/moved by the model. Currently this just recreates every item. Once repeater is able to correctly insert child items this needs to be revisited. Task-number: QT-745 --- src/declarative/fx/qfxrepeater.cpp | 22 +++++++++++++++++++--- src/declarative/fx/qfxrepeater.h | 5 +++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 5ef7b10..f887060 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -154,15 +154,15 @@ void QFxRepeater::setModel(const QVariant &model) { Q_D(QFxRepeater); clear(); - /* if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + /* disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); - } */ + } d->dataSource = model; QObject *object = qvariant_cast(model); QFxVisualModel *vim = 0; @@ -181,10 +181,10 @@ void QFxRepeater::setModel(const QVariant &model) dataModel->setModel(model); } if (d->model) { - /* connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + /* connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); */ @@ -304,4 +304,20 @@ void QFxRepeater::regenerate() foreach(QGraphicsItem* other, otherChildren) other->setParentItem(parentItem()); } + +void QFxRepeater::itemsInserted(int, int) +{ + regenerate(); +} + +void QFxRepeater::itemsRemoved(int, int) +{ + regenerate(); +} + +void QFxRepeater::itemsMoved(int,int,int) +{ + regenerate(); +} + QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h index 7d64d86..7a0318b 100644 --- a/src/declarative/fx/qfxrepeater.h +++ b/src/declarative/fx/qfxrepeater.h @@ -84,6 +84,11 @@ protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value); QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent); +private Q_SLOTS: + void itemsInserted(int,int); + void itemsRemoved(int,int); + void itemsMoved(int,int,int); + private: Q_DISABLE_COPY(QFxRepeater) Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxRepeater) -- cgit v0.12 From 1ec1d9bc56572a92108a4b1bf48587717e7c630b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Oct 2009 08:06:07 +1000 Subject: Add unit tests for QGLContextResource Reviewed-by: trustme --- src/opengl/qgl_p.h | 2 +- tests/auto/qgl/tst_qgl.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 1957429..2bf3374 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -506,7 +506,7 @@ inline GLenum qt_gl_preferredTextureTarget() } // One resource per group of shared contexts. -class QGLContextResource : public QObject +class Q_AUTOTEST_EXPORT QGLContextResource : public QObject { Q_OBJECT public: diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index f15b249..e036e4b 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -1754,6 +1754,29 @@ void tst_QGL::destroyFBOAfterContext() delete fbo; } +#ifdef QT_BUILD_INTERNAL + +class tst_QGLResource : public QObject +{ + Q_OBJECT +public: + tst_QGLResource(QObject *parent = 0) : QObject(parent) {} + ~tst_QGLResource() { ++deletions; } + + static int deletions; +}; + +int tst_QGLResource::deletions = 0; + +static void qt_shared_test_free(void *data) +{ + delete reinterpret_cast(data); +} + +Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_test, (qt_shared_test_free)) + +#endif + void tst_QGL::shareRegister() { #ifdef QT_BUILD_INTERNAL @@ -1775,6 +1798,12 @@ void tst_QGL::shareRegister() guard.setId(3); QVERIFY(guard.id() == 3); + // Add a resource to the first context. + tst_QGLResource *res1 = new tst_QGLResource(); + QVERIFY(!qt_shared_test()->value(glw1->context())); + qt_shared_test()->insert(glw1->context(), res1); + QVERIFY(qt_shared_test()->value(glw1->context()) == res1); + // Create another context that shares with the first. QGLWidget *glw2 = new QGLWidget(0, glw1); if (!glw2->isSharing()) { @@ -1784,6 +1813,10 @@ void tst_QGL::shareRegister() } QVERIFY(glw1->context() != glw2->context()); + // Check that the first context's resource is also on the second. + QVERIFY(qt_shared_test()->value(glw1->context()) == res1); + QVERIFY(qt_shared_test()->value(glw2->context()) == res1); + // Guard should still be the same. QVERIFY(guard.context() == glw1->context()); QVERIFY(guard.id() == 3); @@ -1814,6 +1847,14 @@ void tst_QGL::shareRegister() QGLSharedResourceGuard guard3(glw3->context()); guard3.setId(5); + // Add a resource to the third context. + tst_QGLResource *res3 = new tst_QGLResource(); + QVERIFY(!qt_shared_test()->value(glw3->context())); + qt_shared_test()->insert(glw3->context(), res3); + QVERIFY(qt_shared_test()->value(glw1->context()) == res1); + QVERIFY(qt_shared_test()->value(glw2->context()) == res1); + QVERIFY(qt_shared_test()->value(glw3->context()) == res3); + // First two should still be sharing, but third is in its own list. list = shareReg->shares(glw1->context()); QCOMPARE(list.size(), 2); @@ -1849,6 +1890,11 @@ void tst_QGL::shareRegister() // Delete the first context. delete glw1; + // The first context's resource should transfer to the second context. + QCOMPARE(tst_QGLResource::deletions, 0); + QVERIFY(qt_shared_test()->value(glw2->context()) == res1); + QVERIFY(qt_shared_test()->value(glw3->context()) == res3); + // Shared guard should now be the second context, with the id the same. QVERIFY(guard.context() == glw2->context()); QVERIFY(guard.id() == 3); @@ -1859,9 +1905,11 @@ void tst_QGL::shareRegister() list = shareReg->shares(glw2->context()); QCOMPARE(list.size(), 0); - // Clean up. + // Clean up and check that the resources are properly deleted. delete glw2; + QCOMPARE(tst_QGLResource::deletions, 1); delete glw3; + QCOMPARE(tst_QGLResource::deletions, 2); // Guards should now be null and the id zero. QVERIFY(guard.context() == 0); -- cgit v0.12 From 5f34e11676002953fe5e9f94fbcd08739d46aba8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Oct 2009 08:50:12 +1000 Subject: Move QGLContextResource management into QGLContextGroup Context resources are per-group, so they should be managed by the group. This should also improve performance of context shutdown slightly by removing QGLSignalProxy::aboutToDestroyContext() signal dispatches to the resources. Reviewed-by: trustme --- src/opengl/qgl.cpp | 109 ++++++++++++----------------------------------------- src/opengl/qgl_p.h | 22 ++++++----- 2 files changed, 37 insertions(+), 94 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2327d7a..72dd184 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1806,6 +1806,8 @@ QGLContext::~QGLContext() QGLTextureCache::instance()->removeContextTextures(this); QGLTextureCache::deleteIfEmpty(); // ### thread safety + d_ptr->group->cleanupResources(this); + QGLSignalProxy::instance()->emitAboutToDestroyContext(this); reset(); } @@ -4908,16 +4910,15 @@ void QGLShareRegister::removeShare(const QGLContext *context) { group->m_shares.clear(); } -QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent) - : QObject(parent), free(f) +QGLContextResource::QGLContextResource(FreeFunc f) + : free(f), active(0) { - connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)), this, SLOT(removeOne(const QGLContext *))); } QGLContextResource::~QGLContextResource() { #ifndef QT_NO_DEBUG - if (m_resources.size()) { + if (active != 0) { qWarning("QtOpenGL: Resources are still available at program shutdown.\n" " This is possibly caused by a leaked QGLWidget, \n" " QGLFramebufferObject or QGLPixelBuffer."); @@ -4927,95 +4928,35 @@ QGLContextResource::~QGLContextResource() void QGLContextResource::insert(const QGLContext *key, void *value) { - QList shares = qgl_share_reg()->shares(key); - if (shares.size() == 0) - shares.append(key); - void *oldValue = 0; - for (int i = 0; i < shares.size(); ++i) { - ResourceHash::iterator it = m_resources.find(shares.at(i)); - if (it != m_resources.end()) { - Q_ASSERT(oldValue == 0 || oldValue == it.value()); - oldValue = it.value(); - it.value() = value; - } else { - m_resources.insert(shares.at(i), value); - } - } - if (oldValue != 0 && oldValue != value) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != key) - const_cast(key)->makeCurrent(); - free(oldValue); - if (oldContext && oldContext != key) - oldContext->makeCurrent(); - } + QGLContextGroup *group = QGLContextPrivate::contextGroup(key); + Q_ASSERT(!group->m_resources.contains(this)); + group->m_resources.insert(this, value); + active.ref(); } void *QGLContextResource::value(const QGLContext *key) { - ResourceHash::const_iterator it = m_resources.find(key); - // Check if there is a value associated with 'key'. - if (it != m_resources.end()) - return it.value(); - // Check if there is a value associated with sharing contexts. - QList shares = qgl_share_reg()->shares(key); - for (int i = 0; i < shares.size() && it == m_resources.end(); ++i) - it = m_resources.find(shares.at(i)); - if (it == m_resources.end()) - return 0; // Didn't find anything. - - // Found something! Share this info with all the buddies. - for (int i = 0; i < shares.size(); ++i) - m_resources.insert(shares.at(i), it.value()); - return it.value(); -} - -void QGLContextResource::removeGroup(const QGLContext *key) -{ - QList shares = qgl_share_reg()->shares(key); - if (shares.size() == 0) - shares.append(key); - void *oldValue = 0; - for (int i = 0; i < shares.size(); ++i) { - ResourceHash::iterator it = m_resources.find(shares.at(i)); - if (it != m_resources.end()) { - Q_ASSERT(oldValue == 0 || oldValue == it.value()); - oldValue = it.value(); - m_resources.erase(it); - } - } - if (oldValue != 0) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != key) - const_cast(key)->makeCurrent(); - free(oldValue); - if (oldContext && oldContext != key) - oldContext->makeCurrent(); - } + QGLContextGroup *group = QGLContextPrivate::contextGroup(key); + return group->m_resources.value(this, 0); } -void QGLContextResource::removeOne(const QGLContext *key) +void QGLContextResource::cleanup(const QGLContext *ctx, void *value) { - ResourceHash::iterator it = m_resources.find(key); - if (it == m_resources.end()) + QGLShareContextScope scope(ctx); + free(value); + active.deref(); +} + +void QGLContextGroup::cleanupResources(const QGLContext *ctx) +{ + // If there are still shares, then no cleanup to be done yet. + if (m_shares.size() > 1) return; - QList shares = qgl_share_reg()->shares(key); - if (shares.size() > 1) { - Q_ASSERT(key->isSharing()); - // At least one of the shared contexts must stay in the cache. - // Otherwise, the value pointer is lost. - for (int i = 0; i < 2/*shares.size()*/; ++i) - m_resources.insert(shares.at(i), it.value()); - } else { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != key) - const_cast(key)->makeCurrent(); - free(it.value()); - if (oldContext && oldContext != key) - oldContext->makeCurrent(); - } - m_resources.erase(it); + // Iterate over all resources and free each in turn. + QHash::ConstIterator it; + for (it = m_resources.begin(); it != m_resources.end(); ++it) + it.key()->cleanup(ctx, it.value()); } QGLContextReference::QGLContextReference(const QGLContext *ctx) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 2bf3374..fd7f544 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -219,6 +219,8 @@ public: #endif }; +class QGLContextResource; + // QGLContextPrivate has the responsibility of creating context groups. // QGLContextPrivate and QGLShareRegister will both maintain the reference counter and destroy // context groups when needed. @@ -234,10 +236,15 @@ private: QGLExtensionFuncs m_extensionFuncs; const QGLContext *m_context; // context group's representative QList m_shares; + QHash m_resources; QAtomicInt m_refs; + void cleanupResources(const QGLContext *ctx); + friend class QGLShareRegister; + friend class QGLContext; friend class QGLContextPrivate; + friend class QGLContextResource; }; // Reference to a QGLContext which automatically switches to another @@ -506,26 +513,21 @@ inline GLenum qt_gl_preferredTextureTarget() } // One resource per group of shared contexts. -class Q_AUTOTEST_EXPORT QGLContextResource : public QObject +class Q_AUTOTEST_EXPORT QGLContextResource { - Q_OBJECT public: typedef void (*FreeFunc)(void *); - QGLContextResource(FreeFunc f, QObject *parent = 0); + QGLContextResource(FreeFunc f); ~QGLContextResource(); // Set resource 'value' for 'key' and all its shared contexts. void insert(const QGLContext *key, void *value); // Return resource for 'key' or a shared context. void *value(const QGLContext *key); - // Free resource for 'key' and all its shared contexts. - void removeGroup(const QGLContext *key); -private slots: - // Remove entry 'key' from cache and delete resource if there are no shared contexts. - void removeOne(const QGLContext *key); + // Cleanup 'value' in response to a context group being destroyed. + void cleanup(const QGLContext *ctx, void *value); private: - typedef QHash ResourceHash; - ResourceHash m_resources; FreeFunc free; + QAtomicInt active; }; // Temporarily make a context current if not already current or -- cgit v0.12 From a3add3d6ab1b7a3e4dbb2df81fd51625b834fe45 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Oct 2009 09:40:37 +1000 Subject: Merge QGLContextReference into QGLContextGroup Reviewed-by: trustme --- src/opengl/qgl.cpp | 64 +++++++++++++++++++++++++++++++----------------- src/opengl/qgl_p.h | 71 +++++++++++++++--------------------------------------- 2 files changed, 62 insertions(+), 73 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 72dd184..7dbe642 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1393,11 +1393,39 @@ bool operator!=(const QGLFormat& a, const QGLFormat& b) /***************************************************************************** QGLContext implementation *****************************************************************************/ -QGLContextPrivate::~QGLContextPrivate() + +QGLContextGroup::~QGLContextGroup() +{ + // Clear any remaining QGLSharedResourceGuard objects on the group. + QGLSharedResourceGuard *guard = m_guards; + while (guard != 0) { + guard->m_group = 0; + guard->m_id = 0; + guard = guard->m_next; + } +} + +void QGLContextGroup::addGuard(QGLSharedResourceGuard *guard) +{ + if (m_guards) + m_guards->m_prev = guard; + guard->m_next = m_guards; + guard->m_prev = 0; + m_guards = guard; +} + +void QGLContextGroup::removeGuard(QGLSharedResourceGuard *guard) { - if (!reference->deref()) - delete reference; + if (guard->m_next) + guard->m_next->m_prev = guard->m_prev; + if (guard->m_prev) + guard->m_prev->m_next = guard->m_next; + else + m_guards = guard->m_next; +} +QGLContextPrivate::~QGLContextPrivate() +{ if (!group->m_refs.deref()) { Q_ASSERT(group->context() == q_ptr); delete group; @@ -4959,30 +4987,22 @@ void QGLContextGroup::cleanupResources(const QGLContext *ctx) it.key()->cleanup(ctx, it.value()); } -QGLContextReference::QGLContextReference(const QGLContext *ctx) - : m_ref(1), m_ctx(ctx) +QGLSharedResourceGuard::~QGLSharedResourceGuard() { - connect(QGLSignalProxy::instance(), - SIGNAL(aboutToDestroyContext(const QGLContext *)), - this, SLOT(aboutToDestroyContext(const QGLContext *))); + if (m_group) + m_group->removeGuard(this); } -void QGLContextReference::aboutToDestroyContext(const QGLContext *ctx) +void QGLSharedResourceGuard::setContext(const QGLContext *context) { - // Bail out if our context is not being destroyed. - if (ctx != m_ctx || !m_ctx) - return; - - // Find some other context that this one is shared with to take over. - QList shares = qgl_share_reg()->shares(m_ctx); - shares.removeAll(m_ctx); - if (!shares.isEmpty()) { - m_ctx = shares[0]; - return; + if (m_group) + m_group->removeGuard(this); + if (context) { + m_group = QGLContextPrivate::contextGroup(context); + m_group->addGuard(this); + } else { + m_group = 0; } - - // No more contexts sharing with this one, so the reference is now invalid. - m_ctx = 0; } QT_END_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index fd7f544..38a1845 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -220,6 +220,7 @@ public: }; class QGLContextResource; +class QGLSharedResourceGuard; // QGLContextPrivate has the responsibility of creating context groups. // QGLContextPrivate and QGLShareRegister will both maintain the reference counter and destroy @@ -228,15 +229,21 @@ class QGLContextResource; class QGLContextGroup { public: + ~QGLContextGroup(); + QGLExtensionFuncs &extensionFuncs() {return m_extensionFuncs;} const QGLContext *context() const {return m_context;} + + void addGuard(QGLSharedResourceGuard *guard); + void removeGuard(QGLSharedResourceGuard *guard); private: - QGLContextGroup(const QGLContext *context) : m_context(context), m_refs(1) { } + QGLContextGroup(const QGLContext *context) : m_context(context), m_guards(0), m_refs(1) { } QGLExtensionFuncs m_extensionFuncs; const QGLContext *m_context; // context group's representative QList m_shares; QHash m_resources; + QGLSharedResourceGuard *m_guards; // double-linked list of active guards. QAtomicInt m_refs; void cleanupResources(const QGLContext *ctx); @@ -247,37 +254,13 @@ private: friend class QGLContextResource; }; -// Reference to a QGLContext which automatically switches to another -// shared context when the main one is destroyed. If there is no -// shared context to switch to, the context pointer is set to null. -// Note: should be merged into QGLContextGroup at some point. -class QGLContextReference : public QObject -{ - Q_OBJECT -public: - QGLContextReference(const QGLContext *ctx); - ~QGLContextReference() {} - - const QGLContext *context() const { return m_ctx; } - - void ref() { m_ref.ref(); } - bool deref() { return m_ref.deref(); } - -private slots: - void aboutToDestroyContext(const QGLContext *ctx); - -private: - QAtomicInt m_ref; - const QGLContext *m_ctx; -}; - class QGLTexture; class QGLContextPrivate { Q_DECLARE_PUBLIC(QGLContext) public: - explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {reference = new QGLContextReference(context); group = new QGLContextGroup(context);} + explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {group = new QGLContextGroup(context);} ~QGLContextPrivate(); QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options); @@ -340,7 +323,6 @@ public: QGLContext *q_ptr; QGLFormat::OpenGLVersionFlags version_flags; - QGLContextReference *reference; QGLContextGroup *group; GLint max_texture_size; @@ -579,44 +561,27 @@ class Q_OPENGL_EXPORT QGLSharedResourceGuard { public: QGLSharedResourceGuard(const QGLContext *context) - : m_ctxref(0), m_id(0) + : m_group(0), m_id(0), m_next(0), m_prev(0) { setContext(context); } QGLSharedResourceGuard(const QGLContext *context, GLuint id) - : m_ctxref(0), m_id(id) + : m_group(0), m_id(id), m_next(0), m_prev(0) { setContext(context); } - ~QGLSharedResourceGuard() - { - if (m_ctxref && !m_ctxref->deref()) - delete m_ctxref; - } + ~QGLSharedResourceGuard(); const QGLContext *context() const { - return m_ctxref ? m_ctxref->context() : 0; + return m_group ? m_group->context() : 0; } - void setContext(const QGLContext *context) - { - if (m_ctxref && !m_ctxref->deref()) - delete m_ctxref; - if (context) { - m_ctxref = context->d_ptr->reference; - m_ctxref->ref(); - } else { - m_ctxref = 0; - } - } + void setContext(const QGLContext *context); GLuint id() const { - if (m_ctxref && m_ctxref->context()) - return m_id; - else - return 0; + return m_id; } void setId(GLuint id) @@ -625,8 +590,12 @@ public: } private: - QGLContextReference *m_ctxref; + QGLContextGroup *m_group; GLuint m_id; + QGLSharedResourceGuard *m_next; + QGLSharedResourceGuard *m_prev; + + friend class QGLContextGroup; }; QT_END_NAMESPACE -- cgit v0.12 From 7b19bfec4c496f2112b363cbdc8a0c302a48cfce Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Oct 2009 11:55:53 +1000 Subject: Consistently use QGLShareContextScope for context switching QGLShareContextScope is safer and more reliable than trying to manually detect how and when to temporarily switch contexts. Replace the few remaining instances of context-switching with it. Reviewed-by: trustme --- .../gl2paintengineex/qglengineshadermanager.cpp | 6 +- src/opengl/gl2paintengineex/qglgradientcache.cpp | 6 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 6 +- src/opengl/qgl_p.h | 90 ++++++++++------------ 4 files changed, 45 insertions(+), 63 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 59c50aa..e22303d 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -60,12 +60,8 @@ QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLConte { QGLEngineSharedShaders *p = reinterpret_cast(qt_shared_shaders()->value(context)); if (!p) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != context) - const_cast(context)->makeCurrent(); + QGLShareContextScope scope(context); qt_shared_shaders()->insert(context, p = new QGLEngineSharedShaders(context)); - if (oldContext && oldContext != context) - oldContext->makeCurrent(); } return p; } diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp index 4b2b2a0..e06f15d 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache.cpp +++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp @@ -57,13 +57,9 @@ QGL2GradientCache *QGL2GradientCache::cacheForContext(const QGLContext *context) { QGL2GradientCache *p = reinterpret_cast(qt_gradient_caches()->value(context)); if (!p) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != context) - const_cast(context)->makeCurrent(); + QGLShareContextScope scope(context); p = new QGL2GradientCache; qt_gradient_caches()->insert(context, p); - if (oldContext && oldContext != context) - oldContext->makeCurrent(); } return p; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 992d47d..073f7db 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -162,15 +162,11 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph QGLTextureGlyphCache::~QGLTextureGlyphCache() { if (ctx) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - if (oldContext != ctx) - ctx->makeCurrent(); + QGLShareContextScope scope(ctx); glDeleteFramebuffers(1, &m_fbo); if (m_width || m_height) glDeleteTextures(1, &m_texture); - if (oldContext && oldContext != ctx) - oldContext->makeCurrent(); } } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 38a1845..8d4f673 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -400,6 +400,46 @@ public: extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg(); +// Temporarily make a context current if not already current or +// shared with the current contex. The previous context is made +// current when the object goes out of scope. +class Q_OPENGL_EXPORT QGLShareContextScope +{ +public: + QGLShareContextScope(const QGLContext *ctx) + : m_oldContext(0) + { + QGLContext *currentContext = const_cast(QGLContext::currentContext()); + if (currentContext != ctx && !QGLContext::areSharing(ctx, currentContext)) { + m_oldContext = currentContext; + m_ctx = const_cast(ctx); + m_ctx->makeCurrent(); + } else { + m_ctx = currentContext; + } + } + + operator QGLContext *() + { + return m_ctx; + } + + QGLContext *operator->() + { + return m_ctx; + } + + ~QGLShareContextScope() + { + if (m_oldContext) + m_oldContext->makeCurrent(); + } + +private: + QGLContext *m_oldContext; + QGLContext *m_ctx; +}; + class QGLTexture { public: QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D, @@ -415,12 +455,8 @@ public: ~QGLTexture() { if (options & QGLContext::MemoryManagedBindOption) { - QGLContext *current = const_cast(QGLContext::currentContext()); - QGLContext *ctx = const_cast(context); - Q_ASSERT(ctx); - bool switch_context = current != ctx && !QGLContext::areSharing(current, ctx); - if (switch_context) - ctx->makeCurrent(); + Q_ASSERT(context); + QGLShareContextScope scope(context); #if defined(Q_WS_X11) // Although glXReleaseTexImage is a glX call, it must be called while there // is a current context - the context the pixmap was bound to a texture in. @@ -430,8 +466,6 @@ public: QGLContextPrivate::unbindPixmapFromTexture(boundPixmap); #endif glDeleteTextures(1, &id); - if (switch_context && current) - current->makeCurrent(); } } @@ -512,46 +546,6 @@ private: QAtomicInt active; }; -// Temporarily make a context current if not already current or -// shared with the current contex. The previous context is made -// current when the object goes out of scope. -class Q_OPENGL_EXPORT QGLShareContextScope -{ -public: - QGLShareContextScope(const QGLContext *ctx) - : m_oldContext(0) - { - QGLContext *currentContext = const_cast(QGLContext::currentContext()); - if (currentContext != ctx && !QGLContext::areSharing(ctx, currentContext)) { - m_oldContext = currentContext; - m_ctx = const_cast(ctx); - m_ctx->makeCurrent(); - } else { - m_ctx = currentContext; - } - } - - operator QGLContext *() - { - return m_ctx; - } - - QGLContext *operator->() - { - return m_ctx; - } - - ~QGLShareContextScope() - { - if (m_oldContext) - m_oldContext->makeCurrent(); - } - -private: - QGLContext *m_oldContext; - QGLContext *m_ctx; -}; - // Put a guard around a GL object identifier and its context. // When the context goes away, a shared context will be used // in its place. If there are no more shared contexts, then -- cgit v0.12 From e090374657b98b92b040bb0de11e2ce6c085077d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 5 Oct 2009 11:59:16 +1000 Subject: Fix so fx items are not stretched to the width of the menu bar in qmlviewer. --- tools/qmlviewer/qmlviewer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index b2884dd..e185536 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -302,7 +302,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) setLayout(layout); if (mb) layout->addWidget(mb); - layout->addWidget(canvas); + layout->addWidget(canvas, 0, Qt::AlignLeft); setupProxy(); canvas->engine()->networkAccessManager()->setCookieJar(new PersistentCookieJar(this)); @@ -651,6 +651,7 @@ void QmlViewer::openQml(const QString& fileName) if (!skin) { canvas->updateGeometry(); canvas->resize(canvas->sizeHint()); + canvas->updateGeometry(); resize(sizeHint()); } else { if (scaleSkin) -- cgit v0.12 From 9d3505cec4749c86ca2782726388c040941ed25c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 5 Oct 2009 12:42:39 +1000 Subject: Fix Rectangle size when drawing with qDrawBorderPixmap. --- src/declarative/fx/qfxrect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index eb8103c..0648ac4 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -459,7 +459,7 @@ void QFxRect::drawRect(QPainter &p) QMargins margins(xOffset, yOffset, xOffset, yOffset); QTileRules rules(Qt::StretchTile, Qt::StretchTile); - qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, d->rectImage.width()/2 + xOffset*2, d->rectImage.height()/2 + yOffset*2), margins, d->rectImage, d->rectImage.rect(), margins, rules); + qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules); if (d->smooth) { p.setRenderHint(QPainter::Antialiasing, oldAA); -- cgit v0.12 From d480c23bf54a4dce59b4d29c6276b875307b11ce Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 5 Oct 2009 13:17:19 +1000 Subject: Experiment with syncing GraphicsObjectContainer and QGraphicsWidget sizes. --- src/declarative/fx/qfxgraphicsobjectcontainer.cpp | 96 ++++++++++++++++++++++- src/declarative/fx/qfxgraphicsobjectcontainer.h | 9 +++ 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxgraphicsobjectcontainer.cpp b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp index 08120fc..c0cac6c 100644 --- a/src/declarative/fx/qfxgraphicsobjectcontainer.cpp +++ b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp @@ -41,6 +41,8 @@ #include "qfxgraphicsobjectcontainer.h" #include +#include +#include QT_BEGIN_NAMESPACE @@ -59,7 +61,7 @@ QML_DEFINE_NOCREATE_TYPE(QGraphicsObject) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GraphicsObjectContainer,QFxGraphicsObjectContainer) QFxGraphicsObjectContainer::QFxGraphicsObjectContainer(QFxItem *parent) -: QFxItem(parent), _graphicsObject(0) +: QFxItem(parent), _graphicsObject(0), _syncedResize(false) { } @@ -81,9 +83,20 @@ void QFxGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) if (object == _graphicsObject) return; + //### what should we do with previously set object? + _graphicsObject = object; - _graphicsObject->setParentItem(this); + if (_graphicsObject) { + _graphicsObject->setParentItem(this); + + if (_syncedResize && _graphicsObject->isWidget()) { + _graphicsObject->installEventFilter(this); + QSizeF newSize = static_cast(_graphicsObject)->size(); //### use sizeHint? + setImplicitWidth(newSize.width()); + setImplicitHeight(newSize.height()); + } + } } QVariant QFxGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value) @@ -96,4 +109,83 @@ QVariant QFxGraphicsObjectContainer::itemChange(GraphicsItemChange change, const return QFxItem::itemChange(change, value); } +bool QFxGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) +{ + if (watched == _graphicsObject && e->type() == QEvent::GraphicsSceneResize) { + if (_graphicsObject && _graphicsObject->isWidget() && _syncedResize) { + QSizeF newSize = static_cast(_graphicsObject)->size(); + setImplicitWidth(newSize.width()); + setImplicitHeight(newSize.height()); + } + } + return QFxItem::eventFilter(watched, e); +} + +/*! + \qmlproperty bool GraphicsObjectContainer::synchronizedResizing + + This property determines whether or not the container and graphics object will synchronize their + sizes. + + \note This property only applies when wrapping a QGraphicsWidget. + + If synchronizedResizing is enabled, the container and widget will + synchronize their sizes as follows. + \list + \o If a size has been set on the container, the widget will be resized to the container. + Any changes in the container's size will be reflected in the widget. + + \o \e Otherwise, the container will initially be sized to the preferred size of the widget. + Any changes to the container's size will be reflected in the widget, and any changes to the + widget's size will be reflected in the container. + \endlist +*/ +bool QFxGraphicsObjectContainer::synchronizedResizing() const +{ + return _syncedResize; +} + +void QFxGraphicsObjectContainer::setSynchronizedResizing(bool on) +{ + if (on == _syncedResize) + return; + + if (_graphicsObject && _graphicsObject->isWidget()) { + if (!on) { + _graphicsObject->removeEventFilter(this); + disconnect(this, SIGNAL(widthChanged()), this, SLOT(_q_updateSize())); + disconnect(this, SIGNAL(heightChanged()), this, SLOT(_q_updateSize())); + } + } + + _syncedResize = on; + + if (_graphicsObject && _graphicsObject->isWidget()) { + if (on) { + _graphicsObject->installEventFilter(this); + connect(this, SIGNAL(widthChanged()), this, SLOT(_q_updateSize())); + connect(this, SIGNAL(heightChanged()), this, SLOT(_q_updateSize())); + } + } +} + +void QFxGraphicsObjectContainer::_q_updateSize() +{ + if (!_graphicsObject || !_graphicsObject->isWidget() || !_syncedResize) + return; + + QGraphicsWidget *gw = static_cast(_graphicsObject); + const QSizeF newSize(width(), height()); + gw->resize(newSize); + + //### will respecting the widgets min/max ever get us in trouble? (all other items always + // size to exactly what you tell them) + /*QSizeF constrainedSize = newSize.expandedTo(gw->minimumSize()).boundedTo(gw->maximumSize()); + gw->resize(constrainedSize); + if (constrainedSize != newSize) { + setImplicitWidth(constrainedSize.width()); + setImplicitHeight(constrainedSize.height()); + }*/ +} + QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxgraphicsobjectcontainer.h b/src/declarative/fx/qfxgraphicsobjectcontainer.h index 165bc48..a8b7c8c 100644 --- a/src/declarative/fx/qfxgraphicsobjectcontainer.h +++ b/src/declarative/fx/qfxgraphicsobjectcontainer.h @@ -58,6 +58,7 @@ class Q_DECLARATIVE_EXPORT QFxGraphicsObjectContainer : public QFxItem Q_CLASSINFO("DefaultProperty", "graphicsObject") Q_PROPERTY(QGraphicsObject *graphicsObject READ graphicsObject WRITE setGraphicsObject) + Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing) public: QFxGraphicsObjectContainer(QFxItem *parent = 0); @@ -66,11 +67,19 @@ public: QGraphicsObject *graphicsObject() const; void setGraphicsObject(QGraphicsObject *); + bool synchronizedResizing() const; + void setSynchronizedResizing(bool on); + protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value); + bool eventFilter(QObject *watched, QEvent *e); + +private Q_SLOTS: + void _q_updateSize(); private: QGraphicsObject *_graphicsObject; + bool _syncedResize; }; QT_END_NAMESPACE -- cgit v0.12 From be4ed0f02bf6c46e5d9c915b1d0d2b38c40bdfda Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 5 Oct 2009 14:56:07 +1000 Subject: Change .sci syntax to match BorderImage. --- demos/declarative/flickr/common/pics/button-pressed.sci | 10 +++++----- demos/declarative/flickr/common/pics/button.sci | 10 +++++----- demos/declarative/flickr/mobile/images/lineedit.sci | 10 +++++----- demos/declarative/flickr/mobile/images/titlebar.sci | 10 +++++----- demos/declarative/flickr/mobile/images/toolbutton.sci | 10 +++++----- .../declarative/webbrowser/content/pics/addressbar-filled.sci | 10 +++++----- demos/declarative/webbrowser/content/pics/addressbar.sci | 10 +++++----- demos/declarative/webbrowser/content/pics/footer.sci | 10 +++++----- demos/declarative/webbrowser/content/pics/softshadow-left.sci | 10 +++++----- demos/declarative/webbrowser/content/pics/softshadow-right.sci | 10 +++++----- examples/declarative/border-image/colors-round.sci | 10 +++++----- examples/declarative/border-image/colors-stretch.sci | 10 +++++----- src/declarative/fx/qfxscalegrid.cpp | 10 +++++----- 13 files changed, 65 insertions(+), 65 deletions(-) diff --git a/demos/declarative/flickr/common/pics/button-pressed.sci b/demos/declarative/flickr/common/pics/button-pressed.sci index d3b16e2..b8db272 100644 --- a/demos/declarative/flickr/common/pics/button-pressed.sci +++ b/demos/declarative/flickr/common/pics/button-pressed.sci @@ -1,5 +1,5 @@ -gridLeft: 8 -gridTop: 4 -gridBottom: 4 -gridRight: 8 -imageFile: button.png +border.left: 8 +border.top: 4 +border.bottom: 4 +border.right: 8 +source: button.png diff --git a/demos/declarative/flickr/common/pics/button.sci b/demos/declarative/flickr/common/pics/button.sci index d3b16e2..b8db272 100644 --- a/demos/declarative/flickr/common/pics/button.sci +++ b/demos/declarative/flickr/common/pics/button.sci @@ -1,5 +1,5 @@ -gridLeft: 8 -gridTop: 4 -gridBottom: 4 -gridRight: 8 -imageFile: button.png +border.left: 8 +border.top: 4 +border.bottom: 4 +border.right: 8 +source: button.png diff --git a/demos/declarative/flickr/mobile/images/lineedit.sci b/demos/declarative/flickr/mobile/images/lineedit.sci index 7c5ec6c..054bff7 100644 --- a/demos/declarative/flickr/mobile/images/lineedit.sci +++ b/demos/declarative/flickr/mobile/images/lineedit.sci @@ -1,5 +1,5 @@ -gridLeft: 10 -gridTop: 10 -gridBottom: 10 -gridRight: 10 -imageFile: lineedit.png +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/demos/declarative/flickr/mobile/images/titlebar.sci b/demos/declarative/flickr/mobile/images/titlebar.sci index 50444e1..0418d94 100644 --- a/demos/declarative/flickr/mobile/images/titlebar.sci +++ b/demos/declarative/flickr/mobile/images/titlebar.sci @@ -1,5 +1,5 @@ -gridLeft: 10 -gridTop: 12 -gridBottom: 12 -gridRight: 10 -imageFile: titlebar.png +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/demos/declarative/flickr/mobile/images/toolbutton.sci b/demos/declarative/flickr/mobile/images/toolbutton.sci index a0a885f..9e4f965 100644 --- a/demos/declarative/flickr/mobile/images/toolbutton.sci +++ b/demos/declarative/flickr/mobile/images/toolbutton.sci @@ -1,5 +1,5 @@ -gridLeft: 15 -gridTop: 4 -gridBottom: 4 -gridRight: 15 -imageFile: toolbutton.png +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci index 464dbf5..96c5efb 100644 --- a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci +++ b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci @@ -1,6 +1,6 @@ -gridLeft: 7 -gridTop: 7 -gridBottom: 7 -gridRight: 7 -imageFile: addressbar-filled.png +border.left: 7 +border.top: 7 +border.bottom: 7 +border.right: 7 +source: addressbar-filled.png diff --git a/demos/declarative/webbrowser/content/pics/addressbar.sci b/demos/declarative/webbrowser/content/pics/addressbar.sci index 23a2a19..8f1cd18 100644 --- a/demos/declarative/webbrowser/content/pics/addressbar.sci +++ b/demos/declarative/webbrowser/content/pics/addressbar.sci @@ -1,6 +1,6 @@ -gridLeft: 7 -gridTop: 7 -gridBottom: 7 -gridRight: 7 -imageFile: addressbar.png +border.left: 7 +border.top: 7 +border.bottom: 7 +border.right: 7 +source: addressbar.png diff --git a/demos/declarative/webbrowser/content/pics/footer.sci b/demos/declarative/webbrowser/content/pics/footer.sci index be1d086..7be58f1 100644 --- a/demos/declarative/webbrowser/content/pics/footer.sci +++ b/demos/declarative/webbrowser/content/pics/footer.sci @@ -1,6 +1,6 @@ -gridLeft: 5 -gridTop: 0 -gridBottom: 0 -gridRight: 5 -imageFile: footer.png +border.left: 5 +border.top: 0 +border.bottom: 0 +border.right: 5 +source: footer.png diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.sci b/demos/declarative/webbrowser/content/pics/softshadow-left.sci index 82e38f8..45c88d5 100644 --- a/demos/declarative/webbrowser/content/pics/softshadow-left.sci +++ b/demos/declarative/webbrowser/content/pics/softshadow-left.sci @@ -1,5 +1,5 @@ -gridLeft: 0 -gridTop: 16 -gridBottom: 16 -gridRight: 0 -imageFile: softshadow-left.png +border.left: 0 +border.top: 16 +border.bottom: 16 +border.right: 0 +source: softshadow-left.png diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.sci b/demos/declarative/webbrowser/content/pics/softshadow-right.sci index e9494ed..4d459c0 100644 --- a/demos/declarative/webbrowser/content/pics/softshadow-right.sci +++ b/demos/declarative/webbrowser/content/pics/softshadow-right.sci @@ -1,5 +1,5 @@ -gridLeft: 0 -gridTop: 16 -gridBottom: 16 -gridRight: 0 -imageFile: softshadow-right.png +border.left: 0 +border.top: 16 +border.bottom: 16 +border.right: 0 +source: softshadow-right.png diff --git a/examples/declarative/border-image/colors-round.sci b/examples/declarative/border-image/colors-round.sci index 3784e10..506f6f5 100644 --- a/examples/declarative/border-image/colors-round.sci +++ b/examples/declarative/border-image/colors-round.sci @@ -1,7 +1,7 @@ -gridLeft:30 -gridTop:30 -gridRight:30 -gridBottom:30 +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 horizontalTileRule:Round verticalTileRule:Round -imageFile:colors.png +source:colors.png diff --git a/examples/declarative/border-image/colors-stretch.sci b/examples/declarative/border-image/colors-stretch.sci index c693599..e4989a7 100644 --- a/examples/declarative/border-image/colors-stretch.sci +++ b/examples/declarative/border-image/colors-stretch.sci @@ -1,5 +1,5 @@ -gridLeft:30 -gridTop:30 -gridRight:30 -gridBottom:30 -imageFile:colors.png +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 +source:colors.png diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp index f0c5758..4c6a522 100644 --- a/src/declarative/fx/qfxscalegrid.cpp +++ b/src/declarative/fx/qfxscalegrid.cpp @@ -142,15 +142,15 @@ QFxGridScaledImage::QFxGridScaledImage(QIODevice *data) list[0] = list[0].trimmed(); list[1] = list[1].trimmed(); - if (list[0] == QLatin1String("gridLeft")) + if (list[0] == QLatin1String("border.left")) l = list[1].toInt(); - else if (list[0] == QLatin1String("gridRight")) + else if (list[0] == QLatin1String("border.right")) r = list[1].toInt(); - else if (list[0] == QLatin1String("gridTop")) + else if (list[0] == QLatin1String("border.top")) t = list[1].toInt(); - else if (list[0] == QLatin1String("gridBottom")) + else if (list[0] == QLatin1String("border.bottom")) b = list[1].toInt(); - else if (list[0] == QLatin1String("imageFile")) + else if (list[0] == QLatin1String("source")) imgFile = list[1]; else if (list[0] == QLatin1String("horizontalTileRule")) _h = stringToRule(list[1]); -- cgit v0.12 From 5cfc52167e1fbfaabe1f060308241d2100505bad Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 5 Oct 2009 15:13:01 +1000 Subject: Minor fixes to flickr example. --- demos/declarative/flickr/flickr-desktop.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 6a4efd9..f8cf048 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -70,8 +70,8 @@ Item { PropertyChanges { target: ItemRotation; angle: 0 } PropertyChanges { target: Shadows; opacity: 0 } PropertyChanges { target: ImageDetails; y: 20 } - PropertyChanges { target: PhotoGridView; y: "-480" } - PropertyChanges { target: PhotoPathView; y: "-480" } + PropertyChanges { target: PhotoGridView; y: -480 } + PropertyChanges { target: PhotoPathView; y: -480 } PropertyChanges { target: ViewModeButton; opacity: 0 } PropertyChanges { target: TagsEdit; opacity: 0 } PropertyChanges { target: FetchButton; opacity: 0 } @@ -82,8 +82,10 @@ Item { transitions: [ Transition { from: "*"; to: "Details" - ParentAction { } - NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + SequentialAnimation { + ParentAction { } + NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + } }, Transition { from: "Details"; to: "*" -- cgit v0.12 From 7520e4fde92efc5621e42c8fe032e41f729f269f Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 5 Oct 2009 15:25:39 +1000 Subject: update doc --- src/declarative/fx/qfxborderimage.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/declarative/fx/qfxborderimage.cpp b/src/declarative/fx/qfxborderimage.cpp index 3bc76da..6616912 100644 --- a/src/declarative/fx/qfxborderimage.cpp +++ b/src/declarative/fx/qfxborderimage.cpp @@ -124,19 +124,16 @@ QFxBorderImage::~QFxBorderImage() BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. It can also handle .sci files, which are a Qml-specific format. A .sci file uses a simple text-based format that specifies - \list - \i the grid lines describing a \l {BorderImage::border.left}{scale grid}. - \i an image file. - \endlist - - The following .sci file sets grid line offsets of 10 on each side for the image \c picture.png: - \code - gridLeft: 10 - gridTop: 10 - gridBottom: 10 - gridRight: 10 - imageFile: picture.png - \endcode + the borders, the image file and the tile rules. + + The following .sci file sets the borders to 10 on each side for the image \c picture.png: + \qml + border.left: 10 + border.top: 10 + border.bottom: 10 + border.right: 10 + source: picture.png + \endqml The URL may be absolute, or relative to the URL of the component. */ -- cgit v0.12 From 3909d97e86d62fd94e149925b5f3111c8f391334 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 --- 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 a14337a9e9812bb485ba5774a8bccc977e1e9519 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 5 Oct 2009 15:39:34 +1000 Subject: Trivial WebView autotest --- .../auto/declarative/qfxwebview/data/creation.qml | 3 ++ tests/auto/declarative/qfxwebview/qfxwebview.pro | 6 +++ .../auto/declarative/qfxwebview/tst_qfxwebview.cpp | 59 ++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 tests/auto/declarative/qfxwebview/data/creation.qml create mode 100644 tests/auto/declarative/qfxwebview/qfxwebview.pro create mode 100644 tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp diff --git a/tests/auto/declarative/qfxwebview/data/creation.qml b/tests/auto/declarative/qfxwebview/data/creation.qml new file mode 100644 index 0000000..bb49143 --- /dev/null +++ b/tests/auto/declarative/qfxwebview/data/creation.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +WebView { } diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro new file mode 100644 index 0000000..ee78950 --- /dev/null +++ b/tests/auto/declarative/qfxwebview/qfxwebview.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qfxwebview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp new file mode 100644 index 0000000..974a4b7 --- /dev/null +++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp @@ -0,0 +1,59 @@ +#include +#include "../../../shared/util.h" +#include +#include +#include +#include +#include + +class tst_qfxwebview : public QObject +{ + Q_OBJECT +public: + tst_qfxwebview() {} + +private slots: + void testQmlFiles_data(); + void testQmlFiles(); + +private: + void checkNoErrors(const QmlComponent& component); + QmlEngine engine; +}; + + +void tst_qfxwebview::checkNoErrors(const QmlComponent& component) +{ + if (component.isError()) { + QList errors = component.errors(); + for (int ii = 0; ii < errors.count(); ++ii) { + const QmlError &error = errors.at(ii); + QByteArray errorStr = QByteArray::number(error.line()) + ":" + + QByteArray::number(error.column()) + ":" + + error.description().toUtf8(); + qWarning() << errorStr; + } + } + QVERIFY(!component.isError()); +} + +void tst_qfxwebview::testQmlFiles_data() +{ + QTest::addColumn("qmlfile"); // The input file + + QTest::newRow("creation") << QUrl::fromLocalFile(SRCDIR "/data/creation.qml"); +} + +void tst_qfxwebview::testQmlFiles() +{ + QFETCH(QUrl, qmlfile); + + QmlComponent component(&engine, qmlfile); + checkNoErrors(component); + QFxWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); +} + +QTEST_MAIN(tst_qfxwebview) + +#include "tst_qfxwebview.moc" -- cgit v0.12 From a3349d20dca10d32fc8ab95591108f1ec49dc034 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 5 Oct 2009 15:51:00 +1000 Subject: Fix example following API changes and fix window size for example 2. --- .../contacts/1_Drawing_and_Animation/1/RemoveButton.qml | 11 +++++++++++ .../contacts/1_Drawing_and_Animation/1/Removebutton.qml | 11 ----------- .../declarative/tutorials/contacts/2_Reuse/1/ContactField.qml | 2 +- .../tutorials/contacts/2_Reuse/1a/ContactField.qml | 2 +- .../declarative/tutorials/contacts/2_Reuse/2/ContactField.qml | 2 +- examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml | 5 +++-- examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml | 5 +++-- .../tutorials/contacts/3_Collections/3_Collections.qml | 2 +- .../tutorials/contacts/3_Collections/lib/Contact.qml | 1 - 9 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/RemoveButton.qml delete mode 100644 examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/Removebutton.qml diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/RemoveButton.qml new file mode 100644 index 0000000..a8ac7fe --- /dev/null +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/RemoveButton.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +//! [0] +Rectangle { + id: removeButton + width: 30 + height: 30 + color: "red" + radius: 5 +} +//! [0] diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/Removebutton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/Removebutton.qml deleted file mode 100644 index a8ac7fe..0000000 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1/Removebutton.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -//! [0] -Rectangle { - id: removeButton - width: 30 - height: 30 - color: "red" - radius: 5 -} -//! [0] diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml index 162452f..9508018 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml @@ -21,7 +21,7 @@ Item { anchors.verticalCenter: parent.verticalCenter font.bold: true color: "black" - text: 123123 + text: "123123" } Image { source: "../../shared/pics/phone.png" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml index cf50fb0..e50dcc5 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml @@ -24,7 +24,7 @@ Item { anchors.verticalCenter: parent.verticalCenter font.bold: true color: "black" - text: 123123 + text: "123123" } Image { source: "../../shared/pics/phone.png" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml index 2e1a488..ce6a289 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml @@ -23,7 +23,7 @@ Item { anchors.verticalCenter: parent.verticalCenter font.bold: true color: "black" - text: 123123 + text: "123123" } Image { source: "../../shared/pics/phone.png" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml index 3516cee..f253763 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml @@ -16,9 +16,10 @@ Item { Column { id: layout - anchors.fill: parent + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right spacing: 5 - margin: 5 ContactField { id: labelField anchors.left: layout.left diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml index 83988ab..db85d2a 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml @@ -19,9 +19,10 @@ Item { Column { id: layout - anchors.fill: parent + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right spacing: 5 - margin: 5 ContactField { id: labelField anchors.left: layout.left diff --git a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml b/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml index a7764ed..cd14a08 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml @@ -5,7 +5,7 @@ Rectangle { width: layout.width height: layout.height color: "white" - Bind { + Binding { id: currentItem value: true } diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml index d00bf05..58a542b 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml @@ -17,7 +17,6 @@ Item { id: layout anchors.fill: parent spacing: 5 - margin: 5 ContactField { id: labelField anchors.left: layout.left -- cgit v0.12 From c488298d4c15fb39ef960bda19f28c9ea9b9054b 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 --- 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 1aaa11708eb0f8281e6de2c4ea6f04e5d38813e0 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 --- 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 7655e27047790d89f9af0132946ad5db5138e7bf 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 --- 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 d1d661a1858e28befe5980c22009702f5ea82829 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 --- 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 10dba674d366260589f3b742e5b1b87ce9ddd47c 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 --- 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 80e47c92e0b4f506b2b57d0e58022903dc62ba3d 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 --- 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 144273fe9e2280f52f1dba0b5781a54f8b459d1e 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 --- 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 af1d916b86295543b8e20be79abf48453d9c55d0 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 --- 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 a3e74ba189475d606f2a7a07f52591fd312a45c9 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 --- 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 a3ef6e080980e242dd7703c48a628ad821549991 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 --- 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 c5352705d933e76df6d40f01a5e6803bc4106b93 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 --- 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 1d01065f3c88701eeed8018c2125b0170d057b52 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 --- 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 429c7c6760c100685e9800b89fca7f0afd2d8abc 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 --- 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 a943e0ae741115fbdd72b7ecfa7702f90ad0890b Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 5 Oct 2009 11:46:29 +0200 Subject: Fix display of rounded Rectangles with border and odd radius. Due to a rounding issue the sum of the margins was larger than the pixmap size, causing qDrawBorderPixmap to only draw the corners and leaving the sides and center blank. --- src/declarative/fx/qfxrect.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 0648ac4..ea17452 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -427,14 +427,15 @@ void QFxRect::drawRect(QPainter &p) int offset = 0; const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0; + const int realpw = d->pen && d->pen->isValid() ? d->pen->width() : 0; if (d->radius > 0) { generateRoundedRect(); //### implicit conversion to int - offset = int(d->radius+1.5+pw); + offset = int(d->radius+realpw+1); } else { generateBorderedRect(); - offset = pw+1; + offset = realpw+1; } //basically same code as QFxImage uses to paint sci images @@ -457,6 +458,8 @@ void QFxRect::drawRect(QPainter &p) ySide = yOffset * 2; } + Q_ASSERT(d->rectImage.width() >= 2*xOffset + 1); + Q_ASSERT(d->rectImage.height() >= 2*yOffset + 1); QMargins margins(xOffset, yOffset, xOffset, yOffset); QTileRules rules(Qt::StretchTile, Qt::StretchTile); qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules); -- cgit v0.12 From bb0465258d20badae7f9aa62849c02a94244570c Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 5 Oct 2009 19:21:44 +1000 Subject: Consistent Commenting in Samegame --- demos/declarative/samegame/content/samegame.js | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index e42b7cc..cf55b59 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -30,6 +30,7 @@ function initBoard() board[i].destroy(); } + //Calculate board size maxX = Math.floor(gameCanvas.width/tileSize); maxY = Math.floor(gameCanvas.height/tileSize); maxIndex = maxY*maxX; -- cgit v0.12 From 32a9237c49fd126bee0cbe02c3c5bff5145a6e21 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 --- 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 e548c48513546199c848e6cb08a60e8eccdab2c5 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 --- 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 7ec805adeecb8d518c0eb01dad1c04ccea78b340 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 --- 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 b0e6c5ca48c76fb17dca986e9e07adebde390e29 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 --- 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 5286a0211d9c76bf762c8041c1d596d8c9c9c08d 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 --- 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 c1d24c6b87dcc4c6e2f6f258c0198fdb6b2795f0 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 --- 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 2fe4f4a98e1c0b727ee9fa9d168d726a9dcb36d7 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 --- 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 7cb0dea6d991a4d9f4a66b699dc5b353812b168d 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 --- 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 0ed23e95fa756fd851f509a565f91ab43fc30449 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 23 Sep 2009 13:51:17 +0200 Subject: Fix regressions in qeventloop, qtimer, and qsocketnotifier autotests Commit ed375675d4a4f6fd63edeb242e23c87b3de4be6f triggers a behavior in Glib's mainloop implementation where some event sources are not "serviced" every iteration of the mainloop context. This breaks an invariant that many tests relied on, so we need to solve the problem. The invariant is that a newly added timer that would normally fire on the next pass of the event loop (liker a zero timer) SHOULD actually fire. We do this by registering 2 timer event sources with Glib's mainloop: one normal priority source and one idle priority source. The idle priority source is the one that will send events most of the time, with the normal priority one taking over only when processEvents() is called manually. Task-number: QT-877 Reviewed-by: jbache Reviewed-by: thiago Reviewed-by: denis (cherry picked from commit d0d0fdb8e46351b4ab8492de31e5363ef6662b57) --- src/corelib/kernel/qeventdispatcher_glib.cpp | 133 +++++++++++++++++++++------ src/corelib/kernel/qeventdispatcher_glib_p.h | 2 + src/corelib/kernel/qeventdispatcher_unix.cpp | 8 +- 3 files changed, 112 insertions(+), 31 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 6e457f4..665b73e 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -127,16 +127,11 @@ struct GTimerSource GSource source; QTimerInfoList timerList; QEventLoop::ProcessEventsFlags processEventsFlags; + bool runWithIdlePriority; }; -static gboolean timerSourcePrepare(GSource *source, gint *timeout) +static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout) { - gint dummy; - if (!timeout) - timeout = &dummy; - - GTimerSource *src = reinterpret_cast(source); - timeval tv = { 0l, 0l }; if (!(src->processEventsFlags & QEventLoop::X11ExcludeTimers) && src->timerList.timerWait(tv)) *timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); @@ -146,10 +141,8 @@ static gboolean timerSourcePrepare(GSource *source, gint *timeout) return (*timeout == 0); } -static gboolean timerSourceCheck(GSource *source) +static gboolean timerSourceCheckHelper(GTimerSource *src) { - GTimerSource *src = reinterpret_cast(source); - if (src->timerList.isEmpty() || (src->processEventsFlags & QEventLoop::X11ExcludeTimers)) return false; @@ -160,9 +153,35 @@ static gboolean timerSourceCheck(GSource *source) return true; } +static gboolean timerSourcePrepare(GSource *source, gint *timeout) +{ + gint dummy; + if (!timeout) + timeout = &dummy; + + GTimerSource *src = reinterpret_cast(source); + if (src->runWithIdlePriority) { + if (timeout) + *timeout = -1; + return false; + } + + return timerSourcePrepareHelper(src, timeout); +} + +static gboolean timerSourceCheck(GSource *source) +{ + GTimerSource *src = reinterpret_cast(source); + if (src->runWithIdlePriority) + return false; + return timerSourceCheckHelper(src); +} + static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer) { - (void) reinterpret_cast(source)->timerList.activateTimers(); + GTimerSource *timerSource = reinterpret_cast(source); + timerSource->runWithIdlePriority = true; + (void) timerSource->timerList.activateTimers(); return true; // ??? don't remove, right again? } @@ -175,6 +194,53 @@ static GSourceFuncs timerSourceFuncs = { NULL }; +struct GIdleTimerSource +{ + GSource source; + GTimerSource *timerSource; +}; + +static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout) +{ + GIdleTimerSource *idleTimerSource = reinterpret_cast(source); + GTimerSource *timerSource = idleTimerSource->timerSource; + if (!timerSource->runWithIdlePriority) { + // Yield to the normal priority timer source + if (timeout) + *timeout = -1; + return false; + } + + return timerSourcePrepareHelper(timerSource, timeout); +} + +static gboolean idleTimerSourceCheck(GSource *source) +{ + GIdleTimerSource *idleTimerSource = reinterpret_cast(source); + GTimerSource *timerSource = idleTimerSource->timerSource; + if (!timerSource->runWithIdlePriority) { + // Yield to the normal priority timer source + return false; + } + return timerSourceCheckHelper(timerSource); +} + +static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer) +{ + GTimerSource *timerSource = reinterpret_cast(source)->timerSource; + (void) timerSourceDispatch(&timerSource->source, 0, 0); + return true; +} + +static GSourceFuncs idleTimerSourceFuncs = { + idleTimerSourcePrepare, + idleTimerSourceCheck, + idleTimerSourceDispatch, + NULL, + NULL, + NULL +}; + struct GPostEventSource { GSource source; @@ -235,14 +301,15 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) g_main_context_ref(mainContext); } else { QCoreApplication *app = QCoreApplication::instance(); - if (app && QThread::currentThread() == app->thread()) { - mainContext = g_main_context_default(); - g_main_context_ref(mainContext); - } else { - mainContext = g_main_context_new(); - } + if (app && QThread::currentThread() == app->thread()) { + mainContext = g_main_context_default(); + g_main_context_ref(mainContext); + } else { + mainContext = g_main_context_new(); + } } + // setup post event source postEventSource = reinterpret_cast(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); postEventSource->serialNumber = 1; @@ -257,14 +324,21 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) g_source_set_can_recurse(&socketNotifierSource->source, true); g_source_attach(&socketNotifierSource->source, mainContext); - // setup timerSource + // setup normal and idle timer sources timerSource = reinterpret_cast(g_source_new(&timerSourceFuncs, sizeof(GTimerSource))); (void) new (&timerSource->timerList) QTimerInfoList(); timerSource->processEventsFlags = QEventLoop::AllEvents; + timerSource->runWithIdlePriority = false; g_source_set_can_recurse(&timerSource->source, true); - g_source_set_priority(&timerSource->source, G_PRIORITY_DEFAULT_IDLE); g_source_attach(&timerSource->source, mainContext); + + idleTimerSource = reinterpret_cast(g_source_new(&idleTimerSourceFuncs, + sizeof(GIdleTimerSource))); + idleTimerSource->timerSource = timerSource; + g_source_set_can_recurse(&idleTimerSource->source, true); + g_source_set_priority(&idleTimerSource->source, G_PRIORITY_DEFAULT_IDLE); + g_source_attach(&idleTimerSource->source, mainContext); } QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) @@ -272,12 +346,9 @@ QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) { } -QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, - QObject *parent) - : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), - parent) -{ -} +QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, QObject *parent) + : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), parent) +{ } QEventDispatcherGlib::~QEventDispatcherGlib() { @@ -289,6 +360,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib() g_source_destroy(&d->timerSource->source); g_source_unref(&d->timerSource->source); d->timerSource = 0; + g_source_destroy(&d->idleTimerSource->source); + g_source_unref(&d->idleTimerSource->source); + d->idleTimerSource = 0; // destroy socket notifier source for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) { @@ -324,11 +398,16 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) // tell postEventSourcePrepare() and timerSource about any new flags QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags; d->timerSource->processEventsFlags = flags; - + + if (!(flags & QEventLoop::EventLoopExec)) { + // force timers to be sent at normal priority + d->timerSource->runWithIdlePriority = false; + } + bool result = g_main_context_iteration(d->mainContext, canWait); while (!result && canWait) result = g_main_context_iteration(d->mainContext, canWait); - + d->timerSource->processEventsFlags = savedFlags; if (canWait) diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h index 8dbc44d..6a4e726 100644 --- a/src/corelib/kernel/qeventdispatcher_glib_p.h +++ b/src/corelib/kernel/qeventdispatcher_glib_p.h @@ -98,6 +98,7 @@ protected: struct GPostEventSource; struct GSocketNotifierSource; struct GTimerSource; +struct GIdleTimerSource; class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate { @@ -108,6 +109,7 @@ public: GPostEventSource *postEventSource; GSocketNotifierSource *socketNotifierSource; GTimerSource *timerSource; + GIdleTimerSource *idleTimerSource; }; QT_END_NAMESPACE diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index c775c9a..7e1971f 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -423,10 +423,10 @@ bool QTimerInfoList::timerWait(timeval &tm) // Find first waiting timer not already active QTimerInfo *t = 0; for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { - if (!(*it)->inTimerEvent) { - t = *it; - break; - } + if (!(*it)->inTimerEvent) { + t = *it; + break; + } } if (!t) -- cgit v0.12 From 491a9879d349a67dbd5f00f1c0bb189fb92290e3 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. --- 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 b2ea3433f4a42e367fd0708f0198329754903086 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. --- 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 e6ea0500b9618966e265d87fb8ca6cd7832f80e0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 5 Oct 2009 21:44:57 +1000 Subject: Bump version number of 4.5 branch to 4.5.4. Reviewed-by: Trust Me --- dist/changes-4.5.4 | 123 +++++++++++++++++++++ src/corelib/global/qglobal.h | 4 +- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- .../tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/test/assistant.qdocconf | 2 +- tools/qdoc3/test/designer.qdocconf | 2 +- tools/qdoc3/test/linguist.qdocconf | 2 +- tools/qdoc3/test/qmake.qdocconf | 2 +- tools/qdoc3/test/qt-build-docs.qdocconf | 6 +- tools/qdoc3/test/qt.qdocconf | 6 +- 11 files changed, 138 insertions(+), 15 deletions(-) create mode 100644 dist/changes-4.5.4 diff --git a/dist/changes-4.5.4 b/dist/changes-4.5.4 new file mode 100644 index 0000000..abaf4f0 --- /dev/null +++ b/dist/changes-4.5.4 @@ -0,0 +1,123 @@ +Qt 4.5.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.5.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://doc.trolltech.com/4.5 + +The Qt version 4.5 series is binary compatible with the 4.4.x series. +Applications compiled for 4.4 will continue to run with 4.5. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Task Tracker: + + http://www.qtsoftware.com/developer/task-tracker + +Each of these identifiers can be entered in the task tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + +General Improvements +-------------------- + +- Documentation and Examples + +Third party components +---------------------- + + +**************************************************************************** +* Library * +**************************************************************************** + + +**************************************************************************** +* Database Drivers * +**************************************************************************** + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Linux/X11 +---------------- + + +Qt for Windows +-------------- + + +Qt for Mac OS X +--------------- + + +Qt for Embedded Linux +--------------------- + + +Qt for Windows CE +----------------- + + +**************************************************************************** +* Compiler Specific Changes * +**************************************************************************** + + +**************************************************************************** +* Tools * +**************************************************************************** + +- Build System + +- Assistant + + +- Designer + + +- Linguist + - Linguist GUI + + - lupdate + + - lrelease + + +- rcc + + +- moc + + +- uic + + +- uic3 + + +- qmake + + +- configure + + +- qtconfig + + +- qt3to4 + + +**************************************************************************** +* Plugins * +**************************************************************************** + + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5135018..d9c4df6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.5.3" +#define QT_VERSION_STR "4.5.4" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040503 +#define QT_VERSION 0x040504 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 82a1459..5664f81 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.5.3 + VERSION=4.5.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index d04de64..f9c7d31 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.5.3 + VERSION=4.5.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 9566e90..27d56f5 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.5.3
Qt 4.5.4
" diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 0a4cef8..bc1861a 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -17,7 +17,7 @@ qhp.Assistant.namespace = com.trolltech.assistant.453 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Assistant.filterAttributes = qt 4.5.3 tools assistant +qhp.Assistant.filterAttributes = qt 4.5.4 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index acae047..e08bf6c 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -17,7 +17,7 @@ qhp.Designer.namespace = com.trolltech.designer.453 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Designer.filterAttributes = qt 4.5.3 tools designer +qhp.Designer.filterAttributes = qt 4.5.4 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 39d614b..a2e0297 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -17,7 +17,7 @@ qhp.Linguist.namespace = com.trolltech.linguist.453 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Linguist.filterAttributes = qt 4.5.3 tools linguist +qhp.Linguist.filterAttributes = qt 4.5.4 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 91b0b1b..f246694 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -17,7 +17,7 @@ qhp.qmake.namespace = com.trolltech.qmake.453 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.qmake.filterAttributes = qt 4.5.3 tools qmake +qhp.qmake.filterAttributes = qt 4.5.4 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index a8315aa..e9ef849 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.5.3 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.5.3 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.3 +qhp.Qt.filterAttributes = qt 4.5.4 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.5.4 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.4 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index b541db4..1a19fbd 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.5.3 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.5.3 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.3 +qhp.Qt.filterAttributes = qt 4.5.4 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.5.4 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.4 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From 502c7d324141fb48a902ef475b4fd2932dc859c5 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 --- .../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 0ae8f0b63e6705790ad0bdb0f90644b557b5ac67 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 --- 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 e1fbf1e016cbbf203964f3606ee2a34afe33bbd7 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 --- 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 19a6d4245ca152758d8dbc7f7d9ee0f0654c04f7 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 --- 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 b73f1b3d88927b0c51c0624f67695cfd80167d38 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 --- 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 bfe0e5c0d47780542b174dc96973920fba11c451 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 --- 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 6ce698050bbe9a4ec5198f1e08b94d51b8a6c9bd 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 --- 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 30f413b74f883f7e3984dfe39d825aa6c5f16132 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 --- 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 3e574dc0d1b7b2ac351bdf077b86979c85de7972 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 ) --- 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 eda93b795b044542a4247a086e4c2eed454123e4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 15:43:45 +0200 Subject: Test fix on Mac --- 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 c6e0bf67795768954bc2ac129f20dbb7243b2975 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 --- 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 5e1fcb056a42abdfd04d7ca25f55de43dfdcc648 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 16:10:41 +0200 Subject: Fixed indentation. --- 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 4754ebccb9848bff1cb11caab61f58ac2f441b3c Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 16:11:04 +0200 Subject: Added some comments. --- 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 c4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5 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 --- 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 d763b9a56c5f488a6a4187f6aa454405ab75d09b 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 --- 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 1210fa5b2d65895ad2be1f9ca7cae586e3b29dc1 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 --- 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 a1fa0d50f9bebc7148cd21fa3c420d2ff0fe7d12 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 --- 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 06aaf39be5cf341237f0eff85f277625ed732d7a 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 --- 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 fa5f70d3c93758cd8d2c24de73b2d3dc83fb56b8 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. --- 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 c62d9f723347e448033bbb66b281b647166e89f4 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 --- 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 b6313e00291a42e1e888a40b0c589ac5be497707 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 --- 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 509cd7c93248d1e58be4f5dc2368a8707e923329 Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 24 Sep 2009 10:39:10 +0200 Subject: tst_QComboBox::task248169_popupWithMinimalSize() fixed for WinCE Changed the absolute size values for the combobox to desktop dependent sizes. Reviewed-by: Joerg --- tests/auto/qcombobox/tst_qcombobox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index d221077..735433f 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2101,9 +2101,11 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QComboBox comboBox; comboBox.addItems(initialContent); - comboBox.view()->setMinimumWidth(500); QDesktopWidget desktop; - comboBox.setGeometry(desktop.availableGeometry().width() - 200, 100, 200, 100); + QRect desktopSize = desktop.availableGeometry(); + comboBox.view()->setMinimumWidth(desktopSize.width() - 1); + + comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); comboBox.show(); QTest::qWait(100); -- cgit v0.12 From fdc233d73f40489b9084b5acaf3148d2133689ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 28 Sep 2009 15:48:48 +0200 Subject: Fixing the autotest for other platforms, hopefully... Reviewed-by: Joerg Bornemann --- tests/auto/qcombobox/tst_qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 735433f..1b35939 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2103,7 +2103,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.addItems(initialContent); QDesktopWidget desktop; QRect desktopSize = desktop.availableGeometry(); - comboBox.view()->setMinimumWidth(desktopSize.width() - 1); + comboBox.view()->setMinimumWidth(desktopSize.width() / 2); comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); -- cgit v0.12 From f38b88fa3d8ec4448c28044bf95c5c845a80d3f1 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 --- 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 45cd658c7dce650b12e2d0760e852ece1d8812fd 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 --- 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 a3fc0c3b6a45864c845e3a25640b967dd34fa6fc 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. --- 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 8dbbff1dec967d043255e8cea2c4d32be3c1f9cd Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 19:41:06 +0200 Subject: Stabilize test on X11 --- 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 064674426ef0c446561b0c338441bb7d5ca091bf 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 --- 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 2d0c3bd0fac50d4e9f6c2d7d5e9c2fd8eee4d599 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 --- 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 8cac1e7fe5bfda7e876d03d1407f616f89bd74f8 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 --- 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 c7b091351d6fdf5fda5f38a94af24a395252249f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 21:44:05 +0200 Subject: Stabilize tests on X11 --- 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 ba11343826229e983cb1d38811c8363d355e2e01 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 --- 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 0bdb0d61d8eea356b1ac7d09ced6dee26d89ee8d 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 --- .../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 dab7f1079a40a1beb5555c8ffaaf8b2c73781596 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 6 Oct 2009 10:37:49 +1000 Subject: doc fixes --- doc/src/declarative/pics/rect-smooth.png | Bin 0 -> 32162 bytes doc/src/declarative/qmlintro.qdoc | 8 +++++--- doc/src/declarative/qmlreference.qdoc | 7 +++---- src/declarative/fx/qfxrect.cpp | 2 ++ 4 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 doc/src/declarative/pics/rect-smooth.png diff --git a/doc/src/declarative/pics/rect-smooth.png b/doc/src/declarative/pics/rect-smooth.png new file mode 100644 index 0000000..abbb0a9 Binary files /dev/null and b/doc/src/declarative/pics/rect-smooth.png differ diff --git a/doc/src/declarative/qmlintro.qdoc b/doc/src/declarative/qmlintro.qdoc index 3d167ac..e87b7a8 100644 --- a/doc/src/declarative/qmlintro.qdoc +++ b/doc/src/declarative/qmlintro.qdoc @@ -40,8 +40,8 @@ two objects, a \l Rectangle, and an \l Image. Between the braces, we can specify information about the object, such as its properties. Properties are specified as \c {property: value} (much like CSS). In the above -example, we can see the Image has a property named \e source, which has been -assigned the value \e "pics/logo.png". The property and its value are +example, we can see the Image has a property named \c source, which has been +assigned the value \c "pics/logo.png". The property and its value are separated by a colon. Properties can be specified one-per-line: @@ -68,7 +68,9 @@ In addition to assigning values to properties, you can also assign expressions written in JavaScript. \code -Rotation { angle: 360*3 } +Rotation { + angle: 360 * 3 +} \endcode These expressions can include references to other objects and properties, in which case diff --git a/doc/src/declarative/qmlreference.qdoc b/doc/src/declarative/qmlreference.qdoc index 8a50547..bb0d61a 100644 --- a/doc/src/declarative/qmlreference.qdoc +++ b/doc/src/declarative/qmlreference.qdoc @@ -7,8 +7,7 @@ QML is a language for building highly dynamic and fluid applications. It is targetted at the sorts of user interface (and the sorts of hardware) in embedded devices such as phones, media players, and set-top boxes. It is also appropriate for highly custom desktop - user-interfaces, or special elements in more traditional desktop - user-interfaces. + user interfaces, or special elements in more traditional desktop user interfaces. Building fluid applications is done declaratively, rather than procedurally. That is, you specify \e what the UI should look like and how it should behave @@ -18,10 +17,10 @@ Getting Started: \list - \o \l {qmlexamples}{Examples} + \o \l {Introduction to the QML language} (in progress) \o \l {tutorial}{Tutorial: 'Hello World'} \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} - \o \l {Introduction to the QML language} (in progress) + \o \l {qmlexamples}{Examples} \endlist Core Features: diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index ea17452..e802c94 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -482,6 +482,8 @@ void QFxRect::drawRect(QPainter &p) \note Generally scaling artifacts are only visible if the item is stationary on the screen. A common pattern when animating an item is to disable smooth filtering at the beginning of the animation and reenable it at the conclusion. + + \image rect-smooth.png */ QRectF QFxRect::boundingRect() const -- cgit v0.12 From c768694764e8bc32a7152b80653eef564631452a Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 6 Oct 2009 11:41:39 +1000 Subject: Update documentation for setForwardOnly. --- 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 2420c3b6c728ed4c8a8efd4c93427932420c7368 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. --- 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 e220005f1c093520078f3642905b3ddba783a739 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 6 Oct 2009 12:02:25 +1000 Subject: Fix following API changes. --- demos/declarative/contacts/Contact.qml | 4 ++-- examples/declarative/velocity/Day.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/declarative/contacts/Contact.qml b/demos/declarative/contacts/Contact.qml index 91510c7..e12cd3b 100644 --- a/demos/declarative/contacts/Contact.qml +++ b/demos/declarative/contacts/Contact.qml @@ -82,8 +82,8 @@ Item { } Column { id: layout - width: contents.width - height:contents.height + width: childrenRect.width + height: childrenRect.height anchors.centerIn: parent spacing: 5 ContactField { diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 4001a3e..052f690 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -22,7 +22,7 @@ Rectangle { font.bold: true width: 370 text: day - style: Outline + style: "Outline" styleColor: "#dedede" } Repeater { -- cgit v0.12 From e3d88532cbe38ebe4c14105d1a45088d36320b06 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 6 Oct 2009 12:07:18 +1000 Subject: Test basic properties. --- tests/auto/declarative/qfxwebview/data/basic.html | 12 ++++ tests/auto/declarative/qfxwebview/data/basic.qml | 5 ++ .../auto/declarative/qfxwebview/data/creation.qml | 3 - .../auto/declarative/qfxwebview/tst_qfxwebview.cpp | 67 +++++++++++++++++----- 4 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 tests/auto/declarative/qfxwebview/data/basic.html create mode 100644 tests/auto/declarative/qfxwebview/data/basic.qml delete mode 100644 tests/auto/declarative/qfxwebview/data/creation.qml diff --git a/tests/auto/declarative/qfxwebview/data/basic.html b/tests/auto/declarative/qfxwebview/data/basic.html new file mode 100644 index 0000000..254317c --- /dev/null +++ b/tests/auto/declarative/qfxwebview/data/basic.html @@ -0,0 +1,12 @@ + +Basic + + + + + + + +
This is a basic test.
+ + diff --git a/tests/auto/declarative/qfxwebview/data/basic.qml b/tests/auto/declarative/qfxwebview/data/basic.qml new file mode 100644 index 0000000..5394837 --- /dev/null +++ b/tests/auto/declarative/qfxwebview/data/basic.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +WebView { + url: "basic.html" +} diff --git a/tests/auto/declarative/qfxwebview/data/creation.qml b/tests/auto/declarative/qfxwebview/data/creation.qml deleted file mode 100644 index bb49143..0000000 --- a/tests/auto/declarative/qfxwebview/data/creation.qml +++ /dev/null @@ -1,3 +0,0 @@ -import Qt 4.6 - -WebView { } diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp index 974a4b7..f63ac11 100644 --- a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp +++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include class tst_qfxwebview : public QObject { @@ -13,14 +15,37 @@ public: tst_qfxwebview() {} private slots: - void testQmlFiles_data(); - void testQmlFiles(); + void testBasicProperties(); + void cleanupTestCase(); + private: void checkNoErrors(const QmlComponent& component); QmlEngine engine; + QString tmpDir() const + { + static QString tmpd = QDir::tempPath()+"/tst_sql_output-" + + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); + return tmpd; + } }; +void removeRecursive(const QString& dirname) +{ + QDir dir(dirname); + QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); + for (int i = 0; i < entries.count(); ++i) + if (entries[i].isDir()) + removeRecursive(entries[i].filePath()); + else + dir.remove(entries[i].fileName()); + QDir().rmdir(dirname); +} + +void tst_qfxwebview::cleanupTestCase() +{ + removeRecursive(tmpDir()); +} void tst_qfxwebview::checkNoErrors(const QmlComponent& component) { @@ -37,21 +62,37 @@ void tst_qfxwebview::checkNoErrors(const QmlComponent& component) QVERIFY(!component.isError()); } -void tst_qfxwebview::testQmlFiles_data() +void tst_qfxwebview::testBasicProperties() { - QTest::addColumn("qmlfile"); // The input file - - QTest::newRow("creation") << QUrl::fromLocalFile(SRCDIR "/data/creation.qml"); -} - -void tst_qfxwebview::testQmlFiles() -{ - QFETCH(QUrl, qmlfile); - - QmlComponent component(&engine, qmlfile); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); checkNoErrors(component); + QWebSettings::enablePersistentStorage(tmpDir()); + QFxWebView *wv = qobject_cast(component.create()); QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->title(),QString("Basic")); + wv->icon().save("test.png"); + //QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.ico")); + QCOMPARE(wv->statusText(),QString("")); + QFile htmlfile(SRCDIR "/data/basic.html"); + QVERIFY(htmlfile.open(QIODevice::ReadOnly)); + QString actualhtml____ = wv->html(); // "____" is to make errors line up for easier reading + QString expectedhtml = htmlfile.readAll(); + actualhtml____.replace(QRegExp("\\s+"),""); + expectedhtml.replace(QRegExp("\\s+"),""); + QCOMPARE(actualhtml____,expectedhtml); // same, ignoring whitespace + QCOMPARE(wv->width(), 123.0); + QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); + QCOMPARE(wv->status(), QFxWebView::Ready); + QVERIFY(wv->reloadAction()); + QVERIFY(wv->reloadAction()->isEnabled()); + QVERIFY(wv->backAction()); + QVERIFY(!wv->backAction()->isEnabled()); + QVERIFY(wv->forwardAction()); + QVERIFY(!wv->forwardAction()->isEnabled()); + QVERIFY(wv->stopAction()); + QVERIFY(!wv->stopAction()->isEnabled()); } QTEST_MAIN(tst_qfxwebview) -- cgit v0.12 From 8ca8d4b8b234d6d57e9f963d3c1e7f7522bcaf98 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 6 Oct 2009 12:09:22 +1000 Subject: typo --- tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp index f63ac11..834c07f 100644 --- a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp +++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp @@ -24,7 +24,7 @@ private: QmlEngine engine; QString tmpDir() const { - static QString tmpd = QDir::tempPath()+"/tst_sql_output-" + static QString tmpd = QDir::tempPath()+"/tst_qfxwebview-" + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); return tmpd; } -- cgit v0.12 From 47db21ecd772a980e0a4a5f91c63cdffafdff8c0 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 6 Oct 2009 12:16:48 +1000 Subject: Use QDesktopServices::storageLocation() in place of placeform-specific code. --- src/declarative/qml/qmlengine.cpp | 42 ++++------------------------------ tests/auto/declarative/sql/tst_sql.cpp | 27 ++++++++++++++++------ 2 files changed, 24 insertions(+), 45 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 72603ed..f34d790 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -114,43 +114,9 @@ QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) return e->newVariant(QVariant(ret)); } -// XXX Something like this should be exported by Qt. static QString userLocalDataPath(const QString& app) { - QString result; - -#ifdef Q_OS_WIN -#ifndef Q_OS_WINCE - QLibrary library(QLatin1String("shell32")); -#else - QLibrary library(QLatin1String("coredll")); -#endif // Q_OS_WINCE - typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); - GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); - if (SHGetSpecialFolderPath) { - wchar_t path[MAX_PATH]; - SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE); - result = QString::fromWCharArray(path); - } -#endif // Q_OS_WIN - -#ifdef Q_OS_MAC - result = QLatin1String(qgetenv("HOME")); - result += "/Library/Application Support"; -#else - if (result.isEmpty()) { - // Fallback: UNIX style - result = QLatin1String(qgetenv("XDG_DATA_HOME")); - if (result.isEmpty()) { - result = QLatin1String(qgetenv("HOME")); - result += QLatin1String("/.local/share"); - } - } -#endif - - result += QLatin1Char('/'); - result += app; - return result; + return QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/") + app; } QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) @@ -166,7 +132,7 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) qtObject.setProperty(QLatin1String("DesktopServices"), desktopObject); scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject); - offlineStoragePath = userLocalDataPath(QLatin1String("Nokia/Qt/QML/OfflineStorage")); + offlineStoragePath = userLocalDataPath(QLatin1String("QML/OfflineStorage")); qt_add_qmlxmlhttprequest(&scriptEngine); qt_add_qmlsqldatabase(&scriptEngine); @@ -1602,7 +1568,7 @@ public: if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return)) return true; if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) { - *url_return = QUrl(s->urls[0]+"/").resolved(QUrl(QLatin1String(unqualifiedtype + ".qml"))); + *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QLatin1String(unqualifiedtype + ".qml"))); return true; } } @@ -1697,7 +1663,7 @@ void QmlEngine::addImportPath(const QString& path) QFxWebView and the SQL databases created with openDatabase() are stored here. - The default is Nokia/Qt/QML/Databases/ in the platform-standard + The default is QML/OfflineStorage/ in the platform-standard user application data directory. */ void QmlEngine::setOfflineStoragePath(const QString& dir) diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 10ce6d8..22e9ba4 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -14,7 +14,18 @@ class tst_sql : public QObject { Q_OBJECT public: - tst_sql() {} + tst_sql() + { + qApp->setApplicationName("tst_sql"); + qApp->setOrganizationName("Nokia"); + qApp->setOrganizationDomain("nokia.com"); + engine = new QmlEngine; + } + + ~tst_sql() + { + delete engine; + } private slots: void initTestCase(); @@ -31,7 +42,7 @@ private slots: private: QString dbDir() const; - QmlEngine engine; + QmlEngine *engine; }; class QWebPageWithJavaScriptConsoleMessages : public QWebPage { @@ -67,14 +78,16 @@ void tst_sql::cleanupTestCase() QString tst_sql::dbDir() const { - return QString(SRCDIR)+"/output"; + static QString tmpd = QDir::tempPath()+"/tst_sql_output-" + + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); + return tmpd; } void tst_sql::checkDatabasePath() { // Check default storage path (we can't use it since we don't want to mess with user's data) - QVERIFY(engine.offlineStoragePath().contains("Nokia")); - QVERIFY(engine.offlineStoragePath().contains("OfflineStorage")); + QVERIFY(engine->offlineStoragePath().contains("Nokia")); + QVERIFY(engine->offlineStoragePath().contains("OfflineStorage")); } void tst_sql::testQml_data() @@ -142,8 +155,8 @@ void tst_sql::testQml() "import Qt 4.6\n" "Text { Script { source: \""+jsfile+"\" } text: test() }"; - engine.setOfflineStoragePath(dbDir()); - QmlComponent component(&engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports + engine->setOfflineStoragePath(dbDir()); + QmlComponent component(engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports QFxText *text = qobject_cast(component.create()); QVERIFY(text != 0); QCOMPARE(text->text(),result); -- cgit v0.12 From c3abf1a4ae82a57bbc6cc324fa6f9a99615ab066 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 6 Oct 2009 12:28:42 +1000 Subject: lowercase ids --- demos/declarative/calculator/CalcButton.qml | 32 +++--- demos/declarative/calculator/calculator.js | 58 +++++----- demos/declarative/calculator/calculator.qml | 59 +++++----- demos/declarative/flickr/common/ImageDetails.qml | 120 ++++++++++---------- demos/declarative/flickr/common/LikeOMeter.qml | 22 ++-- demos/declarative/flickr/common/Loading.qml | 4 +- demos/declarative/flickr/common/MediaButton.qml | 22 ++-- demos/declarative/flickr/common/MediaLineEdit.qml | 62 +++++----- demos/declarative/flickr/common/Progress.qml | 5 +- demos/declarative/flickr/common/ScrollBar.qml | 10 +- demos/declarative/flickr/common/Slider.qml | 16 +-- demos/declarative/flickr/common/Star.qml | 13 +-- demos/declarative/flickr/flickr-desktop.qml | 132 +++++++++++----------- demos/declarative/flickr/flickr-mobile.qml | 56 ++++----- demos/declarative/flickr/mobile/Button.qml | 27 ++--- demos/declarative/flickr/mobile/GridDelegate.qml | 52 ++++----- demos/declarative/flickr/mobile/ImageDetails.qml | 74 ++++++------ demos/declarative/flickr/mobile/ListDelegate.qml | 13 +-- demos/declarative/flickr/mobile/TitleBar.qml | 38 +++---- demos/declarative/flickr/mobile/ToolBar.qml | 14 +-- 20 files changed, 409 insertions(+), 420 deletions(-) diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml index 55b5f0c..c2e3a81 100644 --- a/demos/declarative/calculator/CalcButton.qml +++ b/demos/declarative/calculator/CalcButton.qml @@ -1,41 +1,41 @@ import Qt 4.6 Rectangle { - property alias operation: Label.text + property alias operation: label.text property bool toggable: false property bool toggled: false signal clicked - id: Button; width: 50; height: 30 - border.color: Palette.mid; radius: 6 + id: button; width: 50; height: 30 + border.color: palette.mid; radius: 6 gradient: Gradient { - GradientStop { id: G1; position: 0.0; color: Palette.lighter(Palette.button) } - GradientStop { id: G2; position: 1.0; color: Palette.button } + GradientStop { id: G1; position: 0.0; color: palette.lighter(palette.button) } + GradientStop { id: G2; position: 1.0; color: palette.button } } - Text { id: Label; anchors.centerIn: parent; color: Palette.buttonText } + Text { id: label; anchors.centerIn: parent; color: palette.buttonText } MouseRegion { - id: ClickRegion + id: clickRegion anchors.fill: parent onClicked: { doOp(operation); - Button.clicked(); - if (!Button.toggable) return; - Button.toggled ? Button.toggled = false : Button.toggled = true + button.clicked(); + if (!button.toggable) return; + button.toggled ? button.toggled = false : button.toggled = true } } states: [ State { - name: "Pressed"; when: ClickRegion.pressed == true - PropertyChanges { target: G1; color: Palette.dark } - PropertyChanges { target: G2; color: Palette.button } + name: "Pressed"; when: clickRegion.pressed == true + PropertyChanges { target: G1; color: palette.dark } + PropertyChanges { target: G2; color: palette.button } }, State { - name: "Toggled"; when: Button.toggled == true - PropertyChanges { target: G1; color: Palette.dark } - PropertyChanges { target: G2; color: Palette.button } + name: "Toggled"; when: button.toggled == true + PropertyChanges { target: G1; color: palette.dark } + PropertyChanges { target: G2; color: palette.button } } ] } diff --git a/demos/declarative/calculator/calculator.js b/demos/declarative/calculator/calculator.js index 774b232..cd6490a 100644 --- a/demos/declarative/calculator/calculator.js +++ b/demos/declarative/calculator/calculator.js @@ -5,9 +5,9 @@ var lastOp = ""; var timer = 0; function disabled(op) { - if (op == "." && CurNum.text.toString().search(/\./) != -1) { + if (op == "." && curNum.text.toString().search(/\./) != -1) { return true; - } else if (op == "Sqrt" && CurNum.text.toString().search(/-/) != -1) { + } else if (op == "Sqrt" && curNum.text.toString().search(/-/) != -1) { return true; } else { return false; @@ -20,12 +20,12 @@ function doOp(op) { } if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { - if (CurNum.text.toString().length >= 14) + if (curNum.text.toString().length >= 14) return; // No arbitrary length numbers if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp==".") ) { - CurNum.text = CurNum.text + op.toString(); + curNum.text = curNum.text + op.toString(); } else { - CurNum.text = op; + curNum.text = op; } lastOp = op; return; @@ -33,55 +33,55 @@ function doOp(op) { lastOp = op; // Pending operations - if (CurrentOperation.text == "+") { - CurNum.text = Number(CurNum.text.valueOf()) + Number(curVal.valueOf()); - } else if (CurrentOperation.text == "-") { - CurNum.text = Number(curVal) - Number(CurNum.text.valueOf()); - } else if (CurrentOperation.text == "x") { - CurNum.text = Number(curVal) * Number(CurNum.text.valueOf()); - } else if (CurrentOperation.text == "/") { - CurNum.text = Number(Number(curVal) / Number(CurNum.text.valueOf())).toString(); - } else if (CurrentOperation.text == "=") { + if (currentOperation.text == "+") { + curNum.text = Number(curNum.text.valueOf()) + Number(curVal.valueOf()); + } else if (currentOperation.text == "-") { + curNum.text = Number(curVal) - Number(curNum.text.valueOf()); + } else if (currentOperation.text == "x") { + curNum.text = Number(curVal) * Number(curNum.text.valueOf()); + } else if (currentOperation.text == "/") { + curNum.text = Number(Number(curVal) / Number(curNum.text.valueOf())).toString(); + } else if (currentOperation.text == "=") { } if (op == "+" || op == "-" || op == "x" || op == "/") { - CurrentOperation.text = op; - curVal = CurNum.text.valueOf(); + currentOperation.text = op; + curVal = curNum.text.valueOf(); return; } curVal = 0; - CurrentOperation.text = ""; + currentOperation.text = ""; // Immediate operations if (op == "1/x") { // reciprocal - CurNum.text = (1 / CurNum.text.valueOf()).toString(); + curNum.text = (1 / curNum.text.valueOf()).toString(); } else if (op == "^2") { // squared - CurNum.text = (CurNum.text.valueOf() * CurNum.text.valueOf()).toString(); + curNum.text = (curNum.text.valueOf() * curNum.text.valueOf()).toString(); } else if (op == "Abs") { - CurNum.text = (Math.abs(CurNum.text.valueOf())).toString(); + curNum.text = (Math.abs(curNum.text.valueOf())).toString(); } else if (op == "Int") { - CurNum.text = (Math.floor(CurNum.text.valueOf())).toString(); + curNum.text = (Math.floor(curNum.text.valueOf())).toString(); } else if (op == "+/-") { // plus/minus - CurNum.text = (CurNum.text.valueOf() * -1).toString(); + curNum.text = (curNum.text.valueOf() * -1).toString(); } else if (op == "Sqrt") { // square root - CurNum.text = (Math.sqrt(CurNum.text.valueOf())).toString(); + curNum.text = (Math.sqrt(curNum.text.valueOf())).toString(); } else if (op == "MC") { // memory clear memory = 0; } else if (op == "M+") { // memory increment - memory += CurNum.text.valueOf(); + memory += curNum.text.valueOf(); } else if (op == "MR") { // memory recall - CurNum.text = memory.toString(); + curNum.text = memory.toString(); } else if (op == "MS") { // memory set - memory = CurNum.text.valueOf(); + memory = curNum.text.valueOf(); } else if (op == "Bksp") { - CurNum.text = CurNum.text.toString().slice(0, -1); + curNum.text = curNum.text.toString().slice(0, -1); } else if (op == "C") { - CurNum.text = "0"; + curNum.text = "0"; } else if (op == "AC") { curVal = 0; memory = 0; lastOp = ""; - CurNum.text ="0"; + curNum.text ="0"; } } diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index d93f04a..8041025 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -1,36 +1,35 @@ import Qt 4.6 Rectangle { - id: MainWindow; - width: 320; height: 270; color: Palette.window + width: 320; height: 270; color: palette.window - SystemPalette { id: Palette; colorGroup: Qt.Active } + SystemPalette { id: palette; colorGroup: Qt.Active } Script { source: "calculator.js" } Column { x: 2; spacing: 10; Rectangle { - id: Container + id: container width: 316; height: 50 - border.color: Palette.dark; color: Palette.base + border.color: palette.dark; color: palette.base Text { - id: CurNum + id: curNum font.bold: true; font.pointSize: 16 - color: Palette.text - anchors.right: Container.right + color: palette.text + anchors.right: container.right anchors.rightMargin: 5 - anchors.verticalCenter: Container.verticalCenter + anchors.verticalCenter: container.verticalCenter } Text { - id: CurrentOperation - color: Palette.text + id: currentOperation + color: palette.text font.bold: true; font.pointSize: 16 - anchors.left: Container.left + anchors.left: container.left anchors.leftMargin: 5 - anchors.verticalCenter: Container.verticalCenter + anchors.verticalCenter: container.verticalCenter } } @@ -38,7 +37,7 @@ Rectangle { width: 320; height: 30 CalcButton { - id: AdvancedCheckBox + id: advancedCheckBox x: 55; width: 206 operation: "Advanced Mode" toggable: true @@ -49,15 +48,15 @@ Rectangle { width: 320 Item { - id: BasicButtons + id: basicButtons x: 55; width: 160; height: 160 - CalcButton { operation: "Bksp"; id: Bksp; width: 67; opacity: 0 } - CalcButton { operation: "C"; id: C; width: 76 } - CalcButton { operation: "AC"; id: AC; x: 78; width: 76 } + CalcButton { operation: "Bksp"; id: bksp; width: 67; opacity: 0 } + CalcButton { operation: "C"; id: c; width: 76 } + CalcButton { operation: "AC"; id: ac; x: 78; width: 76 } Grid { - id: NumKeypad; y: 32; spacing: 2; columns: 3 + id: numKeypad; y: 32; spacing: 2; columns: 3 CalcButton { operation: "7" } CalcButton { operation: "8" } @@ -75,11 +74,11 @@ Rectangle { CalcButton { operation: "0"; width: 50 } CalcButton { operation: "."; x: 77; width: 50 } - CalcButton { operation: "="; id: Equals; x: 77; width: 102 } + CalcButton { operation: "="; id: equals; x: 77; width: 102 } } Column { - id: SimpleOperations + id: simpleOperations x: 156; y: 0; spacing: 2 CalcButton { operation: "x" } @@ -90,7 +89,7 @@ Rectangle { } Grid { - id: AdvancedButtons + id: advancedButtons x: 350; spacing: 2; columns: 2; opacity: 0 CalcButton { operation: "Abs" } @@ -109,14 +108,14 @@ Rectangle { states: [ State { - name: "Advanced"; when: AdvancedCheckBox.toggled == true - PropertyChanges { target: BasicButtons; x: 0 } - PropertyChanges { target: SimpleOperations; y: 32 } - PropertyChanges { target: Bksp; opacity: 1 } - PropertyChanges { target: C; x: 69; width: 67 } - PropertyChanges { target: AC; x: 138; width: 67 } - PropertyChanges { target: Equals; width: 50 } - PropertyChanges { target: AdvancedButtons; x: 210; opacity: 1 } + name: "Advanced"; when: advancedCheckBox.toggled == true + PropertyChanges { target: basicButtons; x: 0 } + PropertyChanges { target: simpleOperations; y: 32 } + PropertyChanges { target: bksp; opacity: 1 } + PropertyChanges { target: c; x: 69; width: 67 } + PropertyChanges { target: ac; x: 138; width: 67 } + PropertyChanges { target: equals; width: 50 } + PropertyChanges { target: advancedButtons; x: 210; opacity: 1 } } ] diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 6b42910..b8b7d29 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -1,9 +1,9 @@ import Qt 4.6 Flipable { - id: Container + id: container - property var frontContainer: ContainerFront + property var frontContainer: containerFront property string photoTitle: "" property string photoDescription: "" property string photoTags: "" @@ -19,13 +19,13 @@ Flipable { signal closed transform: Rotation { - id: DetailsRotation - origin.x: Container.width / 2; + id: detailsRotation + origin.x: container.width / 2; axis.y: 1; axis.z: 0 } front: Item { - id: ContainerFront; anchors.fill: Container + id: containerFront; anchors.fill: container Rectangle { anchors.fill: parent @@ -34,74 +34,74 @@ Flipable { } MediaButton { - id: BackButton; x: 630; y: 370; text: "Back" - onClicked: { Container.closed() } + id: backButton; x: 630; y: 370; text: "Back" + onClicked: { container.closed() } } MediaButton { - id: MoreButton; x: 530; y: 370; text: "View..." - onClicked: { Container.state='Back' } + id: moreButton; x: 530; y: 370; text: "View..." + onClicked: { container.state='Back' } } - Text { id: TitleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight" - x: 220; y: 30; width: parent.width - 240; text: Container.photoTitle; font.pointSize: 22 } + Text { id: titleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight" + x: 220; y: 30; width: parent.width - 240; text: container.photoTitle; font.pointSize: 22 } - LikeOMeter { x: 40; y: 250; rating: Container.rating } + LikeOMeter { x: 40; y: 250; rating: container.rating } - Flickable { id: FlickSurface; x: 220; width: 480; height: 210; y: 130; clip: true - viewportWidth: 480; viewportHeight: DescriptionText.height + Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true + viewportWidth: 480; viewportHeight: descriptionText.height - WebView { id: DescriptionText; width: parent.width - html: "" + Container.photoDescription } + WebView { id: descriptionText; width: parent.width + html: "" + container.photoDescription } } - Text { id: Size; color: "white"; width: 300; x: 40; y: 300 - text: "Size: " + Container.photoWidth + 'x' + Container.photoHeight } - Text { id: Type; color: "white"; width: 300; x: 40; anchors.top: Size.bottom - text: "Type: " + Container.photoType } - - Text { id: Author; color: "white"; width: 300; x: 220; y: 80 - text: "Author: " + Container.photoAuthor } - Text { id: Date; color: "white"; width: 300; x: 220; anchors.top: Author.bottom - text: "Published: " + Container.photoDate } - Text { id: TagsLabel; color: "white"; x: 220; anchors.top: Date.bottom; - text: Container.photoTags == "" ? "" : "Tags: " } - Text { id: Tags; color: "white"; width: parent.width-x-20; - anchors.left: TagsLabel.right; anchors.top: Date.bottom; - elide: "ElideRight"; text: Container.photoTags } - - ScrollBar { id: ScrollBar; x: 720; y: FlickSurface.y; width: 7; height: FlickSurface.height; opacity: 0; - flickableArea: FlickSurface; clip: true } + Text { id: size; color: "white"; width: 300; x: 40; y: 300 + text: "Size: " + container.photoWidth + 'x' + container.photoHeight } + Text { id: type; color: "white"; width: 300; x: 40; anchors.top: size.bottom + text: "Type: " + container.photoType } + + Text { id: author; color: "white"; width: 300; x: 220; y: 80 + text: "Author: " + container.photoAuthor } + Text { id: date; color: "white"; width: 300; x: 220; anchors.top: author.bottom + text: "Published: " + container.photoDate } + Text { id: tagsLabel; color: "white"; x: 220; anchors.top: date.bottom; + text: container.photoTags == "" ? "" : "Tags: " } + Text { id: tags; color: "white"; width: parent.width-x-20; + anchors.left: tagsLabel.right; anchors.top: date.bottom; + elide: "ElideRight"; text: container.photoTags } + + ScrollBar { id: scrollBar; x: 720; y: flickable.y; width: 7; height: flickable.height; opacity: 0; + flickableArea: flickable; clip: true } } back: Item { - anchors.fill: Container + anchors.fill: container Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4; border.color: "white"; border.width: 2 } - Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 } + Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } Flickable { - id: Flick; width: Container.width - 10; height: Container.height - 10 + id: flick; width: container.width - 10; height: container.height - 10 x: 5; y: 5; clip: true; - viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height + viewportWidth: imageContainer.width; viewportHeight: imageContainer.height Item { - id: ImageContainer - width: Math.max(BigImage.width * BigImage.scale, Flick.width); - height: Math.max(BigImage.height * BigImage.scale, Flick.height); + id: imageContainer + width: Math.max(bigImage.width * bigImage.scale, flick.width); + height: Math.max(bigImage.height * bigImage.scale, flick.height); Image { - id: BigImage; source: Container.photoUrl; scale: Slider.value + id: bigImage; source: container.photoUrl; scale: slider.value // Center image if it is smaller than the flickable area. - x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0 - y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0 - smooth: !Flick.moving + x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 + y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + smooth: !flick.moving onStatusChanged : { // Default scale shows the entire image. if (status == 1 && width != 0) { - Slider.minimum = Math.min(Flick.width / width, Flick.height / height); - prevScale = Math.min(Slider.minimum, 1); - Slider.value = prevScale; + slider.minimum = Math.min(flick.width / width, flick.height / height); + prevScale = Math.min(slider.minimum, 1); + slider.value = prevScale; } } } @@ -109,24 +109,24 @@ Flipable { } MediaButton { - id: BackButton2; x: 630; y: 370; text: "Back"; onClicked: { Container.state = '' } + id: backButton2; x: 630; y: 370; text: "Back"; onClicked: { container.state = '' } } Text { text: "Image Unavailable" - visible: BigImage.status == 'Error' + visible: bigImage.status == 'Error' anchors.centerIn: parent; color: "white"; font.bold: true } Slider { - id: Slider; x: 25; y: 374; visible: { BigImage.status == 1 && maximum > minimum } + id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } onValueChanged: { - if (BigImage.width * value > Flick.width) { - var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale; - Flick.viewportX = xoff - Flick.width/2; + if (bigImage.width * value > flick.width) { + var xoff = (flick.width/2 + flick.viewportX) * value / prevScale; + flick.viewportX = xoff - flick.width/2; } - if (BigImage.height * value > Flick.height) { - var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale; - Flick.viewportY = yoff - Flick.height/2; + if (bigImage.height * value > flick.height) { + var yoff = (flick.height/2 + flick.viewportY) * value / prevScale; + flick.viewportY = yoff - flick.height/2; } prevScale = value; } @@ -136,7 +136,7 @@ Flipable { states: [ State { name: "Back" - PropertyChanges { target: DetailsRotation; angle: 180 } + PropertyChanges { target: detailsRotation; angle: 180 } } ] @@ -144,15 +144,15 @@ Flipable { Transition { SequentialAnimation { PropertyAction { - target: BigImage + target: bigImage property: "smooth" value: false } NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } PropertyAction { - target: BigImage + target: bigImage property: "smooth" - value: !Flick.moving + value: !flick.moving } } } diff --git a/demos/declarative/flickr/common/LikeOMeter.qml b/demos/declarative/flickr/common/LikeOMeter.qml index 754dbb1..5ee048b 100644 --- a/demos/declarative/flickr/common/LikeOMeter.qml +++ b/demos/declarative/flickr/common/LikeOMeter.qml @@ -1,35 +1,35 @@ import Qt 4.6 Item { - id: Container + id: container property int rating: 2 Row { Star { rating: 0 - onClicked: { Container.rating = rating } - on: Container.rating >= 0 + onClicked: { container.rating = rating } + on: container.rating >= 0 } Star { rating: 1 - onClicked: { Container.rating = rating } - on: Container.rating >= 1 + onClicked: { container.rating = rating } + on: container.rating >= 1 } Star { rating: 2 - onClicked: { Container.rating = rating } - on: Container.rating >= 2 + onClicked: { container.rating = rating } + on: container.rating >= 2 } Star { rating: 3 - onClicked: { Container.rating = rating } - on: Container.rating >= 3 + onClicked: { container.rating = rating } + on: container.rating >= 3 } Star { rating: 4 - onClicked: { Container.rating = rating } - on: Container.rating >= 4 + onClicked: { container.rating = rating } + on: container.rating >= 4 } } } diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index ff2c829..64a04c4 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -1,8 +1,8 @@ import Qt 4.6 Image { - id: Loading; source: "pics/loading.png"; transformOrigin: "Center" + id: loading; source: "pics/loading.png"; transformOrigin: "Center" rotation: NumberAnimation { - id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900 + id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml index e1e09e8..c12b642 100644 --- a/demos/declarative/flickr/common/MediaButton.qml +++ b/demos/declarative/flickr/common/MediaButton.qml @@ -1,39 +1,39 @@ import Qt 4.6 Item { - id: Container + id: container signal clicked property string text Image { - id: ButtonImage + id: buttonImage source: "pics/button.png" } Image { - id: Pressed + id: pressed source: "pics/button-pressed.png" opacity: 0 } MouseRegion { - id: MyMouseRegion - anchors.fill: ButtonImage - onClicked: { Container.clicked(); } + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } } Text { font.bold: true color: "white" - anchors.centerIn: ButtonImage - text: Container.text + anchors.centerIn: buttonImage + text: container.text } - width: ButtonImage.width + width: buttonImage.width states: [ State { name: "Pressed" - when: MyMouseRegion.pressed == true + when: mouseRegion.pressed == true PropertyChanges { - target: Pressed + target: pressed opacity: 1 } } diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index 7599ce6a05..4b21f66 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -1,42 +1,42 @@ import Qt 4.6 Item { - id: Container + id: container property string label property string text - width: Math.max(94,Label.width + Editor.width + 20) - height: ButtonImage.height + width: Math.max(94,label.width + editor.width + 20) + height: buttonImage.height states: [ State { name: "Edit" PropertyChanges { - target: Label - text: Container.label + ": " + target: label + text: container.label + ": " } PropertyChanges { - target: Label + target: label x: 10 } PropertyChanges { - target: Editor + target: editor cursorVisible: true width: 100 } PropertyChanges { - target: Container + target: container focus: true } StateChangeScript { - script:"Editor.selectAll()" + script:"editor.selectAll()" } }, State { // When returning to default state, typed text is propagated StateChangeScript { - script: "Container.text = Editor.text" + script: "container.text = editor.text" } } ] @@ -48,29 +48,29 @@ Item { BorderImage { - id: ButtonImage + id: buttonImage source: "pics/button.sci" - anchors.left: Container.left - anchors.right: Container.right + anchors.left: container.left + anchors.right: container.right } BorderImage { - id: Pressed + id: pressed source: "pics/button-pressed.sci" opacity: 0 - anchors.left: Container.left - anchors.right: Container.right + anchors.left: container.left + anchors.right: container.right } MouseRegion { - id: MyMouseRegion - anchors.fill: ButtonImage - onClicked: { Container.state = Container.state=="Edit" ? "" : "Edit" } + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.state = container.state=="Edit" ? "" : "Edit" } states: [ State { - when: MyMouseRegion.pressed == true + when: mouseRegion.pressed == true PropertyChanges { - target: Pressed + target: pressed opacity: 1 } } @@ -78,27 +78,27 @@ Item { } Text { - id: Label + id: label font.bold: true color: "white" - anchors.verticalCenter: Container.verticalCenter - x: (Container.width - width)/2 - text: Container.label + "..." + anchors.verticalCenter: container.verticalCenter + x: (container.width - width)/2 + text: container.label + "..." } TextInput { - id: Editor + id: editor font.bold: true color: "white" selectionColor: "green" width: 0 clip: true - anchors.left: Label.right - anchors.verticalCenter: Container.verticalCenter + anchors.left: label.right + anchors.verticalCenter: container.verticalCenter } - Keys.forwardTo: [(ReturnKey), (Editor)] + Keys.forwardTo: [(returnKey), (editor)] Item { - id: ReturnKey - Keys.onReturnPressed: "Container.state = ''" + id: returnKey + Keys.onReturnPressed: "container.state = ''" } } diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 00ef901..fd9be10 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -1,12 +1,10 @@ import Qt 4.6 Item { - id: Progress; - property var progress: 0 Rectangle { - id: Container; anchors.fill: parent; smooth: true + anchors.fill: parent; smooth: true border.color: "white"; border.width: 0; radius: height/2 - 2 gradient: Gradient { GradientStop { position: 0; color: "#66343434" } @@ -15,7 +13,6 @@ Item { } Rectangle { - id: Fill y: 2; height: parent.height-4; x: 2; width: Math.max(parent.width * progress - 4, 0); opacity: width < 1 ? 0 : 1; smooth: true diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index d31c57c..feebcb0 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: Container + id: container property var flickableArea @@ -12,16 +12,16 @@ Item { border.color: "white" border.width: 2 x: 0 - y: flickableArea.visibleArea.yPosition * Container.height + y: flickableArea.visibleArea.yPosition * container.height width: parent.width - height: flickableArea.visibleArea.heightRatio * Container.height + height: flickableArea.visibleArea.heightRatio * container.height } states: [ State { name: "show" when: flickableArea.moving PropertyChanges { - target: Container + target: container opacity: 1 } } @@ -31,7 +31,7 @@ Item { from: "*" to: "*" NumberAnimation { - target: Container + target: container properties: "opacity" duration: 400 } diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml index b88636d..fa1645c 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/common/Slider.qml @@ -1,17 +1,17 @@ import Qt 4.6 Item { - id: Slider; width: 400; height: 16 + id: slider; width: 400; height: 16 // value is read/write. property real value - onValueChanged: { Handle.x = 2 + (value - minimum) * Slider.xMax / (maximum - minimum); } + onValueChanged: { handle.x = 2 + (value - minimum) * slider.xMax / (maximum - minimum); } property real maximum: 1 property real minimum: 1 - property int xMax: Slider.width - Handle.width - 4 + property int xMax: slider.width - handle.width - 4 Rectangle { - id: Container; anchors.fill: parent + anchors.fill: parent border.color: "white"; border.width: 0; radius: 8 gradient: Gradient { GradientStop { position: 0.0; color: "#66343434" } @@ -20,8 +20,8 @@ Item { } Rectangle { - id: Handle; smooth: true - x: Slider.width / 2 - Handle.width / 2; y: 2; width: 30; height: Slider.height-4; radius: 6 + id: handle; smooth: true + x: slider.width / 2 - handle.width / 2; y: 2; width: 30; height: slider.height-4; radius: 6 gradient: Gradient { GradientStop { position: 0.0; color: "lightgray" } GradientStop { position: 1.0; color: "gray" } @@ -29,8 +29,8 @@ Item { MouseRegion { anchors.fill: parent; drag.target: parent - drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: Slider.xMax+2 - onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; } + drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: slider.xMax+2 + onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } } } } diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index c4d1bec..173021b 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -1,17 +1,16 @@ import Qt 4.6 Item { - id: Container + id: container width: 24 height: 24 property int rating property bool on - signal clicked Image { - id: StarImage + id: starImage source: "pics/ghns_star.png" x: 6 y: 7 @@ -19,15 +18,15 @@ Item { scale: 0.5 } MouseRegion { - anchors.fill: Container - onClicked: { Container.clicked() } + anchors.fill: container + onClicked: { container.clicked() } } states: [ State { name: "on" - when: Container.on == true + when: container.on == true PropertyChanges { - target: StarImage + target: starImage opacity: 1 scale: 1 x: 1 diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index f8cf048..d1ad6e1 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -3,79 +3,79 @@ import Qt 4.6 import "common" Item { - id: MainWindow; width: 800; height: 450 + id: mainWindow; width: 800; height: 450 property bool showPathView : false resources: [ Component { - id: PhotoDelegate + id: photoDelegate Item { - id: Wrapper; width: 85; height: 85 - scale: Wrapper.PathView.scale; z: Wrapper.PathView.z + id: wrapper; width: 85; height: 85 + scale: wrapper.PathView.scale; z: wrapper.PathView.z transform: Rotation { - id: ItemRotation; origin.x: Wrapper.width/2; origin.y: Wrapper.height/2 - axis.y: 1; axis.z: 0; angle: Wrapper.PathView.angle + id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 + axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle } Connection { - sender: ImageDetails; signal: "closed()" + sender: imageDetails; signal: "closed()" script: { - if (Wrapper.state == 'Details') { - Wrapper.state = ''; - ImageDetails.photoUrl = ""; + if (wrapper.state == 'Details') { + wrapper.state = ''; + imageDetails.photoUrl = ""; } } } Script { function photoClicked() { - ImageDetails.photoTitle = title; - ImageDetails.photoDescription = description; - ImageDetails.photoTags = tags; - ImageDetails.photoWidth = photoWidth; - ImageDetails.photoHeight = photoHeight; - ImageDetails.photoType = photoType; - ImageDetails.photoAuthor = photoAuthor; - ImageDetails.photoDate = photoDate; - ImageDetails.photoUrl = url; - ImageDetails.rating = 0; - Wrapper.state = "Details"; + imageDetails.photoTitle = title; + imageDetails.photoDescription = description; + imageDetails.photoTags = tags; + imageDetails.photoWidth = photoWidth; + imageDetails.photoHeight = photoHeight; + imageDetails.photoType = photoType; + imageDetails.photoAuthor = photoAuthor; + imageDetails.photoDate = photoDate; + imageDetails.photoUrl = url; + imageDetails.rating = 0; + wrapper.state = "Details"; } } Rectangle { - id: WhiteRect; anchors.fill: parent; color: "white"; radius: 5 + id: whiteRect; anchors.fill: parent; color: "white"; radius: 5 - Loading { x: 26; y: 26; visible: Thumb.status!=1 } - Image { id: Thumb; source: imagePath; x: 5; y: 5 } + Loading { x: 26; y: 26; visible: thumb.status!=1 } + Image { id: thumb; source: imagePath; x: 5; y: 5 } Item { - id: Shadows - Image { source: "common/pics/shadow-right.png"; x: WhiteRect.width; height: WhiteRect.height } - Image { source: "common/pics/shadow-bottom.png"; y: WhiteRect.height; width: WhiteRect.width } - Image { id: Corner; source: "common/pics/shadow-corner.png"; x: WhiteRect.width; y: WhiteRect.height } + id: shadows + Image { source: "common/pics/shadow-right.png"; x: whiteRect.width; height: whiteRect.height } + Image { source: "common/pics/shadow-bottom.png"; y: whiteRect.height; width: whiteRect.width } + Image { id: Corner; source: "common/pics/shadow-corner.png"; x: whiteRect.width; y: whiteRect.height } } } - MouseRegion { anchors.fill: Wrapper; onClicked: { photoClicked() } } + MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } } states: [ State { name: "Details" - PropertyChanges { target: ImageDetails; z: 2 } - ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } - PropertyChanges { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } - PropertyChanges { target: ItemRotation; angle: 0 } - PropertyChanges { target: Shadows; opacity: 0 } - PropertyChanges { target: ImageDetails; y: 20 } - PropertyChanges { target: PhotoGridView; y: -480 } - PropertyChanges { target: PhotoPathView; y: -480 } - PropertyChanges { target: ViewModeButton; opacity: 0 } - PropertyChanges { target: TagsEdit; opacity: 0 } - PropertyChanges { target: FetchButton; opacity: 0 } - PropertyChanges { target: CategoryText; y: "-50" } + PropertyChanges { target: imageDetails; z: 2 } + ParentChange { target: wrapper; parent: imageDetails.frontContainer } + PropertyChanges { target: wrapper; x: 45; y: 35; scale: 1; z: 1000 } + PropertyChanges { target: itemRotation; angle: 0 } + PropertyChanges { target: shadows; opacity: 0 } + PropertyChanges { target: imageDetails; y: 20 } + PropertyChanges { target: photoGridView; y: -480 } + PropertyChanges { target: photoPathView; y: -480 } + PropertyChanges { target: viewModeButton; opacity: 0 } + PropertyChanges { target: tagsEdit; opacity: 0 } + PropertyChanges { target: fetchButton; opacity: 0 } + PropertyChanges { target: categoryText; y: "-50" } } ] @@ -92,7 +92,7 @@ Item { SequentialAnimation { ParentAction { } NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } - PropertyAction { target: Wrapper; properties: "z" } + PropertyAction { target: wrapper; properties: "z" } } } ] @@ -102,21 +102,21 @@ Item { ] Item { - id: Background + id: background anchors.fill: parent Image { source: "common/pics/background.png"; anchors.fill: parent } - RssModel { id: RssModel; tags : TagsEdit.text } - Loading { anchors.centerIn: parent; visible: RssModel.status == 2 } + RssModel { id: rssModel; tags : tagsEdit.text } + Loading { anchors.centerIn: parent; visible: rssModel.status == 2 } GridView { - id: PhotoGridView; model: RssModel; delegate: PhotoDelegate; cacheBuffer: 100 + id: photoGridView; model: rssModel; delegate: photoDelegate; cacheBuffer: 100 cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1 } PathView { - id: PhotoPathView; model: RssModel; delegate: PhotoDelegate + id: photoPathView; model: rssModel; delegate: photoDelegate y: -380; width: 800; height: 330; pathItemCount: 10; z: 1 path: Path { startX: -50; startY: 40; @@ -146,36 +146,34 @@ Item { } - ImageDetails { id: ImageDetails; width: 750; x: 25; y: 500; height: 410 } + ImageDetails { id: imageDetails; width: 750; x: 25; y: 500; height: 410 } MediaButton { - id: ViewModeButton; x: 680; y: 410; text: "View Mode" - onClicked: { if (MainWindow.showPathView == true) MainWindow.showPathView = false; else MainWindow.showPathView = true } + id: viewModeButton; x: 680; y: 410; text: "View Mode" + onClicked: { if (mainWindow.showPathView == true) mainWindow.showPathView = false; else mainWindow.showPathView = true } } MediaButton { - id: FetchButton + id: fetchButton text: "Update" - anchors.right: ViewModeButton.left; anchors.rightMargin: 5 - anchors.top: ViewModeButton.top - onClicked: { RssModel.reload(); } + anchors.right: viewModeButton.left; anchors.rightMargin: 5 + anchors.top: viewModeButton.top + onClicked: { rssModel.reload(); } } MediaLineEdit { - id: TagsEdit; + id: tagsEdit; label: "Tags" - anchors.right: FetchButton.left; anchors.rightMargin: 5 - anchors.top: ViewModeButton.top + anchors.right: fetchButton.left; anchors.rightMargin: 5 + anchors.top: viewModeButton.top } - states: [ - State { - name: "PathView" - when: MainWindow.showPathView == true - PropertyChanges { target: PhotoPathView; y: 80 } - PropertyChanges { target: PhotoGridView; y: -380 } - } - ] + states: State { + name: "PathView" + when: mainWindow.showPathView == true + PropertyChanges { target: photoPathView; y: 80 } + PropertyChanges { target: photoGridView; y: -380 } + } transitions: [ Transition { @@ -186,9 +184,9 @@ Item { } Text { - id: CategoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15; + id: categoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15; text: "Flickr - " + - (RssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + RssModel.tags) + (rssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + rssModel.tags) font.pointSize: 20; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" } } diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index 32f3e37..48fe7df 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -3,38 +3,38 @@ import "common" as Common import "mobile" as Mobile Item { - id: Screen; width: 320; height: 480 + id: screen; width: 320; height: 480 property bool inListView : false Rectangle { - id: Background + id: background anchors.fill: parent; color: "#343434"; Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 } - Common.RssModel { id: RssModel } - Common.Loading { anchors.centerIn: parent; visible: RssModel.status == 2 } + Common.RssModel { id: rssModel } + Common.Loading { anchors.centerIn: parent; visible: rssModel.status == 2 } Item { - id: Views + id: views x: 2; width: parent.width - 4 - anchors.top: TitleBar.bottom; anchors.bottom: ToolBar.top + anchors.top: titleBar.bottom; anchors.bottom: toolBar.top - Mobile.GridDelegate { id: GridDelegate } + Mobile.GridDelegate { id: gridDelegate } GridView { - id: PhotoGridView; model: RssModel; delegate: GridDelegate; cacheBuffer: 100 + id: photoGridView; model: rssModel; delegate: gridDelegate; cacheBuffer: 100 cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1; z: 6 } - Mobile.ListDelegate { id: ListDelegate } + Mobile.ListDelegate { id: listDelegate } ListView { - id: PhotoListView; model: RssModel; delegate: ListDelegate; z: 6 + id: photoListView; model: rssModel; delegate: listDelegate; z: 6 width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; } states: State { - name: "ListView"; when: Screen.inListView == true - PropertyChanges { target: PhotoListView; x: 0 } - PropertyChanges { target: PhotoGridView; x: -(parent.width * 1.5) } + name: "ListView"; when: screen.inListView == true + PropertyChanges { target: photoListView; x: 0 } + PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } } transitions: Transition { @@ -42,37 +42,37 @@ Item { } } - Mobile.ImageDetails { id: ImageDetails; width: parent.width; anchors.left: Views.right; height: parent.height; z:1 } - Mobile.TitleBar { id: TitleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 } + Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 } + Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 } Mobile.ToolBar { - id: ToolBar; z: 5 + id: toolBar; z: 5 height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 button1Label: "Update"; button2Label: "View mode" - onButton1Clicked: RssModel.reload() - onButton2Clicked: if (Screen.inListView == true) Screen.inListView = false; else Screen.inListView = true + onButton1Clicked: rssModel.reload() + onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true } Connection { - sender: ImageDetails; signal: "closed()" + sender: imageDetails; signal: "closed()" script: { - if (Background.state == "DetailedView") { - Background.state = ''; - ImageDetails.photoUrl = ""; + if (background.state == "DetailedView") { + background.state = ''; + imageDetails.photoUrl = ""; } } } states: State { name: "DetailedView" - PropertyChanges { target: Views; x: -parent.width } - PropertyChanges { target: ToolBar; button1Label: "More..." } + PropertyChanges { target: views; x: -parent.width } + PropertyChanges { target: toolBar; button1Label: "More..." } PropertyChanges { - target: ToolBar - onButton1Clicked: if (ImageDetails.state=='') ImageDetails.state='Back'; else ImageDetails.state='' + target: toolBar + onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' } - PropertyChanges { target: ToolBar; button2Label: "Back" } - PropertyChanges { target: ToolBar; onButton2Clicked: ImageDetails.closed() } + PropertyChanges { target: toolBar; button2Label: "Back" } + PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } } transitions: Transition { diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 6887240..a4a96d4 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -1,41 +1,38 @@ import Qt 4.6 Item { - id: Container + id: container signal clicked property string text BorderImage { - id: ButtonImage + id: buttonImage source: "images/toolbutton.sci" - width: Container.width; height: Container.height + width: container.width; height: container.height } BorderImage { - id: Pressed + id: pressed opacity: 0 source: "images/toolbutton.sci" - width: Container.width; height: Container.height + width: container.width; height: container.height } MouseRegion { - id: MyMouseRegion - anchors.fill: ButtonImage - onClicked: { Container.clicked(); } + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } } Text { color: "white" - anchors.centerIn: ButtonImage; font.bold: true - text: Container.text; style: "Raised"; styleColor: "black" + anchors.centerIn: buttonImage; font.bold: true + text: container.text; style: "Raised"; styleColor: "black" } states: [ State { name: "Pressed" - when: MyMouseRegion.pressed == true - PropertyChanges { - target: Pressed - opacity: 1 - } + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } } ] } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 19369b2..9b9fb24 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -1,22 +1,22 @@ import Qt 4.6 Component { - id: PhotoDelegate + id: photoDelegate Item { - id: Wrapper; width: 79; height: 79 + id: wrapper; width: 79; height: 79 Script { function photoClicked() { - ImageDetails.photoTitle = title; - ImageDetails.photoTags = tags; - ImageDetails.photoWidth = photoWidth; - ImageDetails.photoHeight = photoHeight; - ImageDetails.photoType = photoType; - ImageDetails.photoAuthor = photoAuthor; - ImageDetails.photoDate = photoDate; - ImageDetails.photoUrl = url; - ImageDetails.rating = 0; - ScaleMe.state = "Details"; + imageDetails.photoTitle = title; + imageDetails.photoTags = tags; + imageDetails.photoWidth = photoWidth; + imageDetails.photoHeight = photoHeight; + imageDetails.photoType = photoType; + imageDetails.photoAuthor = photoAuthor; + imageDetails.photoDate = photoDate; + imageDetails.photoUrl = url; + imageDetails.rating = 0; + scaleMe.state = "Details"; } } @@ -24,31 +24,31 @@ anchors.centerIn: parent scale: 0.0 scale: Behavior { NumberAnimation { easing: "easeInOutQuad"} } - id: ScaleMe + id: scaleMe - Rectangle { height: 79; width: 79; id: BlackRect; anchors.centerIn: parent; color: "black"; smooth: true } + Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true } Rectangle { - id: WhiteRect; width: 77; height: 77; anchors.centerIn: parent; color: "#dddddd"; smooth: true - Image { id: Thumb; source: imagePath; x: 1; y: 1; smooth: true} + id: whiteRect; width: 77; height: 77; anchors.centerIn: parent; color: "#dddddd"; smooth: true + Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true} Image { source: "images/gloss.png" } } Connection { - sender: ToolBar; signal: "button2Clicked()" - script: if (ScaleMe.state == 'Details' ) ScaleMe.state = 'Show'; + sender: toolBar; signal: "button2Clicked()" + script: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show'; } states: [ State { - name: "Show"; when: Thumb.status == 1 - PropertyChanges { target: ScaleMe; scale: 1 } + name: "Show"; when: thumb.status == 1 + PropertyChanges { target: scaleMe; scale: 1 } }, State { name: "Details" - PropertyChanges { target: ScaleMe; scale: 1 } - ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } - PropertyChanges { target: Wrapper; x: 20; y: 60; z: 1000 } - PropertyChanges { target: Background; state: "DetailedView" } + PropertyChanges { target: scaleMe; scale: 1 } + ParentChange { target: wrapper; parent: imageDetails.frontContainer } + PropertyChanges { target: wrapper; x: 20; y: 60; z: 1000 } + PropertyChanges { target: background; state: "DetailedView" } } ] transitions: [ @@ -62,11 +62,11 @@ SequentialAnimation { ParentAction { } NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } - PropertyAction { target: Wrapper; properties: "z" } + PropertyAction { target: wrapper; properties: "z" } } } ] } - MouseRegion { anchors.fill: Wrapper; onClicked: { photoClicked() } } + MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } } } } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index c55ab50..26052b9 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -2,9 +2,9 @@ import Qt 4.6 import "../common" as Common Flipable { - id: Container + id: container - property var frontContainer: ContainerFront + property var frontContainer: containerFront property string photoTitle: "" property string photoTags: "" property int photoWidth @@ -19,13 +19,13 @@ Flipable { signal closed transform: Rotation { - id: ItemRotation - origin.x: Container.width / 2; + id: itemRotation + origin.x: container.width / 2; axis.y: 1; axis.z: 0 } front: Item { - id: ContainerFront; anchors.fill: Container + id: containerFront; anchors.fill: container Rectangle { anchors.fill: parent @@ -39,43 +39,43 @@ Flipable { right: parent.right; rightMargin: 20 top: parent.top; topMargin: 180 } - Text { id: TitleText; font.bold: true; color: "white"; elide: "ElideRight"; text: Container.photoTitle } - Text { id: Size; color: "white"; elide: "ElideRight"; text: "Size: " + Container.photoWidth + 'x' + Container.photoHeight } - Text { id: Type; color: "white"; elide: "ElideRight"; text: "Type: " + Container.photoType } - Text { id: Author; color: "white"; elide: "ElideRight"; text: "Author: " + Container.photoAuthor } - Text { id: Date; color: "white"; elide: "ElideRight"; text: "Published: " + Container.photoDate } - Text { id: TagsLabel; color: "white"; elide: "ElideRight"; text: Container.photoTags == "" ? "" : "Tags: " } - Text { id: Tags; color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: Container.photoTags } + Text { font.bold: true; color: "white"; elide: "ElideRight"; text: container.photoTitle } + Text { color: "white"; elide: "ElideRight"; text: "Size: " + container.photoWidth + 'x' + container.photoHeight } + Text { color: "white"; elide: "ElideRight"; text: "Type: " + container.photoType } + Text { color: "white"; elide: "ElideRight"; text: "Author: " + container.photoAuthor } + Text { color: "white"; elide: "ElideRight"; text: "Published: " + container.photoDate } + Text { color: "white"; elide: "ElideRight"; text: container.photoTags == "" ? "" : "Tags: " } + Text { color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: container.photoTags } } } back: Item { - anchors.fill: Container + anchors.fill: container Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } - Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 } + Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } Flickable { - id: Flick; anchors.fill: parent; clip: true - viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height + id: flickable; anchors.fill: parent; clip: true + viewportWidth: imageContainer.width; viewportHeight: imageContainer.height Item { - id: ImageContainer - width: Math.max(BigImage.width * BigImage.scale, Flick.width); - height: Math.max(BigImage.height * BigImage.scale, Flick.height); + id: imageContainer + width: Math.max(bigImage.width * bigImage.scale, flickable.width); + height: Math.max(bigImage.height * bigImage.scale, flickable.height); Image { - id: BigImage; source: Container.photoUrl; scale: Slider.value + id: bigImage; source: container.photoUrl; scale: slider.value // Center image if it is smaller than the flickable area. - x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0 - y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0 - smooth: !Flick.moving + x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 + y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + smooth: !flickable.moving onStatusChanged : { // Default scale shows the entire image. if (status == 1 && width != 0) { - Slider.minimum = Math.min(Flick.width / width, Flick.height / height); - prevScale = Math.min(Slider.minimum, 1); - Slider.value = prevScale; + slider.minimum = Math.min(flickable.width / width, flickable.height / height); + prevScale = Math.min(slider.minimum, 1); + slider.value = prevScale; } } } @@ -84,25 +84,25 @@ Flipable { Text { text: "Image Unavailable" - visible: BigImage.status == 'Error' + visible: bigImage.status == 'Error' anchors.centerIn: parent; color: "white"; font.bold: true } Common.Slider { - id: Slider; visible: { BigImage.status == 1 && maximum > minimum } + id: slider; visible: { bigImage.status == 1 && maximum > minimum } anchors { bottom: parent.bottom; bottomMargin: 65 left: parent.left; leftMargin: 25 right: parent.right; rightMargin: 25 } onValueChanged: { - if (BigImage.width * value > Flick.width) { - var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale; - Flick.viewportX = xoff - Flick.width/2; + if (bigImage.width * value > flickable.width) { + var xoff = (flickable.width/2 + flickable.viewportX) * value / prevScale; + flickable.viewportX = xoff - flickable.width/2; } - if (BigImage.height * value > Flick.height) { - var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale; - Flick.viewportY = yoff - Flick.height/2; + if (bigImage.height * value > flickable.height) { + var yoff = (flickable.height/2 + flickable.viewportY) * value / prevScale; + flickable.viewportY = yoff - flickable.height/2; } prevScale = value; } @@ -111,14 +111,14 @@ Flipable { states: State { name: "Back" - PropertyChanges { target: ItemRotation; angle: 180 } + PropertyChanges { target: itemRotation; angle: 180 } } transitions: Transition { SequentialAnimation { - PropertyAction { target: BigImage; property: "smooth"; value: false } + PropertyAction { target: bigImage; property: "smooth"; value: false } NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } - PropertyAction { target: BigImage; property: "smooth"; value: !Flick.moving } + PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving } } } } diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index fa6f8ea..090e91a 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -1,20 +1,19 @@ import Qt 4.6 Component { - id: ListDelegate Item { - id: Wrapper; width: Wrapper.ListView.view.width; height: 86 + id: wrapper; width: wrapper.ListView.view.width; height: 86 Item { - id: MoveMe - Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: Wrapper.width; y: 1 } + id: moveMe + Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 } Rectangle { - id: WhiteRect; x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true + x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true - Image { id: Thumb; source: imagePath; x: 1; y: 1 } + Image { source: imagePath; x: 1; y: 1 } Image { source: "images/gloss.png" } } Column { - x: 92; width: Wrapper.ListView.view.width - 95; y: 15; spacing: 2 + x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: "ElideRight"; style: "Raised"; styleColor: "black" } Text { text: photoAuthor; color: "white"; width: parent.width; elide: "ElideLeft"; color: "#cccccc"; style: "Raised"; styleColor: "black" } Text { text: photoDate; color: "white"; width: parent.width; elide: "ElideRight"; color: "#cccccc"; style: "Raised"; styleColor: "black" } diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 13484a2..108faf7 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -1,50 +1,50 @@ import Qt 4.6 Item { - id: TitleBar + id: titleBar property string untaggedString: "Uploads from everyone" property string taggedString: "Recent uploads tagged " BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } Item { - id: Container + id: container width: (parent.width * 2) - 55 ; height: parent.height Script { function accept() { - TitleBar.state = "" - Background.state = "" - RssModel.tags = Editor.text + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text } } Text { - id: CategoryText + id: categoryText anchors { - left: parent.left; right: TagButton.left; leftMargin: 10; rightMargin: 10 + left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10 verticalCenter: parent.verticalCenter } elide: "ElideLeft" - text: (RssModel.tags=="" ? untaggedString : taggedString + RssModel.tags) + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) font.bold: true; color: "White"; style: "Raised"; styleColor: "Black" } Button { - id: TagButton; x: TitleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (TitleBar.state == "Tags") accept(); else TitleBar.state = "Tags" + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" anchors.verticalCenter: parent.verticalCenter } Item { - id: LineEdit + id: lineEdit y: 4; height: parent.height - 9 - anchors { left: TagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } TextInput { - id: Editor + id: editor anchors { left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 verticalCenter: parent.verticalCenter @@ -53,21 +53,21 @@ Item { color: "#151515"; selectionColor: "Green" } - Keys.forwardTo: [ (ReturnKey), (Editor)] + Keys.forwardTo: [ (returnKey), (editor)] Item { - id: ReturnKey + id: returnKey Keys.onReturnPressed: accept() - Keys.onEscapePressed: TitleBar.state = "" + Keys.onEscapePressed: titleBar.state = "" } } } states: State { name: "Tags" - PropertyChanges { target: Container; x: -TagButton.x + 5 } - PropertyChanges { target: TagButton; text: "OK" } - PropertyChanges { target: LineEdit; focus: true } + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: lineEdit; focus: true } } transitions: Transition { diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml index cfdc8fe..f96c767 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/mobile/ToolBar.qml @@ -1,24 +1,24 @@ import Qt 4.6 Item { - id: Toolbar + id: toolbar - property alias button1Label: Button1.text - property alias button2Label: Button2.text + property alias button1Label: button1.text + property alias button2Label: button2.text signal button1Clicked signal button2Clicked BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } Button { - id: Button1 + id: button1 anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 - onClicked: Toolbar.button1Clicked() + onClicked: toolbar.button1Clicked() } Button { - id: Button2 + id: button2 anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 - onClicked: Toolbar.button2Clicked() + onClicked: toolbar.button2Clicked() } } -- cgit v0.12 From b9663faad39ae02b7dbee9f2cea7dce7d25894f8 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 6 Oct 2009 12:51:22 +1000 Subject: lowercase ids --- demos/declarative/minehunt/Description.qml | 10 +- demos/declarative/samegame/content/Button.qml | 6 +- demos/declarative/samegame/content/Dialog.qml | 8 +- demos/declarative/samegame/samegame.qml | 24 +-- demos/declarative/twitter/content/AuthView.qml | 12 +- demos/declarative/twitter/content/FatDelegate.qml | 20 +-- demos/declarative/twitter/content/HomeTitleBar.qml | 64 ++++---- .../declarative/twitter/content/MultiTitleBar.qml | 14 +- demos/declarative/twitter/twitter.qml | 73 ++++----- .../webbrowser/content/RectSoftShadow.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 170 ++++++++++----------- 11 files changed, 202 insertions(+), 201 deletions(-) diff --git a/demos/declarative/minehunt/Description.qml b/demos/declarative/minehunt/Description.qml index df4881c..440dd2e 100644 --- a/demos/declarative/minehunt/Description.qml +++ b/demos/declarative/minehunt/Description.qml @@ -1,12 +1,12 @@ import Qt 4.6 Item { - id: Page - height: MyText.height + 20 + id: page + height: myText.height + 20 property var text MouseRegion { anchors.fill: parent - drag.target: Page + drag.target: page drag.axis: "XandYAxis" drag.minimumX: 0 drag.maximumX: 1000 @@ -24,8 +24,8 @@ Item { width: parent.width - 20 height: parent.height - 20 Text { - id: MyText - text: Page.text + id: myText + text: page.text width: parent.width clip: true wrap: true diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml index 2354218..301124e 100644 --- a/demos/declarative/samegame/content/Button.qml +++ b/demos/declarative/samegame/content/Button.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - id: Container + id: container signal clicked property string text: "Button" @@ -17,9 +17,9 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml index 401d211..661257b 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/content/Dialog.qml @@ -7,15 +7,15 @@ Rectangle { page.opacity = 0; } function show(txt) { - MyText.text = txt; + myText.text = txt; page.opacity = 1; } signal closed(); - color: "white"; border.width: 1; width: MyText.width + 20; height: 60; + color: "white"; border.width: 1; width: myText.width + 20; height: 60; opacity: 0 - opacity: Behavior { + opacity: Behavior { NumberAnimation { duration: 1000 } } - Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" } + Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index ede4362..92d85f3 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -2,7 +2,7 @@ import Qt 4.6 import "content" Rectangle { - id: Screen + id: screen width: 490; height: 720 Script { source: "content/samegame.js" } @@ -10,7 +10,7 @@ Rectangle { SystemPalette { id: activePalette; colorGroup: Qt.Active } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + width: parent.width; anchors.top: parent.top; anchors.bottom: toolBar.top Image { id: background @@ -34,14 +34,14 @@ Rectangle { } Dialog { id: dialog; anchors.centerIn: parent; z: 21 } - Dialog { - id: scoreName; anchors.centerIn: parent; z: 22; + Dialog { + id: scoreName; anchors.centerIn: parent; z: 22; TextInput { - id: Editor - onAccepted: { - if(scoreName.opacity==1&&Editor.text!="") - sendHighScore(Editor.text); - scoreName.forceClose(); + id: editor + onAccepted: { + if(scoreName.opacity==1&&editor.text!="") + sendHighScore(editor.text); + scoreName.forceClose(); } anchors.verticalCenter: parent.verticalCenter width: 72; focus: true @@ -50,10 +50,10 @@ Rectangle { } Rectangle { - id: ToolBar + id: toolBar color: activePalette.window height: 32; width: parent.width - anchors.bottom: Screen.bottom + anchors.bottom: screen.bottom Button { id: btnA; text: "New Game"; onClicked: {initBoard();} @@ -62,7 +62,7 @@ Rectangle { } Text { - id: Score + id: score text: "Score: " + gameCanvas.score; font.bold: true anchors.right: parent.right; anchors.rightMargin: 3 anchors.verticalCenter: parent.verticalCenter diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml index 3fe7e7e..73ce308 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/content/AuthView.qml @@ -1,6 +1,6 @@ import Qt 4.6 import "../../flickr/common" -import "../../flickr/mobile" +import "../../flickr/mobile" Item { id: wrapper @@ -9,7 +9,7 @@ Item { spacing: 20 Row{ spacing: 4 - Text { + Text { width: 100 text: "Screen name:" font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" @@ -29,7 +29,7 @@ Item { font.bold: true color: "#151515"; selectionColor: "green" Keys.forwardTo: [(tabber), (nameIn)] - Item { + Item { id: tabber //Note: it's not working yet Keys.onPressed: {if(event.key == Qt.Key_Tab){print('Tab works!'); passIn.focus = true; accept(); }} @@ -39,7 +39,7 @@ Item { } Row{ spacing: 4 - Text { + Text { width: 100 text: "Password:" font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" @@ -71,7 +71,7 @@ Item { height: 32 id: login text: "Log in" - onClicked: {RssModel.authName=nameIn.text; RssModel.authPass=passIn.text; RssModel.tags='my timeline';} + onClicked: {rssModel.authName=nameIn.text; rssModel.authPass=passIn.text; rssModel.tags='my timeline';} } Button { x: 120 @@ -79,7 +79,7 @@ Item { height: 32 id: guest text: "Guest" - onClicked: {RssModel.authName='-'; Screen.setMode(true);} + onClicked: {rssModel.authName='-'; screen.setMode(true);} } } } diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml index a2e9c39..32a921e 100644 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ b/demos/declarative/twitter/content/FatDelegate.qml @@ -4,12 +4,12 @@ import "../../flickr/common" Component { id: ListDelegate Item { - id: Wrapper; width: Wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 Script { function handleLink(link){ if(link.slice(0,3) == 'app'){ setUser(link.slice(7)); - Screen.setMode(true); + screen.setMode(true); }else if(link.slice(0,4) == 'http'){ Qt.DesktopServices.openUrl(link); } @@ -21,17 +21,17 @@ Component { } } Item { - id: MoveMe; height: parent.height - Rectangle { - id: BlackRect - color: "black"; opacity: Wrapper.ListView.index % 2 ? 0.2 : 0.3; height: Wrapper.height-2; width: Wrapper.width; y: 1 + id: moveMe; height: parent.height + Rectangle { + id: blackRect + color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 } Rectangle { - id: WhiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true + id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true anchors.verticalCenter: parent.verticalCenter - Loading { x: 1; y: 1; width: 48; height: 48; visible: RealImage.status != 1 } - Image { id: RealImage; source: userImage; x: 1; y: 1; width:48; height:48 } + Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != 1 } + Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 } } Text { id:txt; y:4; x: 56 text: '' @@ -39,7 +39,7 @@ Component { + "
" + addTags(statusText) + ""; textFormat: Qt.RichText color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true - anchors.left: WhiteRect.right; anchors.right: BlackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } } diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index bd3bc2c..3108a9b 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -10,80 +10,80 @@ Item { BorderImage { source: "../../flickr/mobile/images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } Item { - id: Container + id: container width: (parent.width * 2) - 55 ; height: parent.height Script { function accept() { - if(RssModel.authName == '' || RssModel.authPass == '') + if(rssModel.authName == '' || rssModel.authPass == '') return false;//Can't login like that - var postData = "status=" + Editor.text; + var postData = "status=" + editor.text; var postman = new XMLHttpRequest(); - postman.open("POST", "http://twitter.com/statuses/update.xml", true, RssModel.authName, RssModel.authPass); - postman.onreadystatechange = function() { + postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); + postman.onreadystatechange = function() { if (postman.readyState == postman.DONE) { titleBar.update(); } } postman.send(postData); - Editor.text = "" + editor.text = "" titleBar.state = "" } } Rectangle { - id: WhiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true + x: 6; width: 50; height: 50; color: "white"; smooth: true anchors.verticalCenter: parent.verticalCenter - UserModel { user: RssModel.authName; id: userModel } - Component { id: imgDelegate; - Item { id: Wrapper - Loading { width:48; height:48; visible: realImage.status != 1 } - Image { source: image; width:48; height:48; id: realImage } + UserModel { user: rssModel.authName; id: userModel } + Component { id: imgDelegate; + Item { + Loading { width:48; height:48; visible: realImage.status != 1 } + Image { source: image; width:48; height:48; id: realImage } } - } + } ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate } } Text { - id: CategoryText - anchors.left: parent.left; anchors.right: TagButton.left + id: categoryText + anchors.left: parent.left; anchors.right: tagButton.left anchors.leftMargin: 58; anchors.rightMargin: 10 anchors.verticalCenter: parent.verticalCenter elide: "ElideLeft" - text: "Timeline for " + RssModel.authName + text: "Timeline for " + rssModel.authName font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" } Button { - id: TagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." + id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." anchors.verticalCenter: parent.verticalCenter; onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting" } Text { - id: charsLeftText; anchors.horizontalCenter: TagButton.horizontalCenter; - anchors.top: TagButton.bottom; anchors.topMargin: 2 - text: {140 - Editor.text.length;} visible: titleBar.state == "Posting" + id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter; + anchors.top: tagButton.bottom; anchors.topMargin: 2 + text: {140 - editor.text.length;} visible: titleBar.state == "Posting" font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" } Item { id: txtEdit; - anchors.left: TagButton.right; anchors.leftMargin: 5; y: 4 + anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 BorderImage { source: "../../flickr/mobile/images/lineedit.sci"; anchors.fill: parent } Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? - when: Editor.text.length > 140 - target: Editor + when: editor.text.length > 140 + target: editor property: "text" - value: Editor.text.slice(0,140) + value: editor.text.slice(0,140) } TextEdit { - id: Editor - anchors.left: parent.left; + id: editor + anchors.left: parent.left; anchors.leftMargin: 8; anchors.bottom: parent.bottom anchors.bottomMargin: 4; @@ -94,9 +94,9 @@ Item { wrap:true color: "#151515"; selectionColor: "green" } - Keys.forwardTo: [(ReturnKey), (Editor)] + Keys.forwardTo: [(returnKey), (editor)] Item { - id: ReturnKey + id: returnKey Keys.onReturnPressed: accept() Keys.onEscapePressed: titleBar.state = "" } @@ -105,11 +105,11 @@ Item { states: [ State { name: "Posting" - PropertyChanges { target: Container; x: -TagButton.x + 5 } + PropertyChanges { target: container; x: -tagButton.x + 5 } PropertyChanges { target: titleBar; height: 80 } - PropertyChanges { target: TagButton; text: "OK" } - PropertyChanges { target: TagButton; width: 28 } - PropertyChanges { target: TagButton; height: 24 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: tagButton; width: 28 } + PropertyChanges { target: tagButton; height: 24 } PropertyChanges { target: txtEdit; focus: true } } ] diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml index 6a6a28f..da0794d 100644 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ b/demos/declarative/twitter/content/MultiTitleBar.qml @@ -2,20 +2,20 @@ import Qt 4.6 import "../../flickr/mobile" Item { - height: HomeBar.height - HomeTitleBar { id: HomeBar; width: parent.width; height: 60; - onUpdate: RssModel.reload() + height: homeBar.height + HomeTitleBar { id: homeBar; width: parent.width; height: 60; + onUpdate: rssModel.reload() } - TitleBar { id: TitleBar; width: parent.width; height: 60; + TitleBar { id: titleBar; width: parent.width; height: 60; y: -80 untaggedString: "Latest tweets from everyone" taggedString: "Latest tweets from " } states: [ State { - name: "search"; when: Screen.userView - PropertyChanges { target: TitleBar; y: 0 } - PropertyChanges { target: HomeBar; y: -80 } + name: "search"; when: screen.userView + PropertyChanges { target: titleBar; y: 0 } + PropertyChanges { target: homeBar; y: -80 } } ] transitions: [ diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index eb9f5d6..e9752ff 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -4,43 +4,44 @@ import "../flickr/common" as Common import "../flickr/mobile" as Mobile Item { - id: Screen; width: 320; height: 480 - property bool userView : false + id: screen; width: 320; height: 480 + property bool userView : false + property var tmpStr function setMode(m){ - Screen.userView = m; - if(m == false){ - RssModel.tags='my timeline'; - RssModel.reload(); - ToolBar.button2Label = "View others"; + screen.userView = m; + if(m == false){ + rssModel.tags='my timeline'; + rssModel.reload(); + toolBar.button2Label = "View others"; } else { - ToolBar.button2Label = "Return home"; + toolBar.button2Label = "Return home"; } } //Workaround for bug 260266 Timer{ interval: 1; running: false; repeat: false; onTriggered: reallySetUser(); id:hack } - Script{ - var tmpStr; + Script { +// var tmpStr; function setUser(str){hack.running = true; tmpStr = str} - function reallySetUser(){RssModel.tags = tmpStr;} + function reallySetUser(){rssModel.tags = tmpStr;} } Rectangle { - id: Background + id: background anchors.fill: parent; color: "#343434"; Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 } - Twitter.RssModel { id: RssModel } - Common.Loading { anchors.centerIn: parent; visible: RssModel.status==XmlListModel.Loading && state!='unauthed'} - Text { + Twitter.RssModel { id: rssModel } + Common.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} + Text { width: 180 - text: "Could not access twitter using this screen name and password pair."; + text: "Could not access twitter using this screen name and password pair."; color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true - visible: RssModel.status==XmlListModel.Error; anchors.centerIn: parent + visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent } Item { - id: Views + id: views x: 2; width: parent.width - 4 y:60 //Below the title bars height: 380 @@ -48,44 +49,44 @@ Item { Twitter.AuthView{ id: authView anchors.verticalCenter: parent.verticalCenter - width: parent.width; height: parent.height-60; - x: -(Screen.width * 1.5) + width: parent.width; height: parent.height-60; + x: -(screen.width * 1.5) } - Twitter.FatDelegate { id: FatDelegate } + Twitter.FatDelegate { id: fatDelegate } ListView { - id: MainView; model: RssModel.model; delegate: FatDelegate; + id: mainView; model: rssModel.model; delegate: fatDelegate; width: parent.width; height: parent.height; x: 0; cacheBuffer: 100; } } - Twitter.MultiTitleBar { id: TitleBar; width: parent.width } - Mobile.ToolBar { id: ToolBar; height: 40; - //anchors.bottom: parent.bottom; + Twitter.MultiTitleBar { id: titleBar; width: parent.width } + Mobile.ToolBar { id: toolBar; height: 40; + //anchors.bottom: parent.bottom; //TODO: Use anchor changes instead of hard coding y: 440 - width: parent.width; opacity: 0.9 + width: parent.width; opacity: 0.9 button1Label: "Update" button2Label: "View others" - onButton1Clicked: RssModel.reload(); - onButton2Clicked: + onButton1Clicked: rssModel.reload(); + onButton2Clicked: { - if(Screen.userView == true){ - Screen.setMode(false); + if(screen.userView == true){ + screen.setMode(false); }else{ - RssModel.tags=''; - Screen.setMode(true); + rssModel.tags=''; + screen.setMode(true); } } } states: [ State { - name: "unauthed"; when: RssModel.authName=="" + name: "unauthed"; when: rssModel.authName=="" PropertyChanges { target: authView; x: 0 } - PropertyChanges { target: MainView; x: -(parent.width * 1.5) } - PropertyChanges { target: TitleBar; y: -80 } - PropertyChanges { target: ToolBar; y: Screen.height + 80 } + PropertyChanges { target: mainView; x: -(parent.width * 1.5) } + PropertyChanges { target: titleBar; y: -80 } + PropertyChanges { target: toolBar; y: screen.height + 80 } } ] transitions: [ diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml index 5b278ac..6bba98e 100644 --- a/demos/declarative/webbrowser/content/RectSoftShadow.qml +++ b/demos/declarative/webbrowser/content/RectSoftShadow.qml @@ -26,7 +26,7 @@ Item { source: "pics/softshadow-bottom.png" x: 0 y: parent.height - width: WebView.width*WebView.scale + width: webView.width*webView.scale height: 16 } } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 3f23d83..53ac214 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -4,7 +4,7 @@ import "content" import "fieldtext" Item { - id: WebBrowser + id: webBrowser property string urlString : "http://qt.nokia.com/" @@ -14,7 +14,7 @@ Item { height: 480 Item { - id: WebPanel + id: webPanel anchors.fill: parent clip: true Rectangle { @@ -23,48 +23,48 @@ Item { } Image { source: "content/pics/softshadow-bottom.png" - width: WebPanel.width + width: webPanel.width height: 16 } Image { source: "content/pics/softshadow-top.png" - width: WebPanel.width + width: webPanel.width height: 16 - anchors.bottom: Footer.top + anchors.bottom: footer.top } RectSoftShadow { - x: -Flick.viewportX - y: -Flick.viewportY - width: MyWebView.width*MyWebView.scale - height: Flick.y+MyWebView.height*MyWebView.scale + x: -flickable.viewportX + y: -flickable.viewportY + width: webView.width*webView.scale + height: flickable.y+webView.height*webView.scale } Item { - id: HeaderSpace + id: headerSpace width: parent.width height: 60 z: 1 Rectangle { - id: HeaderSpaceTint + id: headerSpaceTint color: "black" opacity: 0 anchors.fill: parent } Image { - id: Header + id: header source: "content/pics/header.png" width: parent.width height: 60 state: "Normal" - x: Flick.viewportX < 0 ? -Flick.viewportX : Flick.viewportX > Flick.viewportWidth-Flick.width - ? -Flick.viewportX+Flick.viewportWidth-Flick.width : 0 - y: Flick.viewportY < 0 ? -Flick.viewportY : progressOff* - (Flick.viewportY>height?-height:-Flick.viewportY) + x: flickable.viewportX < 0 ? -flickable.viewportX : flickable.viewportX > flickable.viewportWidth-flickable.width + ? -flickable.viewportX+flickable.viewportWidth-flickable.width : 0 + y: flickable.viewportY < 0 ? -flickable.viewportY : progressOff* + (flickable.viewportY>height?-height:-flickable.viewportY) Text { - id: HeaderText + id: headerText - text: MyWebView.title!='' || MyWebView.progress == 1.0 ? MyWebView.title : 'Loading...' + text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...' elide: "ElideRight" color: "white" @@ -75,22 +75,22 @@ Item { font.pointSize: 10 font.bold: true - anchors.left: Header.left - anchors.right: Header.right + anchors.left: header.left + anchors.right: header.right anchors.leftMargin: 4 anchors.rightMargin: 4 - anchors.top: Header.top + anchors.top: header.top anchors.topMargin: 4 horizontalAlignment: "AlignHCenter" } Item { width: parent.width - anchors.top: HeaderText.bottom + anchors.top: headerText.bottom anchors.topMargin: 2 anchors.bottom: parent.bottom Item { - id: UrlBox + id: urlBox height: 31 anchors.left: parent.left anchors.leftMargin: 12 @@ -102,32 +102,32 @@ Item { BorderImage { source: "content/pics/addressbar.sci" - anchors.fill: UrlBox + anchors.fill: urlBox } - + BorderImage { - id: UrlBoxhl + id: urlBoxhl source: "content/pics/addressbar-filled.sci" - width: parent.width*MyWebView.progress + width: parent.width*webView.progress height: parent.height - opacity: 1-Header.progressOff + opacity: 1-header.progressOff clip: true } FieldText { - id: EditUrl + id: editUrl mouseGrabbed: parent.mouseGrabbed - text: WebBrowser.urlString + text: webBrowser.urlString label: "url:" - onConfirmed: { WebBrowser.urlString = EditUrl.text; MyWebView.focus=true } - onCancelled: { MyWebView.focus=true } - onStartEdit: { MyWebView.focus=false } + onConfirmed: { webBrowser.urlString = editUrl.text; webView.focus=true } + onCancelled: { webView.focus=true } + onStartEdit: { webView.focus=false } - anchors.left: UrlBox.left - anchors.right: UrlBox.right + anchors.left: urlBox.left + anchors.right: urlBox.right anchors.leftMargin: 6 - anchors.verticalCenter: UrlBox.verticalCenter + anchors.verticalCenter: urlBox.verticalCenter anchors.verticalCenterOffset: 1 } } @@ -137,19 +137,19 @@ Item { states: [ State { name: "Normal" - when: MyWebView.progress == 1.0 - PropertyChanges { target: Header; progressOff: 1 } + when: webView.progress == 1.0 + PropertyChanges { target: header; progressOff: 1 } }, State { name: "ProgressShown" - when: MyWebView.progress < 1.0 - PropertyChanges { target: Header; progressOff: 0; } + when: webView.progress < 1.0 + PropertyChanges { target: header; progressOff: 0; } } ] transitions: [ Transition { NumberAnimation { - target: Header + target: header properties: "progressOff" easing: "easeInOutQuad" duration: 300 @@ -159,18 +159,18 @@ Item { } } Flickable { - id: Flick + id: flickable width: parent.width - viewportWidth: Math.max(parent.width,MyWebView.width*MyWebView.scale) - viewportHeight: Math.max(parent.height,MyWebView.height*MyWebView.scale) - anchors.top: HeaderSpace.bottom - anchors.bottom: Footer.top + viewportWidth: Math.max(parent.width,webView.width*webView.scale) + viewportHeight: Math.max(parent.height,webView.height*webView.scale) + anchors.top: headerSpace.bottom + anchors.bottom: footer.top anchors.left: parent.left anchors.right: parent.right pressDelay: 200 WebView { - id: MyWebView + id: webView pixelCacheSize: 4000000 Script { @@ -190,29 +190,29 @@ Item { } } - url: fixUrl(WebBrowser.urlString) + url: fixUrl(webBrowser.urlString) smooth: true fillColor: "white" focus: true - preferredWidth: Flick.width + preferredWidth: flickable.width webPageWidth: 980 - onUrlChanged: { if (url != null) { WebBrowser.urlString = url.toString(); } } + onUrlChanged: { if (url != null) { webBrowser.urlString = url.toString(); } } onDoubleClick: { heuristicZoom(clickX,clickY) } SequentialAnimation { - id: QuickZoom + id: quickZoom PropertyAction { - target: MyWebView + target: webView property: "renderingEnabled" value: false } ParallelAnimation { NumberAnimation { - id: ScaleAnim - target: MyWebView + id: scaleAnim + target: webView property: "scale" from: 1 to: 0 // set before calling @@ -220,8 +220,8 @@ Item { duration: 200 } NumberAnimation { - id: FlickVX - target: Flick + id: flickVX + target: flickable property: "viewportX" easing: "easeLinear" duration: 200 @@ -229,8 +229,8 @@ Item { to: 0 // set before calling } NumberAnimation { - id: FlickVY - target: Flick + id: flickVY + target: flickable property: "viewportY" easing: "easeLinear" duration: 200 @@ -239,12 +239,12 @@ Item { } } PropertyAction { - id: FinalZoom - target: MyWebView + id: finalZoom + target: webView property: "zoomFactor" } PropertyAction { - target: MyWebView + target: webView property: "scale" value: 1.0 } @@ -252,19 +252,19 @@ Item { // size changes may have started a correction if // zoomFactor < 1.0. PropertyAction { - id: FinalX - target: Flick + id: finalX + target: flickable property: "viewportX" value: 0 // set before calling } PropertyAction { - id: FinalY - target: Flick + id: finalY + target: flickable property: "viewportY" value: 0 // set before calling } PropertyAction { - target: MyWebView + target: webView property: "renderingEnabled" value: true } @@ -272,23 +272,23 @@ Item { onZooming: { if (centerX) { sc = zoom/zoomFactor; - ScaleAnim.to = sc; - FlickVX.from = Flick.viewportX - FlickVX.to = Math.min(Math.max(0,centerX-Flick.width/2),MyWebView.width*sc-Flick.width) - FinalX.value = Math.min(Math.max(0,centerX-Flick.width/2),MyWebView.width*sc-Flick.width) - FlickVY.from = Flick.viewportY - FlickVY.to = Math.min(Math.max(0,centerY-Flick.height/2),MyWebView.height*sc-Flick.height) - FinalY.value = Math.min(Math.max(0,centerY-Flick.height/2),MyWebView.height*sc-Flick.height) - FinalZoom.value = zoom - QuickZoom.start() + scaleAnim.to = sc; + flickVX.from = flickable.viewportX + flickVX.to = Math.min(Math.max(0,centerX-flickable.width/2),webView.width*sc-flickable.width) + finalX.value = Math.min(Math.max(0,centerX-flickable.width/2),webView.width*sc-flickable.width) + flickVY.from = flickable.viewportY + flickVY.to = Math.min(Math.max(0,centerY-flickable.height/2),webView.height*sc-flickable.height) + finalY.value = Math.min(Math.max(0,centerY-flickable.height/2),webView.height*sc-flickable.height) + finalZoom.value = zoom + quickZoom.start() } } } Rectangle { - id: WebViewTint + id: webViewTint color: "black" opacity: 0 - anchors.fill: MyWebView + anchors.fill: webView /*MouseRegion { anchors.fill: WebViewTint onClicked: { proxy.focus=false } @@ -296,7 +296,7 @@ Item { } } BorderImage { - id: Footer + id: footer source: "content/pics/footer.sci" width: parent.width height: 43 @@ -327,13 +327,13 @@ Item { states: [ State { name: "Enabled" - when: MyWebView.back.enabled==true + when: webView.back.enabled==true PropertyChanges { target: back_e; opacity: 1 } PropertyChanges { target: back_d; opacity: 0 } }, State { name: "Disabled" - when: MyWebView.back.enabled==false + when: webView.back.enabled==false PropertyChanges { target: back_e; opacity: 0 } PropertyChanges { target: back_d; opacity: 1 } } @@ -349,7 +349,7 @@ Item { ] MouseRegion { anchors.fill: back_e - onClicked: { if (MyWebView.back.enabled) MyWebView.back.trigger() } + onClicked: { if (webView.back.enabled) webView.back.trigger() } } } Image { @@ -360,7 +360,7 @@ Item { } MouseRegion { anchors.fill: reload - onClicked: { MyWebView.reload.trigger() } + onClicked: { webView.reload.trigger() } } Item { id: forwardbutton @@ -383,13 +383,13 @@ Item { states: [ State { name: "Enabled" - when: MyWebView.forward.enabled==true + when: webView.forward.enabled==true PropertyChanges { target: forward_e; opacity: 1 } PropertyChanges { target: forward_d; opacity: 0 } }, State { name: "Disabled" - when: MyWebView.forward.enabled==false + when: webView.forward.enabled==false PropertyChanges { target: forward_e; opacity: 0 } PropertyChanges { target: forward_d; opacity: 1 } } @@ -405,7 +405,7 @@ Item { ] MouseRegion { anchors.fill: parent - onClicked: { if (MyWebView.forward.enabled) MyWebView.forward.trigger() } + onClicked: { if (webView.forward.enabled) webView.forward.trigger() } } } } -- cgit v0.12 From d96392b83aab8b5b9bb5e951729dba938396e28b 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. --- 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 9d2de4a1aa26b4a19a6ffb4dad7a2d8ad06163d9 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 6 Oct 2009 13:33:05 +1000 Subject: Test icon() property. --- tests/auto/declarative/qfxwebview/data/basic.html | 2 +- tests/auto/declarative/qfxwebview/data/basic.png | Bin 0 -> 3961 bytes tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp | 7 +++++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qfxwebview/data/basic.png diff --git a/tests/auto/declarative/qfxwebview/data/basic.html b/tests/auto/declarative/qfxwebview/data/basic.html index 254317c..c262f12 100644 --- a/tests/auto/declarative/qfxwebview/data/basic.html +++ b/tests/auto/declarative/qfxwebview/data/basic.html @@ -1,6 +1,6 @@ Basic - + diff --git a/tests/auto/declarative/qfxwebview/data/basic.png b/tests/auto/declarative/qfxwebview/data/basic.png new file mode 100644 index 0000000..35717cc Binary files /dev/null and b/tests/auto/declarative/qfxwebview/data/basic.png differ diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp index 834c07f..dc124ce 100644 --- a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp +++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp @@ -72,8 +72,8 @@ void tst_qfxwebview::testBasicProperties() QVERIFY(wv != 0); QTRY_COMPARE(wv->progress(), 1.0); QCOMPARE(wv->title(),QString("Basic")); - wv->icon().save("test.png"); - //QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.ico")); + QTRY_COMPARE(wv->icon().width(), 48); + QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png")); QCOMPARE(wv->statusText(),QString("")); QFile htmlfile(SRCDIR "/data/basic.html"); QVERIFY(htmlfile.open(QIODevice::ReadOnly)); @@ -83,6 +83,9 @@ void tst_qfxwebview::testBasicProperties() expectedhtml.replace(QRegExp("\\s+"),""); QCOMPARE(actualhtml____,expectedhtml); // same, ignoring whitespace QCOMPARE(wv->width(), 123.0); + QCOMPARE(wv->webPageWidth(), 0); + QCOMPARE(wv->preferredWidth(), 0); + QCOMPARE(wv->zoomFactor(), 1.0); QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->status(), QFxWebView::Ready); QVERIFY(wv->reloadAction()); -- cgit v0.12 From a5589d34ec38992d4cc58861183d58f6f20af861 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. --- 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 44ad2433eae7dce70a797aa1f7055058a2558a74 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 6 Oct 2009 13:37:26 +1000 Subject: Some docs on data models. --- doc/src/declarative/binding.qdoc | 5 ++- doc/src/declarative/qmlmodels.qdoc | 61 +++++++++++++++++++++++++++++++ doc/src/declarative/qtdeclarative.qdoc | 1 + src/declarative/fx/qfxgridview.cpp | 2 + src/declarative/fx/qfxlistview.cpp | 2 + src/declarative/fx/qfxpathview.cpp | 2 + src/declarative/fx/qfxrepeater.cpp | 2 + src/declarative/fx/qfxvisualitemmodel.cpp | 6 ++- src/declarative/util/qmllistaccessor.cpp | 2 - 9 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 doc/src/declarative/qmlmodels.qdoc diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc index 37b4c97..e6835ee 100644 --- a/doc/src/declarative/binding.qdoc +++ b/doc/src/declarative/binding.qdoc @@ -38,7 +38,8 @@ The QML mechanisms of data binding can also be used to bind Qt C++ objects. The data binding framework is based on Qt's property system (see the Qt documentation for more details on this system). If a binding is meant to be dynamic (where changes in one object are reflected in another object), \c NOTIFY must be specified for the property being tracked. If \c NOTIFY is not specified, any binding to that property will be an 'intialization' binding (the tracking object will be updated only once with the initial value of the tracked object). -Relevant items can also be bound to the contents of a Qt model. For example, ListView can make use of data from a QListModelInterface-derived model. (QListModelInterface is part of the next generation Model/View architecture being developed for Qt.) +Relevant items can also be bound to the contents of a Qt model. +For example, ListView can make use of data from a QAbstractItemModel-derived model. \section1 Passing Data Between C++ and QML @@ -107,4 +108,6 @@ Binding { target: screen; property: "brightness"; value: slider.value } The \l QBindableMap class provides a convenient way to make data visible to the bind engine. +C++ \l {qmlmodels}{Data Models} may also be provided to QML. + */ diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc new file mode 100644 index 0000000..4712de1 --- /dev/null +++ b/doc/src/declarative/qmlmodels.qdoc @@ -0,0 +1,61 @@ +/*! +\page qmlmodels.html +\target qmlmodels +\title Data Models + +Some QML Items use Data Models to provide the data to be displayed. +These items typically require a \e delegate component that +creates an instance for each item in the model. Models may be static, or +have items modified, inserted, removed or moved dynamically. + +Data is provided to the delegate via named data roles which the +delegate may bind to. A special \e index role containing the +index of the item in the model is also available. Models that do +not have named roles will have the data provided via the \e modelData +role. The \e modelData role is also provided for Models that have +only one role. In this case the \e modelData role contains the same +data as the named role. + +There are a number of QML elements that operate using data models: + +\list +\o ListView +\o GridView +\o PathView +\o \l {qml-repeater}{Repeater} +\endlist + +QML supports several types of data model, which may be provided by QML +or C++ (via QmlContext::setContextProperty(), for example). + +\section1 QML Data Models + +\list +\o ListModel is a simple hierarchy of elements specified in QML. The +available roles are specified by the \l ListElement properties. +\o XmlListModel allows construction of a model from an XML data source. The roles +are specified via the \l XmlRole element. +\o VisualItemModel allows QML items to be provided as a model. This model contains +both the data and delegate (its child items). This model does not provide any roles. +\endlist + + +\section1 C++ Data Models + +\list +\o QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method. +\o QStringList provides the contents of the list via the \e modelData role. +\o QList provides the properties of the objects in the list as roles. +\endlist + + +\section1 Other Data Models + +\list +\o An Integer specifies a model containing the integer number of elements. +There are no data roles. +\o An Object Instance specifies a model with a single Object element. The +properties of the object are provided as roles. +\endlist + +*/ diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 460819a..06cba15 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -71,6 +71,7 @@ Core QML Features: \list \o \l {binding}{Data Binding} + \o \l {qmlmodels}{Data Models} \o \l {anchor-layout}{Layout Anchors} \o \l {qmlanimation}{Animation} \o \l {qmlmodules}{Modules} diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 3bfc799..9aa1198 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -710,6 +710,8 @@ QFxGridView::~QFxGridView() for the view. For large or dynamic datasets the model is usually provided by a C++ model object. The C++ model object must be a \l {QAbstractItemModel} subclass, a VisualModel, or a simple list. + + \sa {qmlmodels}{Data Models} */ QVariant QFxGridView::model() const { diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 71fa2ea..501b4df 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -876,6 +876,8 @@ QFxListView::~QFxListView() Models can also be created directly in QML, using a \l{ListModel}, \l{XmlListModel} or \l{VisualItemModel}. + + \sa {qmlmodels}{Data Models} */ QVariant QFxListView::model() const { diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 86bc9a2..b127f39 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -140,6 +140,8 @@ QFxPathView::~QFxPathView() The model provides a set of data that is used to create the items for the view. For large or dynamic datasets the model is usually provided by a C++ model object. Models can also be created directly in XML, using the ListModel element. + + \sa {qmlmodels}{Data Models} */ QVariant QFxPathView::model() const { diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 063bd1f..182dcc7 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -143,6 +143,8 @@ QFxRepeater::~QFxRepeater() based on the order they are created. Models can also be created directly in QML, using a \l{ListModel} or \l{XmlListModel}. + + \sa {qmlmodels}{Data Models} */ QVariant QFxRepeater::model() const { diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 45166de..fb1cfcf 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -132,7 +132,11 @@ public: \brief The VisualItemModel allows items to be provided to a view. The children of the VisualItemModel are provided in a model which - can be used in a view. An item can determine its index within the + can be used in a view. Note that no delegate should be + provided to a view since the VisualItemModel contains the + visual delegate (items). + + An item can determine its index within the model via the VisualItemModel.index attached property. The example below places three colored rectangles in a ListView. diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index ef21ebf..578646b 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -76,7 +76,6 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine) } else if (d.type() == QMetaType::QVariantList) { m_type = VariantList; } else if (d.canConvert(QVariant::Int)) { - qDebug() << "integer"; m_type = Integer; } else if (d.type() != QVariant::UserType) { m_type = Instance; @@ -90,7 +89,6 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine) (enginePrivate && enginePrivate->isQmlList(d.userType()))) { m_type = QmlList; } else if (QmlMetaType::isList(d.userType())) { - qDebug() << "list"; m_type = QList; } else { m_type = Invalid; -- cgit v0.12 From 43199af242918b3c77bb47bdcc3ec60f8236b0d3 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 6 Oct 2009 14:05:40 +1000 Subject: lowercase ids --- examples/declarative/anchors/anchor-changes.qml | 18 ++--- examples/declarative/aspectratio/face_fit.qml | 6 +- .../declarative/aspectratio/face_fit_animated.qml | 10 +-- .../declarative/aspectratio/scale_and_crop.qml | 6 +- .../aspectratio/scale_and_crop_simple.qml | 6 +- .../declarative/aspectratio/scale_and_sidecrop.qml | 6 +- examples/declarative/aspectratio/scale_to_fit.qml | 6 +- .../aspectratio/scale_to_fit_simple.qml | 6 +- examples/declarative/behaviours/MyRect.qml | 4 +- examples/declarative/behaviours/test.qml | 4 +- .../declarative/border-image/MyBorderImage.qml | 26 ++++---- examples/declarative/border-image/animated.qml | 2 +- examples/declarative/border-image/borders.qml | 2 +- examples/declarative/border-image/example.qml | 2 +- examples/declarative/clock/Clock.qml | 16 ++--- examples/declarative/clock/display.qml | 2 +- examples/declarative/dial/DialLibrary/Dial.qml | 13 ++-- examples/declarative/dial/dial.qml | 6 +- examples/declarative/easing/easing.qml | 24 +++---- examples/declarative/effects/test.qml | 20 +++--- examples/declarative/extending/binding/example.qml | 18 ++--- examples/declarative/fillmode/fillmode.qml | 14 ++-- examples/declarative/flowview/FlickrView.qml | 22 +++--- examples/declarative/flowview/flowview.qml | 78 +++++++++++----------- examples/declarative/focusscope/test.qml | 24 +++---- examples/declarative/focusscope/test3.qml | 18 ++--- examples/declarative/focusscope/test4.qml | 24 +++---- examples/declarative/follow/follow.qml | 30 ++++----- examples/declarative/follow/pong.qml | 44 ++++++------ examples/declarative/fonts/fonts.qml | 42 ++++++------ .../listview/content/ClickAutoRepeating.qml | 17 +++-- .../declarative/listview/content/MediaButton.qml | 34 +++++----- examples/declarative/listview/dynamic.qml | 42 ++++++------ examples/declarative/listview/highlight.qml | 18 ++--- examples/declarative/listview/itemlist.qml | 20 +++--- examples/declarative/listview/listview.qml | 23 +++---- examples/declarative/listview/recipes.qml | 6 +- examples/declarative/listview/sections.qml | 28 ++++---- examples/declarative/loader/Browser.qml | 52 +++++++-------- examples/declarative/loader/Button.qml | 10 +-- examples/declarative/scrollbar/ScrollBar.qml | 12 ++-- examples/declarative/scrollbar/display.qml | 34 +++++----- examples/declarative/slideswitch/Switch.qml | 38 +++++------ examples/declarative/smooth/GradientRect.qml | 10 +-- examples/declarative/smooth/MyRect.qml | 8 +-- examples/declarative/snow/ImageBatch.qml | 26 ++++---- examples/declarative/snow/Loading.qml | 4 +- examples/declarative/snow/create.js | 6 +- examples/declarative/snow/snow.qml | 24 +++---- examples/declarative/states/states.qml | 10 +-- .../tutorials/helloworld/t1/tutorial1.qml | 6 +- .../declarative/tutorials/helloworld/t2/Cell.qml | 6 +- .../tutorials/helloworld/t2/tutorial2.qml | 10 +-- .../declarative/tutorials/helloworld/t3/Cell.qml | 6 +- .../tutorials/helloworld/t3/tutorial3.qml | 16 ++--- examples/declarative/velocity/Day.qml | 32 ++++----- examples/declarative/velocity/velocity.qml | 10 +-- examples/declarative/webview/autosize.qml | 19 +++--- .../declarative/webview/content/SpinSquare.qml | 12 ++-- examples/declarative/webview/newwindows.qml | 16 ++--- examples/declarative/webview/qml-in-html.qml | 6 +- examples/declarative/webview/transparent.qml | 6 +- examples/declarative/xmldata/daringfireball.qml | 6 +- examples/declarative/xmldata/yahoonews.qml | 24 +++---- 64 files changed, 544 insertions(+), 552 deletions(-) diff --git a/examples/declarative/anchors/anchor-changes.qml b/examples/declarative/anchors/anchor-changes.qml index 8996439..f6fd35d 100644 --- a/examples/declarative/anchors/anchor-changes.qml +++ b/examples/declarative/anchors/anchor-changes.qml @@ -1,24 +1,24 @@ import Qt 4.6 Item { - id: Window + id: window width: 200; height: 450 Rectangle { - id: TitleBar; color: "Gray" + id: titleBar; color: "Gray" anchors.top: parent.top; height: 50 width: parent.width } Rectangle { - id: StatusBar; color: "Gray" + id: statusBar; color: "Gray" height: 50; anchors.bottom: parent.bottom width: parent.width } Rectangle { - id: Content - anchors.top: TitleBar.bottom; anchors.bottom: StatusBar.top + id: content + anchors.top: titleBar.bottom; anchors.bottom: statusBar.top width: parent.width Text { text: "Top"; anchors.top: parent.top } @@ -26,16 +26,16 @@ Item { } MouseRegion { - anchors.fill: Content - onPressed: Window.state = "FullScreen" - onReleased: Window.state = "" + anchors.fill: content + onPressed: window.state = "FullScreen" + onReleased: window.state = "" } states : State { name: "FullScreen" //! [0] AnchorChanges { - target: Content; top: Window.top; bottom: Window.bottom + target: content; top: window.top; bottom: window.bottom } //! [0] } diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 8d38cca..3d1451c 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -8,13 +8,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 9d63e69..f004a6c 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -6,19 +6,19 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 scale: SpringFollow { - source: Math.max(Math.min(Face.parent.width/Face.width*1.333,Face.parent.height/Face.height), - Math.min(Face.parent.width/Face.width,Face.parent.height/Face.height*1.333)) + source: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height), + Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333)) spring: 1 damping: 0.05 } diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 3cace8d..2c9477e 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -4,13 +4,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml index 26758e6..9cc9c19 100644 --- a/examples/declarative/aspectratio/scale_and_crop_simple.qml +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" fillMode: "PreserveAspectCrop" anchors.fill: parent diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index 18cc110..67c7e29 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 7450ea4..c4efc29 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index dcccd69..f7fcd8b 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Face.width - height: Face.height + width: face.width + height: face.height color: "gray" clip: true Image { - id: Face + id: face source: "pics/face.png" fillMode: "PreserveAspectFit" anchors.fill: parent diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml index fca1f70..a272e1f 100644 --- a/examples/declarative/behaviours/MyRect.qml +++ b/examples/declarative/behaviours/MyRect.qml @@ -5,9 +5,9 @@ Rectangle { border.color: "black" width: 100 height: 100 - id: Page + id: page MouseRegion { anchors.fill: parent - onClicked: { bluerect.parent = Page; bluerect.x=0 } + onClicked: { bluerect.parent = page; bluerect.x=0 } } } diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml index 1dd0658..a15d05d 100644 --- a/examples/declarative/behaviours/test.qml +++ b/examples/declarative/behaviours/test.qml @@ -4,10 +4,10 @@ Rectangle { color: "lightsteelblue" width: 800 height: 600 - id: Page + id: page MouseRegion { anchors.fill: parent - onClicked: { bluerect.parent = Page; bluerect.x = mouseX; } + onClicked: { bluerect.parent = page; bluerect.x = mouseX; } } MyRect { color: "green" diff --git a/examples/declarative/border-image/MyBorderImage.qml b/examples/declarative/border-image/MyBorderImage.qml index 395b648..d64bfb2 100644 --- a/examples/declarative/border-image/MyBorderImage.qml +++ b/examples/declarative/border-image/MyBorderImage.qml @@ -3,35 +3,35 @@ import Qt 4.6 Item { property var horizontalMode : BorderImage.Stretch property var verticalMode : BorderImage.Stretch - property alias source: MyImage.source + property alias source: image.source property int minWidth property int minHeight property int maxWidth property int maxHeight property int margin - id: Container + id: container width: 240; height: 240 BorderImage { - id: MyImage; x: Container.width / 2 - width / 2; y: Container.height / 2 - height / 2 + id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 width: SequentialAnimation { running: true; repeat: true - NumberAnimation { from: Container.minWidth; to: Container.maxWidth; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: Container.maxWidth; to: Container.minWidth; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"} + NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" } } height: SequentialAnimation { running: true; repeat: true - NumberAnimation { from: Container.minHeight; to: Container.maxHeight; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: Container.maxHeight; to: Container.minHeight; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"} + NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } } - horizontalTileMode: Container.horizontalMode - verticalTileMode: Container.verticalMode - border.top: Container.margin - border.left: Container.margin - border.bottom: Container.margin - border.right: Container.margin + horizontalTileMode: container.horizontalMode + verticalTileMode: container.verticalMode + border.top: container.margin + border.left: container.margin + border.bottom: container.margin + border.right: container.margin } } diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml index b34753f..aaaf495 100644 --- a/examples/declarative/border-image/animated.qml +++ b/examples/declarative/border-image/animated.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - id: Page + id: page color: "white" width: 1030; height: 540 diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml index 73758f2..e90abe6 100644 --- a/examples/declarative/border-image/borders.qml +++ b/examples/declarative/border-image/borders.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - id: Page + id: page color: "white" width: 520; height: 280 diff --git a/examples/declarative/border-image/example.qml b/examples/declarative/border-image/example.qml index a0b02b7..25c19d9 100644 --- a/examples/declarative/border-image/example.qml +++ b/examples/declarative/border-image/example.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - id: Page + id: page color: "white" width: 520; height: 280 diff --git a/examples/declarative/clock/Clock.qml b/examples/declarative/clock/Clock.qml index 6064dd4..a061488 100644 --- a/examples/declarative/clock/Clock.qml +++ b/examples/declarative/clock/Clock.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: Clock + id: clock width: 200; height: 200 property var time property var hours @@ -15,7 +15,7 @@ Item { } Timer { interval: 100; running: true; repeat: true; triggeredOnStart: true - onTriggered: Clock.time = new Date() + onTriggered: clock.time = new Date() } Image { source: "background.png" } @@ -25,13 +25,13 @@ Item { source: "hour.png" smooth: true transform: Rotation { - id: HourRotation + id: hourRotation origin.x: 4; origin.y: 45 angle: 0 angle: SpringFollow { spring: 2 damping: .2 - source: Clock.hours * 50 * 3 + Clock.minutes / 2 + source: clock.hours * 50 * 3 + clock.minutes / 2 } } } @@ -41,13 +41,13 @@ Item { source: "minute.png" smooth: true transform: Rotation { - id: MinuteRotation + id: minuteRotation origin.x: 4; origin.y: 70 angle: 0 angle: SpringFollow { spring: 2 damping: .2 - source: Clock.minutes * 6 + source: clock.minutes * 6 } } } @@ -57,14 +57,14 @@ Item { source: "second.png" smooth: true transform: Rotation { - id: SecondRotation + id: secondRotation origin.x: 2; origin.y: 60 angle: 0 angle: SpringFollow { spring: 5 damping: .25 modulus: 360 - source: Clock.seconds * 6 + source: clock.seconds * 6 } } } diff --git a/examples/declarative/clock/display.qml b/examples/declarative/clock/display.qml index 59f4763..20e254d 100644 --- a/examples/declarative/clock/display.qml +++ b/examples/declarative/clock/display.qml @@ -3,5 +3,5 @@ import Qt 4.6 Rectangle { width: childrenRect.width height: childrenRect.height - Clock { id: Clock } + Clock { id: clock } } diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml index 1a163a8..c1e9770 100644 --- a/examples/declarative/dial/DialLibrary/Dial.qml +++ b/examples/declarative/dial/DialLibrary/Dial.qml @@ -1,12 +1,12 @@ import Qt 4.6 Item { - id: Root + id: root property real value : 0 width: 210; height: 210 - Image { id: Background; source: "background.png" } + Image { source: "background.png" } Image { x: 93 @@ -14,23 +14,22 @@ Item { source: "needle_shadow.png" transform: Rotation { origin.x: 11; origin.y: 67 - angle: NeedleRotation.angle + angle: needleRotation.angle } } Image { - id: Needle + id: needle x: 95; y: 33 smooth: true source: "needle.png" transform: Rotation { - id: NeedleRotation + id: needleRotation origin.x: 7; origin.y: 65 angle: -130 angle: SpringFollow { - id: MyFollow spring: 1.4 damping: .15 - source: Math.min(Math.max(-130, Root.value*2.2 - 130), 133) + source: Math.min(Math.max(-130, root.value*2.2 - 130), 133) } } } diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml index 472ac66..c7baf25 100644 --- a/examples/declarative/dial/dial.qml +++ b/examples/declarative/dial/dial.qml @@ -6,10 +6,10 @@ Rectangle { width: 210; height: 240 // Dial with a slider to adjust it - Dial { id: Dial; value: Slider.x-2 } + Dial { id: dial; value: slider.x-2 } Rectangle { - anchors.top: Dial.bottom + anchors.top: dial.bottom x: 20; width: 160; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "steelblue" } @@ -17,7 +17,7 @@ Rectangle { } radius: 8; opacity: 0.7; smooth: true Rectangle { - id: Slider + id: slider x: 2; y: 2; width: 30; height: 12 radius: 6; smooth: true gradient: Gradient { diff --git a/examples/declarative/easing/easing.qml b/examples/declarative/easing/easing.qml index 1909e00..23d7b29 100644 --- a/examples/declarative/easing/easing.qml +++ b/examples/declarative/easing/easing.qml @@ -1,13 +1,13 @@ import Qt 4.6 Rectangle { - id: Window + id: window width: 640 - height: Layout.height + height: layout.height color: "white" ListModel { - id: EasingTypes + id: easingTypes ListElement { type: "easeLinear" } ListElement { type: "easeInQuad" } ListElement { type: "easeOutQuad" } @@ -50,23 +50,23 @@ Rectangle { ListElement { type: "easeInOutBounce" } ListElement { type: "easeOutInBounce" } } - + Column { - id: Layout - anchors.left: Window.left - anchors.right: Window.right + id: layout + anchors.left: window.left + anchors.right: window.right Repeater { - model: EasingTypes + model: easingTypes Component { Text { text: type height: 18 font.italic: true x: SequentialAnimation { - id: Anim + id: anim NumberAnimation { from: 0 - to: Window.width / 2 + to: window.width / 2 easing: type duration: 1000 } @@ -75,14 +75,14 @@ Rectangle { } NumberAnimation { to: 0 - from: Window.width / 2 + from: window.width / 2 easing: type duration: 1000 } } children: [ MouseRegion { - onClicked: { Anim.running=true } + onClicked: { anim.running=true } anchors.fill: parent } ] diff --git a/examples/declarative/effects/test.qml b/examples/declarative/effects/test.qml index ad03ef9..83bfde2 100644 --- a/examples/declarative/effects/test.qml +++ b/examples/declarative/effects/test.qml @@ -9,10 +9,10 @@ Rectangle { source: "pic.jpg" effect: Blur { - blurRadius: NumberAnimation { id: BS; from: 0; to: 10; duration: 200; repeat: true } + blurRadius: NumberAnimation { id: blur; from: 0; to: 10; duration: 200; repeat: true } } - MouseRegion { anchors.fill: parent; onClicked: BS.running = !BS.running } + MouseRegion { anchors.fill: parent; onClicked: blur.running = !blur.running } Text { color: "white"; text: "Blur" } } @@ -39,11 +39,11 @@ Rectangle { source: "pic.jpg" y: 300 - effect: Pixelize { - pixelSize: NumberAnimation { id: PS; from: 0; to: 10; duration: 200; repeat: true } + effect: Pixelize { + pixelSize: NumberAnimation { id: pixelize; from: 0; to: 10; duration: 200; repeat: true } } - MouseRegion { anchors.fill: parent; onClicked: PS.running = !PS.running } + MouseRegion { anchors.fill: parent; onClicked: pixelize.running = !pixelize.running } Text { color: "white"; text: "Pixelize" } } @@ -54,13 +54,13 @@ Rectangle { x: 200 y: 300 - effect: DropShadow { + effect: DropShadow { blurRadius: 3 offset.x: 3 - offset.y: NumberAnimation { id: DS; from: 0; to: 10; duration: 200; repeat: true; } + offset.y: NumberAnimation { id: dropShadow; from: 0; to: 10; duration: 200; repeat: true; } } - MouseRegion { anchors.fill: parent; onClicked: DS.running = !DS.running } + MouseRegion { anchors.fill: parent; onClicked: dropShadow.running = !dropShadow.running } Text { color: "white"; text: "DropShadow" } } @@ -74,10 +74,10 @@ Rectangle { effect: Bloom { blurRadius: 3 brightness: 128 - strength: NumberAnimation { id: BLS; from: 0; to: 1; duration: 200; repeat: true; } + strength: NumberAnimation { id: bloom; from: 0; to: 1; duration: 200; repeat: true; } } - MouseRegion { anchors.fill: parent; onClicked: BLS.running = !BLS.running } + MouseRegion { anchors.fill: parent; onClicked: bloom.running = !bloom.running } Text { color: "white"; text: "Bloom" } } diff --git a/examples/declarative/extending/binding/example.qml b/examples/declarative/extending/binding/example.qml index 1651b7a..352bb70 100644 --- a/examples/declarative/extending/binding/example.qml +++ b/examples/declarative/extending/binding/example.qml @@ -2,9 +2,9 @@ import People 1.0 // ![0] BirthdayParty { - id: TheParty + id: theParty - speaker: HappyBirthday { name: TheParty.celebrant.name } + speaker: HappyBirthday { name: theParty.celebrant.name } celebrant: Boy { name: "Bob Jones" @@ -14,22 +14,22 @@ BirthdayParty { onPartyStarted: print("This party started rockin' at " + time); - Boy { - name: "Joan Hodges" + Boy { + name: "Joan Hodges" BirthdayParty.rsvp: "2009-07-06" shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } } - Boy { - name: "Jack Smith" + Boy { + name: "Jack Smith" shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } } - Girl { - name: "Anne Brown" + Girl { + name: "Anne Brown" BirthdayParty.rsvp: "2009-07-01" shoe.size: 7 shoe.color: "red" shoe.brand: "Marc Jacobs" - shoe.price: 699.99 + shoe.price: 699.99 } // ![1] diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index 94b0782..0fdacbf 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -8,26 +8,26 @@ Image { running: true repeat: true PropertyAction { value: "Stretch" } - PropertyAction { target: Label; property: "text"; value: "Stretch" } + PropertyAction { target: label; property: "text"; value: "Stretch" } PauseAnimation { duration: 1000 } PropertyAction { value: "PreserveAspectFit" } - PropertyAction { target: Label; property: "text"; value: "PreserveAspectFit" } + PropertyAction { target: label; property: "text"; value: "PreserveAspectFit" } PauseAnimation { duration: 1000 } PropertyAction { value: "PreserveAspectCrop" } - PropertyAction { target: Label; property: "text"; value: "PreserveAspectCrop" } + PropertyAction { target: label; property: "text"; value: "PreserveAspectCrop" } PauseAnimation { duration: 1000 } PropertyAction { value: "Tile" } - PropertyAction { target: Label; property: "text"; value: "Tile" } + PropertyAction { target: label; property: "text"; value: "Tile" } PauseAnimation { duration: 1000 } PropertyAction { value: "TileHorizontally" } - PropertyAction { target: Label; property: "text"; value: "TileHorizontally" } + PropertyAction { target: label; property: "text"; value: "TileHorizontally" } PauseAnimation { duration: 1000 } PropertyAction { value: "TileVertically" } - PropertyAction { target: Label; property: "text"; value: "TileVertically" } + PropertyAction { target: label; property: "text"; value: "TileVertically" } PauseAnimation { duration: 1000 } } Text { - id: Label + id: label font.pointSize: 24 color: "blue" style: "Outline" diff --git a/examples/declarative/flowview/FlickrView.qml b/examples/declarative/flowview/FlickrView.qml index 1cdb132..b73ae1a 100644 --- a/examples/declarative/flowview/FlickrView.qml +++ b/examples/declarative/flowview/FlickrView.qml @@ -1,14 +1,14 @@ import Qt 4.6 -Rectangle { - radius: 5; - border.width: 1; - width:400; - height: 120; - color: background; +Rectangle { + radius: 5; + border.width: 1; + width:400; + height: 120; + color: background; XmlListModel { - id: FeedModel + id: feedModel source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2" query: "/rss/channel/item" namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" @@ -31,12 +31,12 @@ Rectangle { width: parent.width height: 86 y: 17 - model: FeedModel - delegate: - Item { width: 90; height: 86 + model: feedModel + delegate: + Item { width: 90; height: 86 Rectangle { anchors.centerIn: parent - width: 86; height: 86; + width: 86; height: 86; color: "white"; radius: 5 Image { source: imagePath; x: 5; y: 5 } } diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml index 85c20d9..f6b042d 100644 --- a/examples/declarative/flowview/flowview.qml +++ b/examples/declarative/flowview/flowview.qml @@ -6,34 +6,34 @@ Rectangle { color: "black" Rectangle { - id: MyPhone + id: myPhone transformOrigin: "Center" anchors.centerIn: parent width: 800 height: 480 clip: true - states: State { + states: State { name: "rotated" - PropertyChanges { target: MyListView; z: 2 } - PropertyChanges { target: TopBar; y: -30 } - PropertyChanges { target: BottomBar; y: 480 } - PropertyChanges { target: LeftBar; x: 0 } - PropertyChanges { target: RightBar; x: 770 } + PropertyChanges { target: myListView; z: 2 } + PropertyChanges { target: topBar; y: -30 } + PropertyChanges { target: bottomBar; y: 480 } + PropertyChanges { target: leftBar; x: 0 } + PropertyChanges { target: rightBar; x: 770 } } transitions: Transition { from: "" ; to: "rotated" reversible: true SequentialAnimation { - NumberAnimation { targets: [TopBar, BottomBar]; properties: "x,y"; easing: "easeInOutQuad" } - NumberAnimation { targets: [LeftBar, RightBar]; properties: "x,y"; easing: "easeInOutQuad"} + NumberAnimation { targets: [topBar, bottomBar]; properties: "x,y"; easing: "easeInOutQuad" } + NumberAnimation { targets: [leftBar, rightBar]; properties: "x,y"; easing: "easeInOutQuad"} } } color: "lightsteelblue" VisualDataModel { - id: Model + id: model model: ListModel { ListElement { background: "red"; weblet: "RoundedRect.qml" } ListElement { background: "yellow"; weblet: "RoundedRect.qml" } @@ -43,41 +43,41 @@ Rectangle { ListElement { background: "lightblue"; weblet: "RoundedRect.qml" } } delegate: Package { - Item { id: List; Package.name: "list"; width:120; height: 400; } - Item { id: GridItem; Package.name: "grid"; width:400; height: 120; } - Loader { id: MyContent; width:400; height: 120; source: weblet } + Item { id: list; Package.name: "list"; width:120; height: 400; } + Item { id: gridItem; Package.name: "grid"; width:400; height: 120; } + Loader { id: myContent; width:400; height: 120; source: weblet } StateGroup { states: [ - State { + State { name: "InList" - when: MyPhone.state == "rotated" - ParentChange { target: MyContent; parent: List } - PropertyChanges { target: MyContent; x: 120; y: 0; rotation: 90} + when: myPhone.state == "rotated" + ParentChange { target: myContent; parent: list } + PropertyChanges { target: myContent; x: 120; y: 0; rotation: 90} }, - State { + State { name: "InGrid" - when: MyPhone.state != "rotated" - ParentChange { target: MyContent; parent: GridItem } - PropertyChanges { target: MyContent; x: 0; y: 0; } + when: myPhone.state != "rotated" + ParentChange { target: myContent; parent: gridItem } + PropertyChanges { target: myContent; x: 0; y: 0; } } ] transitions: [ Transition { from: "*"; to: "InGrid" - SequentialAnimation { - ParentAction{} - PauseAnimation { duration: 50 * List.FlowView.column } - NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } - } + SequentialAnimation { + ParentAction{} + PauseAnimation { duration: 50 * list.FlowView.column } + NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } + } }, Transition { from: "*"; to: "InList" - SequentialAnimation { - ParentAction{} - PauseAnimation { duration: 50 * (GridItem.FlowView.row * 2 + GridItem.FlowView.column) } - NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } - } + SequentialAnimation { + ParentAction{} + PauseAnimation { duration: 50 * (gridItem.FlowView.row * 2 + gridItem.FlowView.column) } + NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } + } } ] } @@ -87,14 +87,14 @@ Rectangle { Item { FlowView { - id: MyListView + id: myListView vertical: true y: 40 x: 40 width: 800 height: 400 column: 1 - model: Model.parts.list + model: model.parts.list } FlowView { @@ -103,29 +103,29 @@ Rectangle { width: 800 height: 400 column: 2 - model: Model.parts.grid + model: model.parts.grid } } Rectangle { - id: TopBar + id: topBar width: 800 height: 30 } Rectangle { - id: BottomBar + id: bottomBar width: 800 height: 30 y: 450 } Rectangle { - id: LeftBar + id: leftBar x: -30 width: 30 height: 480 } Rectangle { - id: RightBar + id: rightBar x: 800 width: 30 height: 480 @@ -140,7 +140,7 @@ Rectangle { Text { text: "Switch" } MouseRegion { anchors.fill: parent - onClicked: if(MyPhone.state == "rotated") MyPhone.state=""; else MyPhone.state = "rotated"; + onClicked: if(myPhone.state == "rotated") myPhone.state=""; else myPhone.state = "rotated"; } } diff --git a/examples/declarative/focusscope/test.qml b/examples/declarative/focusscope/test.qml index 77ffb84..ab5a143 100644 --- a/examples/declarative/focusscope/test.qml +++ b/examples/declarative/focusscope/test.qml @@ -8,28 +8,28 @@ Rectangle { Keys.onDigit9Pressed: print("Error - Root") FocusScope { - id: MyScope + id: myScope focus: true Keys.onDigit9Pressed: print("Error - FocusScope") - + Rectangle { height: 120 width: 420 color: "transparent" border.width: 5 - border.color: MyScope.wantsFocus?"blue":"black" + border.color: myScope.wantsFocus?"blue":"black" Rectangle { - id: Item1 - x: 10; y: 10 + id: item1 + x: 10; y: 10 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" Keys.onDigit9Pressed: print("Top Left"); - KeyNavigation.right: Item2 - focus: true + KeyNavigation.right: item2 + focus: true Rectangle { width: 50; height: 50; anchors.centerIn: parent @@ -38,12 +38,12 @@ Rectangle { } Rectangle { - id: Item2 + id: item2 x: 310; y: 10 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" - KeyNavigation.left: Item1 + KeyNavigation.left: item1 Keys.onDigit9Pressed: print("Top Right"); Rectangle { @@ -52,20 +52,20 @@ Rectangle { } } } - KeyNavigation.down: Item3 + KeyNavigation.down: item3 } Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box indicates active focus\nUse arrow keys to navigate\nPress \"9\" to print currently focused item" } Rectangle { - id: Item3 + id: item3 x: 10; y: 300 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" Keys.onDigit9Pressed: print("Bottom Left"); - KeyNavigation.up: MyScope + KeyNavigation.up: myScope Rectangle { width: 50; height: 50; anchors.centerIn: parent diff --git a/examples/declarative/focusscope/test3.qml b/examples/declarative/focusscope/test3.qml index 8a53c3a..e5aa7b6 100644 --- a/examples/declarative/focusscope/test3.qml +++ b/examples/declarative/focusscope/test3.qml @@ -6,7 +6,7 @@ Rectangle { height: 600 ListModel { - id: Model + id: model ListElement { name: "1" } ListElement { name: "2" } ListElement { name: "3" } @@ -19,16 +19,16 @@ Rectangle { } Component { - id: VerticalDelegate + id: verticalDelegate FocusScope { - id: Root - width: 50; height: 50; + id: root + width: 50; height: 50; Keys.onDigit9Pressed: print("Error - " + name) - Rectangle { + Rectangle { focus: true Keys.onDigit9Pressed: print(name) - width: 50; height: 50; - color: Root.ListView.isCurrentItem?"red":"green" + width: 50; height: 50; + color: root.ListView.isCurrentItem?"red":"green" Text { text: name; anchors.centerIn: parent } } } @@ -37,8 +37,8 @@ Rectangle { ListView { width: 800; height: 50; orientation: "Horizontal" focus: true - model: Model - delegate: VerticalDelegate + model: model + delegate: verticalDelegate preferredHighlightBegin: 100 preferredHighlightEnd: 101 strictlyEnforceHighlightRange: true diff --git a/examples/declarative/focusscope/test4.qml b/examples/declarative/focusscope/test4.qml index f366543..5d4fe35 100644 --- a/examples/declarative/focusscope/test4.qml +++ b/examples/declarative/focusscope/test4.qml @@ -8,27 +8,27 @@ Rectangle { Keys.onDigit9Pressed: print("Error - Root") FocusScope { - id: MyScope + id: myScope Keys.onDigit9Pressed: print("Error - FocusScope") - + Rectangle { height: 120 width: 420 color: "transparent" border.width: 5 - border.color: MyScope.wantsFocus?"blue":"black" + border.color: myScope.wantsFocus?"blue":"black" Rectangle { - id: Item1 - x: 10; y: 10 + id: item1 + x: 10; y: 10 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" Keys.onDigit9Pressed: print("Error - Top Left"); - KeyNavigation.right: Item2 - focus: true + KeyNavigation.right: item2 + focus: true Rectangle { width: 50; height: 50; anchors.centerIn: parent @@ -37,12 +37,12 @@ Rectangle { } Rectangle { - id: Item2 + id: item2 x: 310; y: 10 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" - KeyNavigation.left: Item1 + KeyNavigation.left: item1 Keys.onDigit9Pressed: print("Error - Top Right"); Rectangle { @@ -51,20 +51,20 @@ Rectangle { } } } - KeyNavigation.down: Item3 + KeyNavigation.down: item3 } Text { x:100; y:170; text: "There should be no blue borders, or red squares.\nPressing \"9\" should do nothing.\nArrow keys should have no effect." } Rectangle { - id: Item3 + id: item3 x: 10; y: 300 width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" Keys.onDigit9Pressed: print("Error - Bottom Left"); - KeyNavigation.up: MyScope + KeyNavigation.up: myScope Rectangle { width: 50; height: 50; anchors.centerIn: parent diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml index 1f585e2..3e164f9 100644 --- a/examples/declarative/follow/follow.qml +++ b/examples/declarative/follow/follow.qml @@ -4,7 +4,7 @@ Rectangle { color: "#ffffff" width: 320; height: 240 Rectangle { - id: Rect + id: rect color: "#00ff00" y: 200; width: 60; height: 20 y: SequentialAnimation { @@ -24,43 +24,43 @@ Rectangle { // Velocity Rectangle { color: "#ff0000" - x: Rect.width; width: Rect.width; height: 20 + x: rect.width; width: rect.width; height: 20 y: 200 - y: SpringFollow { source: Rect.y; velocity: 200 } + y: SpringFollow { source: rect.y; velocity: 200 } } - Text { x: Rect.width; y: 220; text: "Velocity" } + Text { x: rect.width; y: 220; text: "Velocity" } // Spring Rectangle { color: "#ff0000" - x: Rect.width * 2; width: Rect.width/2; height: 20 + x: rect.width * 2; width: rect.width/2; height: 20 y: 200 - y: SpringFollow { source: Rect.y; spring: 1.0; damping: 0.2 } + y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2 } } Rectangle { color: "#880000" - x: Rect.width * 2.5; width: Rect.width/2; height: 20 + x: rect.width * 2.5; width: rect.width/2; height: 20 y: 200 - y: SpringFollow { source: Rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object + y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object } - Text { x: Rect.width * 2; y: 220; text: "Spring" } + Text { x: rect.width * 2; y: 220; text: "Spring" } // Follow mouse MouseRegion { - id: Mouse + id: mouseRegion anchors.fill: parent Rectangle { - id: "Ball" + id: ball width: 20; height: 20 radius: 10 color: "#0000ff" - x: SpringFollow { id: "F1"; source: Mouse.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } - y: SpringFollow { id: "F2"; source: Mouse.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + x: SpringFollow { id: f1; source: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + y: SpringFollow { id: f2; source: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } states: [ State { name: "following" - when: !F1.inSync || !F2.inSync - PropertyChanges { target: Ball; color: "#ff0000" } + when: !f1.inSync || !f2.inSync + PropertyChanges { target: ball; color: "#ff0000" } } ] transitions: [ diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml index b51c0d0..10ded36 100644 --- a/examples/declarative/follow/pong.qml +++ b/examples/declarative/follow/pong.qml @@ -1,37 +1,37 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 640; height: 480 color: "#000000" // Make a ball to bounce Rectangle { // Add a property for the target y coordinate - property var targetY : Page.height-10 + property var targetY : page.height-10 property var direction : "right" - id: Ball + id: ball color: "#00ee00" x: 20; width: 20; height: 20; z: 1 // Move the ball to the right and back to the left repeatedly x: SequentialAnimation { running: true; repeat: true - NumberAnimation { to: Page.width-40; duration: 2000 } - PropertyAction { target: Ball; property: "direction"; value: "left" } + NumberAnimation { to: page.width-40; duration: 2000 } + PropertyAction { target: ball; property: "direction"; value: "left" } NumberAnimation { to: 20; duration: 2000 } - PropertyAction { target: Ball; property: "direction"; value: "right" } + PropertyAction { target: ball; property: "direction"; value: "right" } } // Make y follow the target y coordinate, with a velocity of 200 - y: SpringFollow { source: Ball.targetY; velocity: 200 } + y: SpringFollow { source: ball.targetY; velocity: 200 } // Detect the ball hitting the top or bottom of the view and bounce it onYChanged: { if (y <= 0) - targetY = Page.height-20; - else if (y >= Page.height-20) + targetY = page.height-20; + else if (y >= page.height-20) targetY = 0; } } @@ -39,31 +39,31 @@ Rectangle { // Place bats to the left and right of the view, following the y // coordinates of the ball. Rectangle { - id: LeftBat + id: leftBat color: "#00ee00" x: 2; width: 20; height: 90 y: SpringFollow { - source: Ball.y-45; velocity: 300 - enabled: Ball.direction == 'left' + source: ball.y-45; velocity: 300 + enabled: ball.direction == 'left' } } Rectangle { - id: RightBat + id: rightBat color: "#00ee00" - x: Page.width-22; width: 20; height: 90 + x: page.width-22; width: 20; height: 90 y: SpringFollow { - source: Ball.y-45; velocity: 300 - enabled: Ball.direction == 'right' + source: ball.y-45; velocity: 300 + enabled: ball.direction == 'right' } } // The rest, to make it look realistic, if neither ever scores... - Rectangle { color: "#00ee00"; x: Page.width/2-80; y: 0; width: 40; height: 60 } - Rectangle { color: "#000000"; x: Page.width/2-70; y: 10; width: 20; height: 40 } - Rectangle { color: "#00ee00"; x: Page.width/2+40; y: 0; width: 40; height: 60 } - Rectangle { color: "#000000"; x: Page.width/2+50; y: 10; width: 20; height: 40 } + Rectangle { color: "#00ee00"; x: page.width/2-80; y: 0; width: 40; height: 60 } + Rectangle { color: "#000000"; x: page.width/2-70; y: 10; width: 20; height: 40 } + Rectangle { color: "#00ee00"; x: page.width/2+40; y: 0; width: 40; height: 60 } + Rectangle { color: "#000000"; x: page.width/2+50; y: 10; width: 20; height: 40 } Repeater { - model: Page.height/20 - Rectangle { color: "#00ee00"; x: Page.width/2-5; y: index*20; width: 10; height: 10 } + model: page.height/20 + Rectangle { color: "#00ee00"; x: page.width/2-5; y: index*20; width: 10; height: 10 } } } diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml index f7ed494..4029f8b 100644 --- a/examples/declarative/fonts/fonts.qml +++ b/examples/declarative/fonts/fonts.qml @@ -4,62 +4,62 @@ Rectangle { property string myText: "Lorem ipsum dolor sit amet, consectetur adipisicing elit" width: 800; height: 600 - color: Palette.base + color: palette.base - SystemPalette { id: Palette; colorGroup: Qt.Active } + SystemPalette { id: palette; colorGroup: Qt.Active } - FontLoader { id: FixedFont; name: "Courier" } + FontLoader { id: fixedFont; name: "Courier" } - FontLoader { id: LocalFont; source: "fonts/Fontin-Bold.ttf" } + FontLoader { id: localFont; source: "fonts/Fontin-Bold.ttf" } /* A font by Jos Buivenga (exljbris) -> www.exljbris.nl */ - FontLoader { id: WebFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } - FontLoader { id: WebFont2; source: "http://wrong.address.org" } + FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + FontLoader { id: webFont2; source: "http://wrong.address.org" } Column { anchors.fill: parent anchors.leftMargin: 10; anchors.rightMargin: 10 Text { text: myText - color: Palette.windowText + color: palette.windowText width: parent.width; elide: "ElideRight" font.family: "Times" font.pointSize: 32 } Text { text: myText - color: Palette.windowText + color: palette.windowText width: parent.width; elide: "ElideRight" - font.family: FixedFont.name + font.family: fixedFont.name font.pointSize: 32 } Text { text: myText - color: Palette.windowText + color: palette.windowText width: parent.width; elide: "ElideRight" - font.family: LocalFont.name + font.family: localFont.name font.pointSize: 32 } Text { text: { - if (WebFont.status == 1) myText - else if (WebFont.status == 2) "Loading..." - else if (WebFont.status == 3) "Error loading font" + if (webFont.status == 1) myText + else if (webFont.status == 2) "Loading..." + else if (webFont.status == 3) "Error loading font" } - color: Palette.windowText + color: palette.windowText width: parent.width; elide: "ElideRight" - font.family: WebFont.name + font.family: webFont.name font.pointSize: 32 } Text { text: { - if (WebFont2.status == 1) myText - else if (WebFont2.status == 2) "Loading..." - else if (WebFont2.status == 3) "Error loading font" + if (webFont2.status == 1) myText + else if (webFont2.status == 2) "Loading..." + else if (webFont2.status == 3) "Error loading font" } - color: Palette.windowText + color: palette.windowText width: parent.width; elide: "ElideRight" - font.family: WebFont2.name + font.family: webFont2.name font.pointSize: 32 } } diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index 19dd6f6..f0e7df1 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: Page + id: page property int repeatdelay: 300 property int repeatperiod: 75 property bool pressed: false @@ -9,21 +9,20 @@ Item { signal released signal clicked pressed: SequentialAnimation { - id: AutoRepeat - PropertyAction { target: Page; property: "pressed"; value: true } - ScriptAction { script: Page.onPressed } - ScriptAction { script: Page.onClicked } + id: autoRepeat + PropertyAction { target: page; property: "pressed"; value: true } + ScriptAction { script: page.onPressed } + ScriptAction { script: page.onClicked } PauseAnimation { duration: repeatdelay } SequentialAnimation { repeat: true - ScriptAction { script: Page.onClicked } + ScriptAction { script: page.onClicked } PauseAnimation { duration: repeatperiod } } } MouseRegion { - id: MR anchors.fill: parent - onPressed: AutoRepeat.start() - onReleased: { AutoRepeat.stop(); parent.pressed = false; Page.released } + onPressed: autoRepeat.start() + onReleased: { autoRepeat.stop(); parent.pressed = false; page.released } } } diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index 3b0ef1e..1c88844 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -4,36 +4,32 @@ Item { property var text signal clicked - id: Container + id: container Image { - id: Normal + id: normal source: "pics/button.png" } Image { - id: Pressed + id: pressed source: "pics/button-pressed.png" opacity: 0 } MouseRegion { - id: ClickRegion - anchors.fill: Normal - onClicked: { Container.clicked(); } + id: clickRegion + anchors.fill: normal + onClicked: { container.clicked(); } } Text { font.bold: true color: "white" - anchors.centerIn: Normal - text: Container.text + anchors.centerIn: normal + text: container.text + } + width: normal.width + + states: State { + name: "Pressed" + when: clickRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } } - width: Normal.width - states: [ - State { - name: "Pressed" - when: ClickRegion.pressed == true - PropertyChanges { - target: Pressed - opacity: 1 - } - } - ] } diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 52c3c0b..4f8e483 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -6,7 +6,7 @@ Item { height: 500 ListModel { - id: FruitModel + id: fruitModel ListElement { name: "Apple" cost: 2.45 @@ -56,13 +56,13 @@ Item { } Component { - id: FruitDelegate + id: fruitDelegate Item { width: parent.width; height: 55 - Text { id: Label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: Cost.left; anchors.left:parent.left } - Text { id: Cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: ItemButtons.left } - Row { - anchors.top: Label.bottom + Text { id: label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: cost.left; anchors.left:parent.left } + Text { id: cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: itemButtons.left } + Row { + anchors.top: label.bottom spacing: 5 Repeater { model: attributes @@ -72,27 +72,27 @@ Item { } } Row { - id: ItemButtons + id: itemButtons anchors.right: parent.right width: childrenRect.width Image { source: "content/pics/add.png" - ClickAutoRepeating { id: ClickUp; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) } - scale: ClickUp.pressed ? 0.9 : 1 + ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Number(cost)+0.25) } + scale: clickUp.pressed ? 0.9 : 1 } Image { source: "content/pics/del.png" - ClickAutoRepeating { id: ClickDown; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) } - scale: ClickDown.pressed ? 0.9 : 1 + ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) } + scale: clickDown.pressed ? 0.9 : 1 } Image { source: "content/pics/trash.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.remove(index) } + MouseRegion { anchors.fill: parent; onClicked: fruitModel.remove(index) } } Column { width: childrenRect.width Image { source: "content/pics/moreUp.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.move(index,index-1,1) } + MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } } Image { source: "content/pics/moreDown.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.move(index,index+1,1) } + MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) } } } } @@ -100,23 +100,23 @@ Item { } ListView { - model: FruitModel - delegate: FruitDelegate + model: fruitModel + delegate: fruitDelegate anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - anchors.bottom: Buttons.top + anchors.bottom: buttons.top } Row { width: childrenRect.width height: childrenRect.height anchors.bottom: parent.bottom - id: Buttons + id: buttons Image { source: "content/pics/add.png" MouseRegion { anchors.fill: parent; onClicked: { - FruitModel.append({ + fruitModel.append({ "name":"Pizza Margarita", "cost":5.95, "attributes":[{"description": "Cheese"},{"description": "Tomato"}] @@ -127,7 +127,7 @@ Item { Image { source: "content/pics/add.png" MouseRegion { anchors.fill: parent; onClicked: { - FruitModel.insert(0,{ + fruitModel.insert(0,{ "name":"Pizza Supreme", "cost":9.95, "attributes":[{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}] @@ -136,7 +136,7 @@ Item { } } Image { source: "content/pics/trash.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.clear() } + MouseRegion { anchors.fill: parent; onClicked: fruitModel.clear() } } } } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index b6db453..be1f62d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -10,9 +10,9 @@ Rectangle { // Define a delegate component. A component will be // instantiated for each visible item in the list. Component { - id: PetDelegate + id: petDelegate Item { - id: Wrapper + id: wrapper width: 200; height: 50 Column { Text { text: 'Name: ' + name } @@ -24,8 +24,8 @@ Rectangle { states: [ State { name: "Current" - when: Wrapper.ListView.isCurrentItem - PropertyChanges { target: Wrapper; x: 10 } + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 10 } } ] transitions: [ @@ -41,17 +41,17 @@ Rectangle { // is set to false in the ListView so that we can control how the // highlight moves to the current item. Component { - id: PetHighlight + id: petHighlight Rectangle { width: 200; height: 50; color: "#FFFF88" - y: SpringFollow { source: List1.currentItem.y; spring: 3; damping: 0.1 } + y: SpringFollow { source: list1.currentItem.y; spring: 3; damping: 0.1 } } } ListView { - id: List1 + id: list1 width: 200; height: parent.height - model: MyPetsModel; delegate: PetDelegate - highlight: PetHighlight; highlightFollowsCurrentItem: false + model: MyPetsModel; delegate: petDelegate + highlight: petHighlight; highlightFollowsCurrentItem: false focus: true } } diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index 01781ec..6dfc90b 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -9,26 +9,26 @@ Rectangle { height: 320 VisualItemModel { - id: ItemModel + id: itemModel Rectangle { - height: View.height; width: View.width; color: "#FFFEF0" + height: view.height; width: view.width; color: "#FFFEF0" Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent } } Rectangle { - height: View.height; width: View.width; color: "#F0FFF7" + height: view.height; width: view.width; color: "#F0FFF7" Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent } } Rectangle { - height: View.height; width: View.width; color: "#F4F0FF" + height: view.height; width: view.width; color: "#F4F0FF" Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent } } } ListView { - id: View + id: view anchors.fill: parent anchors.bottomMargin: 30 - model: ItemModel + model: itemModel preferredHighlightBegin: 0 preferredHighlightEnd: 1 strictlyEnforceHighlightRange: true @@ -37,7 +37,7 @@ Rectangle { Rectangle { color: "gray" - anchors.top: View.bottom + anchors.top: view.bottom anchors.bottom: parent.bottom height: 30 width: 240 @@ -46,12 +46,12 @@ Rectangle { anchors.centerIn: parent spacing: 20 Repeater { - model: ItemModel.count + model: itemModel.count Rectangle { width: 5; height: 5 radius: 3 - MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: View.currentIndex = index } - color: View.currentIndex == index ? "blue" : "white" + MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index } + color: view.currentIndex == index ? "blue" : "white" } } } diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml index ac1cef1..98974fd 100644 --- a/examples/declarative/listview/listview.qml +++ b/examples/declarative/listview/listview.qml @@ -10,9 +10,8 @@ Rectangle { // Define a delegate component. A component will be // instantiated for each visible item in the list. Component { - id: PetDelegate + id: petDelegate Item { - id: Wrapper width: 200; height: 50 Column { Text { text: 'Name: ' + name } @@ -25,7 +24,7 @@ Rectangle { // Define a highlight component. Just one of these will be instantiated // by each ListView and placed behind the current item. Component { - id: PetHighlight + id: petHighlight Rectangle { color: "#FFFF88" } } @@ -50,25 +49,25 @@ Rectangle { // the third ListView's currentIndex. By flicking List3 with // the mouse, the current index of List1 will be changed. ListView { - id: List1 + id: list1 width: 200; height: parent.height - model: MyPetsModel; delegate: PetDelegate - highlight: PetHighlight; currentIndex: List3.currentIndex + model: MyPetsModel; delegate: petDelegate + highlight: petHighlight; currentIndex: list3.currentIndex focus: true } ListView { - id: List2 + id: list2 x: 200; width: 200; height: parent.height - model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight + model: MyPetsModel; delegate: petDelegate; highlight: petHighlight preferredHighlightBegin: 80 preferredHighlightEnd: 220 - currentIndex: List1.currentIndex + currentIndex: list1.currentIndex } ListView { - id: List3 + id: list3 x: 400; width: 200; height: parent.height - model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight - currentIndex: List1.currentIndex + model: MyPetsModel; delegate: petDelegate; highlight: petHighlight + currentIndex: list1.currentIndex preferredHighlightBegin: 125 preferredHighlightEnd: 126 strictlyEnforceHighlightRange: true diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 2148ef4..4ccb344 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -13,7 +13,7 @@ Rectangle { id: recipeDelegate Item { id: wrapper - width: List.width + width: list.width // Create a property to contain the visibility of the details. // We can bind multiple element's opacity to this one property, // rather than having a "PropertyChanges" line for each element we @@ -102,7 +102,7 @@ Rectangle { // Make details visible PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 } // Make the detailed view fill the entire list area - PropertyChanges { target: wrapper; height: List.height } + PropertyChanges { target: wrapper; height: list.height } // Move the list so that this item is at the top. PropertyChanges { target: wrapper.ListView.view; explicit: true; viewportY: wrapper.y } // Disallow flicking while we're in detailed view @@ -125,7 +125,7 @@ Rectangle { ] // The actual list ListView { - id: List + id: list model: Recipes; delegate: recipeDelegate anchors.fill: parent; clip: true } diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index ddb4931..6b1a589 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -12,32 +12,32 @@ Rectangle { // Define a delegate component that includes a separator for sections. Component { - id: PetDelegate + id: petDelegate Item { - id: Wrapper + id: wrapper width: 200 // My height is the combined height of the description and the section separator - height: Separator.height + Desc.height + height: separator.height + desc.height Rectangle { - id: Separator + id: separator color: "lightsteelblue" width: parent.width // Only show the section separator when we are the beginning of a new section // Note that for this to work nicely, the list must be ordered by section. - height: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 20 : 0 - opacity: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 1 : 0 + height: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0 + opacity: wrapper.ListView.prevSection != wrapper.ListView.section ? 1 : 0 Text { - text: Wrapper.ListView.section; font.bold: true + text: wrapper.ListView.section; font.bold: true x: 2; height: parent.height; verticalAlignment: 'AlignVCenter' } } Item { - id: Desc + id: desc x: 5 - height: Layout.height + 4 - anchors.top: Separator.bottom + height: layout.height + 4 + anchors.top: separator.bottom Column { - id: Layout + id: layout y: 2 Text { text: 'Name: ' + name } Text { text: 'Type: ' + type } @@ -49,7 +49,7 @@ Rectangle { // Define a highlight component. Just one of these will be instantiated // by each ListView and placed behind the current item. Component { - id: PetHighlight + id: petHighlight Rectangle { color: "#FFFF88" } @@ -60,8 +60,8 @@ Rectangle { width: 200 height: parent.height model: MyPetsModel - delegate: PetDelegate - highlight: PetHighlight + delegate: petDelegate + highlight: petHighlight // The sectionExpression is simply the size of the pet. // We use this to determine which section we are in above. sectionExpression: "size" diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index 6711de4..5f972f1 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -1,22 +1,22 @@ import Qt 4.6 Rectangle { - id: Root + id: root width: parent.width height: parent.height - color: Palette.base + color: palette.base FolderListModel { id: folders nameFilters: [ "*.qml" ] // folder: "E:" } - SystemPalette { id: Palette; colorGroup: Qt.Active } + SystemPalette { id: palette; colorGroup: Qt.Active } Component { - id: FolderDelegate + id: folderDelegate Rectangle { - id: Wrapper + id: wrapper function launch() { if (folders.isFolder(index)) { folders.folder = filePath; @@ -24,15 +24,15 @@ Rectangle { qmlLauncher.launch(filePath); } } - width: Root.width + width: root.width height: 32 color: "transparent" Rectangle { - id: Highlight; visible: false + id: highlight; visible: false anchors.fill: parent gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: Palette.highlight } - GradientStop { id: t2; position: 1.0; color: Palette.lighter(Palette.highlight) } + GradientStop { id: t1; position: 0.0; color: palette.highlight } + GradientStop { id: t2; position: 1.0; color: palette.lighter(palette.highlight) } } } Item { @@ -40,23 +40,23 @@ Rectangle { Image { source: "images/fileopen.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} } Text { - id: NameText + id: nameText anchors.fill: parent; verticalAlignment: "AlignVCenter" text: fileName; anchors.leftMargin: 32 font.pointSize: 10 - color: Palette.windowText + color: palette.windowText } MouseRegion { - id: Mouse + id: mouseRegion anchors.fill: parent onClicked: { launch() } } states: [ State { name: "pressed" - when: Mouse.pressed - PropertyChanges { target: Highlight; visible: true } - PropertyChanges { target: NameText; color: Palette.highlightedText } + when: mouseRegion.pressed + PropertyChanges { target: highlight; visible: true } + PropertyChanges { target: nameText; color: palette.highlightedText } } ] } @@ -70,43 +70,43 @@ Rectangle { } ListView { - id: View - anchors.top: TitleBar.bottom + id: view + anchors.top: titleBar.bottom anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: folders - delegate: FolderDelegate + delegate: folderDelegate highlight: Rectangle { color: "#FFFBAF" } clip: true focus: true Keys.onPressed: { if (event.key == Qt.Key_Return || event.key == Qt.Key_Select) { - View.currentItem.launch(); + view.currentItem.launch(); event.accepted = true; } } } Rectangle { - id: TitleBar + id: titleBar width: parent.width height: 32 - color: Palette.button; border.color: Palette.mid + color: palette.button; border.color: palette.mid Rectangle { - id: UpButton + id: upButton width: 30 - height: TitleBar.height - border.color: Palette.mid; color: "transparent" + height: titleBar.height + border.color: palette.mid; color: "transparent" MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) } Image { anchors.centerIn: parent; source: "images/up.png" } } Text { - anchors.left: UpButton.right; anchors.right: parent.right; height: parent.height + anchors.left: upButton.right; anchors.right: parent.right; height: parent.height anchors.leftMargin: 4; anchors.rightMargin: 4 - text: folders.folder; color: Palette.buttonText + text: folders.folder; color: palette.buttonText elide: "ElideLeft"; horizontalAlignment: "AlignRight"; verticalAlignment: "AlignVCenter" } } diff --git a/examples/declarative/loader/Button.qml b/examples/declarative/loader/Button.qml index d01a658..928ff06 100644 --- a/examples/declarative/loader/Button.qml +++ b/examples/declarative/loader/Button.qml @@ -1,16 +1,16 @@ import Qt 4.6 Rectangle { - id: Container + id: container property var text signal clicked - height: Text.height + 10 - width: Text.width + 20 + height: text.height + 10 + width: text.width + 20 border.width: 1 radius: 4 color: "grey" - MouseRegion { anchors.fill: parent; onClicked: Container.clicked() } - Text { id: Text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text } + MouseRegion { anchors.fill: parent; onClicked: container.clicked() } + Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text } } diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index b42563d..802b537 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: ScrollBar + id: scrollBar // The properties that define the scrollbar's state. // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% @@ -13,7 +13,7 @@ Item { // A light, semi-transparent background Rectangle { - id: Background + id: background radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) color: "white"; opacity: 0.3 anchors.fill: parent @@ -23,9 +23,9 @@ Item { opacity: 0.7 color: "black" radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) - x: orientation == 'Vertical' ? 1 : (ScrollBar.position * (ScrollBar.width-2) + 1) - y: orientation == 'Vertical' ? (ScrollBar.position * (ScrollBar.height-2) + 1) : 1 - width: orientation == 'Vertical' ? (parent.width-2) : (ScrollBar.pageSize * (ScrollBar.width-2)) - height: orientation == 'Vertical' ? (ScrollBar.pageSize * (ScrollBar.height-2)) : (parent.height-2) + x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) } } diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 0180bda..536a8b7 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -5,21 +5,21 @@ Rectangle { height: 480 // Create a flickable to view a large image. Flickable { - id: View + id: view anchors.fill: parent Image { - id: Picture + id: picture source: "pics/niagara_falls.jpg" } - viewportWidth: Picture.width - viewportHeight: Picture.height + viewportWidth: picture.width + viewportHeight: picture.height // Only show the scrollbars when the view is moving. states: [ State { name: "ShowBars" - when: View.moving - PropertyChanges { target: SBV; opacity: 1 } - PropertyChanges { target: SBH; opacity: 1 } + when: view.moving + PropertyChanges { target: verticalScrollBar; opacity: 1 } + PropertyChanges { target: horizontalScrollBar; opacity: 1 } } ] transitions: [ @@ -35,23 +35,23 @@ Rectangle { } // Attach scrollbars to the right and bottom edges of the view. ScrollBar { - id: SBV + id: verticalScrollBar opacity: 0 orientation: "Vertical" - position: View.visibleArea.yPosition - pageSize: View.visibleArea.heightRatio + position: view.visibleArea.yPosition + pageSize: view.visibleArea.heightRatio width: 12 - height: View.height-12 - anchors.right: View.right + height: view.height-12 + anchors.right: view.right } ScrollBar { - id: SBH + id: horizontalScrollBar opacity: 0 orientation: "Horizontal" - position: View.visibleArea.xPosition - pageSize: View.visibleArea.widthRatio + position: view.visibleArea.xPosition + pageSize: view.visibleArea.widthRatio height: 12 - width: View.width-12 - anchors.bottom: View.bottom + width: view.width-12 + anchors.bottom: view.bottom } } diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml index a778c1a..1620805 100644 --- a/examples/declarative/slideswitch/Switch.qml +++ b/examples/declarative/slideswitch/Switch.qml @@ -1,53 +1,53 @@ import Qt 4.6 Item { - id: Switch - width: Groove.width; height: Groove.height + id: mySwitch + width: groove.width; height: groove.height property var on Script { function toggle() { - if(Switch.state == "On") - Switch.state = "Off"; + if(mySwitch.state == "On") + mySwitch.state = "Off"; else - Switch.state = "On"; + mySwitch.state = "On"; } function dorelease() { - if(Knob.x == 1) { - if(Switch.state == "Off") + if(knob.x == 1) { + if(mySwitch.state == "Off") return; } - if(Knob.x == 78) { - if(Switch.state == "On") + if(knob.x == 78) { + if(mySwitch.state == "On") return; } toggle(); } - + } - Image { id: Groove; source: "background.svg" } - MouseRegion { anchors.fill: Groove; onClicked: { toggle() } } - Image { id: Knob; source: "knob.svg"; x: 1; y: 2 } + Image { id: groove; source: "background.svg" } + MouseRegion { anchors.fill: groove; onClicked: { toggle() } } + Image { id: knob; source: "knob.svg"; x: 1; y: 2 } MouseRegion { - anchors.fill: Knob + anchors.fill: knob onClicked: { toggle() } onReleased: { dorelease() } - drag.target: Knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78 + drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78 } states: [ State { name: "On" - PropertyChanges { target: Knob; x: 78 } - PropertyChanges { target: Switch; on: true } + PropertyChanges { target: knob; x: 78 } + PropertyChanges { target: mySwitch; on: true } }, State { name: "Off" - PropertyChanges { target: Knob; x: 1 } - PropertyChanges { target: Switch; on: false } + PropertyChanges { target: knob; x: 1 } + PropertyChanges { target: mySwitch; on: false } } ] transitions: [ diff --git a/examples/declarative/smooth/GradientRect.qml b/examples/declarative/smooth/GradientRect.qml index c4a287c..ed56418 100644 --- a/examples/declarative/smooth/GradientRect.qml +++ b/examples/declarative/smooth/GradientRect.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: MyRect + id: rect property string color property string border : "" property int rotation @@ -11,13 +11,13 @@ Item { width: 80; height: 80 Item { - anchors.centerIn: parent; rotation: MyRect.rotation; + anchors.centerIn: parent; rotation: rect.rotation; Rectangle { anchors.centerIn: parent; width: 80; height: 80 - border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0 - radius: MyRect.radius; smooth: MyRect.smooth + border.color: rect.border; border.width: rect.border != "" ? 2 : 0 + radius: rect.radius; smooth: rect.smooth gradient: Gradient { - GradientStop { position: 0.0; color: MyRect.color } + GradientStop { position: 0.0; color: rect.color } GradientStop { position: 1.0; color: "white" } } } diff --git a/examples/declarative/smooth/MyRect.qml b/examples/declarative/smooth/MyRect.qml index 3b68307..9b6c3ae 100644 --- a/examples/declarative/smooth/MyRect.qml +++ b/examples/declarative/smooth/MyRect.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: MyRect + id: rect property string color property string border : "" property int rotation @@ -11,11 +11,11 @@ Item { width: 80; height: 80 Item { - anchors.centerIn: parent; rotation: MyRect.rotation; + anchors.centerIn: parent; rotation: rect.rotation; Rectangle { anchors.centerIn: parent; width: 80; height: 80 - color: MyRect.color; border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0 - radius: MyRect.radius; smooth: MyRect.smooth + color: rect.color; border.color: rect.border; border.width: rect.border != "" ? 2 : 0 + radius: rect.radius; smooth: rect.smooth } } } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml index 8980034..62f986c 100644 --- a/examples/declarative/snow/ImageBatch.qml +++ b/examples/declarative/snow/ImageBatch.qml @@ -1,7 +1,7 @@ import Qt 4.6 GridView { - id: MyGrid + id: grid property int offset: 0 property var ref property bool isSelected: ref.selectedItemColumn >= offset && ref.selectedItemColumn < offset + 5 @@ -17,10 +17,10 @@ GridView { cellHeight: imageHeight states: State { - name: "selected"; when: MyGrid.isSelected - PropertyChanges { target: MyGrid; z: 150 } + name: "selected"; when: grid.isSelected + PropertyChanges { target: grid; z: 150 } } - transitions: Transition { + transitions: Transition { SequentialAnimation { PauseAnimation { duration: 150 } PropertyAction { properties: "z" } @@ -35,20 +35,20 @@ GridView { XmlRole { name: "url"; query: "media:content/@url/string()" } } - Item { - id: Root - property bool isSelected: GridView.isCurrentItem && MyGrid.isSelected + Item { + id: root + property bool isSelected: GridView.isCurrentItem && grid.isSelected transformOrigin: "Center" - width: MyGrid.imageWidth; height: MyGrid.imageHeight; + width: grid.imageWidth; height: grid.imageHeight; - Image { id: FlickrImage; source: url; fillMode: "PreserveAspectFit"; smooth: true; anchors.fill: parent; - opacity: (status == 1)?1:0; opacity: Behavior { NumberAnimation { properties: "opacity" } } } - Loading { anchors.centerIn: parent; visible: FlickrImage.status!=1 } + Image { id: flickrImage; source: url; fillMode: "PreserveAspectFit"; smooth: true; anchors.fill: parent; + opacity: (status == 1)?1:0; opacity: Behavior { NumberAnimation { properties: "opacity" } } } + Loading { anchors.centerIn: parent; visible: flickrImage.status!=1 } states: State { name: "selected" - when: Root.isSelected - PropertyChanges { target: Root; scale: 3; z: 100 } + when: root.isSelected + PropertyChanges { target: root; scale: 3; z: 100 } } transitions: [ Transition { diff --git a/examples/declarative/snow/Loading.qml b/examples/declarative/snow/Loading.qml index ff2c829..054656a 100644 --- a/examples/declarative/snow/Loading.qml +++ b/examples/declarative/snow/Loading.qml @@ -1,8 +1,8 @@ import Qt 4.6 Image { - id: Loading; source: "pics/loading.png"; transformOrigin: "Center" + id: loading; source: "pics/loading.png"; transformOrigin: "Center" rotation: NumberAnimation { - id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900 + id: rotationAnimation; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/examples/declarative/snow/create.js b/examples/declarative/snow/create.js index 9def7a7..2bdae4a 100644 --- a/examples/declarative/snow/create.js +++ b/examples/declarative/snow/create.js @@ -1,12 +1,12 @@ var myComponent = null; function createNewBlock() { - if (myComponent == null) + if (myComponent == null) myComponent = createComponent("ImageBatch.qml"); var obj = myComponent.createObject(); - obj.parent = MyLayout; + obj.parent = layout; obj.offset = maximumColumn + 1; - obj.ref = ImagePanel; + obj.ref = imagePanel; maximumColumn += 5; } diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml index 2241c3f..39c9c43 100644 --- a/examples/declarative/snow/snow.qml +++ b/examples/declarative/snow/snow.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - id: ImagePanel + id: imagePanel width: 1024 height: 768 color: "black" @@ -23,7 +23,7 @@ Rectangle { Item { anchors.centerIn: parent Row { - id: MyLayout + id: layout property real targetX: -(selectedX + imageWidth / 2) property real targetDeform: 0 @@ -31,19 +31,19 @@ Rectangle { property real deform: 0 deform: SpringFollow { - id: "DeformFollow"; source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2 - onSyncChanged: if(inSync) { MyLayout.slowDeform = true; MyLayout.targetDeform = 0; } + id: deformFollow; source: layout.targetDeform; velocity: layout.slowDeform?0.1:2 + onSyncChanged: if(inSync) { layout.slowDeform = true; layout.targetDeform = 0; } } - - ImageBatch { offset: 0; ref: ImagePanel } - x: SpringFollow { source: MyLayout.targetX; velocity: 1000 } + ImageBatch { offset: 0; ref: imagePanel } + + x: SpringFollow { source: layout.targetX; velocity: 1000 } y: SpringFollow { source: -(selectedY + imageHeight / 2); velocity: 500 } } transform: Rotation { axis.y: 1; axis.z: 0 - angle: MyLayout.deform * -100 + angle: layout.deform * -100 } } @@ -51,13 +51,13 @@ Rectangle { function left() { if (selectedItemColumn <= 0) return; selectedItemColumn -= 1; - MyLayout.slowDeform = false; - MyLayout.targetDeform = Math.max(Math.min(MyLayout.deform - 0.1, -0.1), -0.4); + layout.slowDeform = false; + layout.targetDeform = Math.max(Math.min(layout.deform - 0.1, -0.1), -0.4); } function right() { selectedItemColumn += 1; - MyLayout.slowDeform = false; - MyLayout.targetDeform = Math.min(Math.max(MyLayout.deform + 0.1, 0.1), 0.4); + layout.slowDeform = false; + layout.targetDeform = Math.min(Math.max(layout.deform + 0.1, 0.1), 0.4); } } diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index d91b558..acab2f0 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -1,25 +1,25 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 300; height: 300; color: "white" // A target region. Clicking in here sets the state to '' - the default state Rectangle { x: 0; y: 0; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rectangle { x: 150; y: 50; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rectangle { x: 0; y: 200; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } } } // Rect which will be moved when my state changes Rectangle { id: myrect; width: 50; height: 50; color: "red" } @@ -34,7 +34,7 @@ Rectangle { y: 50 } }, - // In state 'Position2', change y to 100. We do not specify 'x' here - + // In state 'Position2', change y to 100. We do not specify 'x' here - // it will therefore be restored to its default value of 0, if it // had been changed. State { diff --git a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml index f09dcd1..e2c6650 100644 --- a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml +++ b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml @@ -1,16 +1,16 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 480 height: 200 color: "LightGrey" Text { - id: HelloText + id: helloText text: "Hello world!" font.pointSize: 24 font.bold: true y: 30 - anchors.horizontalCenter: Page.horizontalCenter + anchors.horizontalCenter: page.horizontalCenter } } diff --git a/examples/declarative/tutorials/helloworld/t2/Cell.qml b/examples/declarative/tutorials/helloworld/t2/Cell.qml index b3c52b7..bfd835d 100644 --- a/examples/declarative/tutorials/helloworld/t2/Cell.qml +++ b/examples/declarative/tutorials/helloworld/t2/Cell.qml @@ -3,16 +3,16 @@ import Qt 4.6 Item { property var color - id: CellContainer + id: cellContainer width: 40 height: 25 Rectangle { anchors.fill: parent - color: CellContainer.color + color: cellContainer.color } MouseRegion { anchors.fill: parent - onClicked: { HelloText.color = CellContainer.color } + onClicked: { helloText.color = cellContainer.color } } } diff --git a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml index 458e302..aee9032 100644 --- a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml +++ b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml @@ -1,22 +1,22 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 480 height: 200 color: "LightGrey" Text { - id: HelloText + id: helloText text: "Hello world!" font.pointSize: 24 font.bold: true y: 30 - anchors.horizontalCenter: Page.horizontalCenter + anchors.horizontalCenter: page.horizontalCenter } Grid { - id: ColorPicker + id: colorPicker x: 0 - anchors.bottom: Page.bottom + anchors.bottom: page.bottom width: 120; height: 50 rows: 2; columns: 3 Cell { color: "#ff0000" } diff --git a/examples/declarative/tutorials/helloworld/t3/Cell.qml b/examples/declarative/tutorials/helloworld/t3/Cell.qml index 4b1a220..6feb7a9 100644 --- a/examples/declarative/tutorials/helloworld/t3/Cell.qml +++ b/examples/declarative/tutorials/helloworld/t3/Cell.qml @@ -3,15 +3,15 @@ import Qt 4.6 Item { property var color - id: CellContainer + id: cellContainer width: 40 height: 25 Rectangle { anchors.fill: parent - color: CellContainer.color + color: cellContainer.color } MouseRegion { anchors.fill: parent - onClicked: { HelloText.color = CellContainer.color } + onClicked: { helloText.color = cellContainer.color } } } diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml index 426640d..b80065d 100644 --- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml @@ -1,23 +1,23 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 480 height: 200 color: "LightGrey" Text { - id: HelloText + id: helloText text: "Hello world!" font.pointSize: 24 font.bold: true y: 30 - anchors.horizontalCenter: Page.horizontalCenter + anchors.horizontalCenter: page.horizontalCenter states: [ State { name: "down" - when: MouseRegionId.pressed == true + when: mouseRegion.pressed == true PropertyChanges { - target: HelloText + target: helloText y: 160 color: "red" } @@ -39,11 +39,11 @@ Rectangle { } ] } - MouseRegion { id: MouseRegionId; anchors.fill: HelloText } + MouseRegion { id: mouseRegion; anchors.fill: helloText } Grid { - id: ColorPicker + id: colorPicker x: 0 - anchors.bottom: Page.bottom + anchors.bottom: page.bottom width: 120; height: 50 rows: 2; columns: 3 Cell { color: "#ff0000" } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 052f690..b0d4dd9 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -8,7 +8,7 @@ Rectangle { height: 500 radius: 7 border.color: "black" - id: Page + id: page Image { x: 10 y: 10 @@ -26,21 +26,21 @@ Rectangle { styleColor: "#dedede" } Repeater { - model: Page.stickies + model: page.stickies Item { x: Math.random() * 200 + 100 y: Math.random() * 300 + 50 - id: StickyPage + id: stickyPage rotation: SpringFollow { - source: -Flick.horizontalVelocity / 100 + source: -flickable.horizontalVelocity / 100 spring: 2.0 damping: 0.1 } Item { - id: Sticky + id: sticky scale: 0.5 Image { - id: StickyImage + id: stickyImage source: "sticky.png" smooth: true y: -20 @@ -48,7 +48,7 @@ Rectangle { scale: 0.6 } TextEdit { - id: MyText + id: myText smooth: true font.pointSize: 28 readOnly: false @@ -62,14 +62,14 @@ Rectangle { } Item { y: -20 - x: StickyImage.x - width: StickyImage.width * StickyImage.scale - height: StickyImage.height * StickyImage.scale + x: stickyImage.x + width: stickyImage.width * stickyImage.scale + height: stickyImage.height * stickyImage.scale MouseRegion { - id: Mouse - onClicked: { MyText.focus = true } + id: mouse + onClicked: { myText.focus = true } anchors.fill: parent - drag.target: StickyPage + drag.target: stickyPage drag.axis: "XandYAxis" drag.minimumY: 0 drag.maximumY: 500 @@ -87,14 +87,14 @@ Rectangle { states: [ State { name: "pressed" - when: Mouse.pressed + when: mouse.pressed PropertyChanges { - target: Sticky + target: sticky rotation: 8 scale: 1 } PropertyChanges { - target: Page + target: page z: 8 } } diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml index 8ac42e1..b132965 100644 --- a/examples/declarative/velocity/velocity.qml +++ b/examples/declarative/velocity/velocity.qml @@ -5,7 +5,7 @@ Rectangle { width: 800 height: 600 ListModel { - id: List + id: list ListElement { name: "Sunday" dayColor: "#808080" @@ -95,13 +95,13 @@ Rectangle { } } Flickable { - id: Flick + id: flickable anchors.fill: parent - viewportWidth: Lay.width + viewportWidth: lay.width Row { - id: Lay + id: lay Repeater { - model: List + model: list Component { Day { day: name diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index dbd94e1..74c6844 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -3,22 +3,21 @@ import Qt 4.6 // The WebView size is determined by the width, height, // preferredWidth, and preferredHeight properties. Rectangle { - id: Rect + id: rect color: "white" width: 200 - height: Layout.height + height: layout.height Column { - id: Layout + id: layout spacing: 2 WebView { html: "No width defined." - Rectangle { - color: "#10000000" + Rectangle { color: "#10000000" anchors.fill: parent } } WebView { - width: Rect.width + width: rect.width html: "The width is full." Rectangle { color: "#10000000" @@ -26,7 +25,7 @@ Rectangle { } } WebView { - width: Rect.width/2 + width: rect.width/2 html: "The width is half." Rectangle { color: "#10000000" @@ -34,7 +33,7 @@ Rectangle { } } WebView { - preferredWidth: Rect.width/2 + preferredWidth: rect.width/2 html: "The preferredWidth is half." Rectangle { color: "#10000000" @@ -42,7 +41,7 @@ Rectangle { } } WebView { - preferredWidth: Rect.width/2 + preferredWidth: rect.width/2 html: "The_preferredWidth_is_half." Rectangle { color: "#10000000" @@ -50,7 +49,7 @@ Rectangle { } } WebView { - width: Rect.width/2 + width: rect.width/2 html: "The_width_is_half." Rectangle { color: "#10000000" diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index 95159b6..5ccdeb6 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -3,16 +3,16 @@ import Qt 4.6 Item { property var period : 250 property var color : "black" - id: Root + id: root Item { - x: Root.width/2 - y: Root.height/2 + x: root.width/2 + y: root.height/2 Rectangle { - color: Root.color + color: root.color x: -width/2 y: -height/2 - width: Root.width + width: root.width height: width } rotation: NumberAnimation { @@ -20,7 +20,7 @@ Item { to: 360 repeat: true running: true - duration: Root.period + duration: root.period } } } diff --git a/examples/declarative/webview/newwindows.qml b/examples/declarative/webview/newwindows.qml index 57cbf4e..59e3b3e 100644 --- a/examples/declarative/webview/newwindows.qml +++ b/examples/declarative/webview/newwindows.qml @@ -6,23 +6,23 @@ import Qt 4.6 Row { - id: Pages + id: pages height: 200 resources: [ Component { - id: WebViewPage + id: webViewPage Rectangle { - width: WV.width - height: WV.height + width: webView.width + height: webView.height WebView { - id: WV - newWindowComponent: WebViewPage - newWindowParent: Pages + id: webView + newWindowComponent: webViewPage + newWindowParent: pages url: "newwindows.html" } } } ] width: 500 - Loader { sourceComponent: WebViewPage } + Loader { sourceComponent: webViewPage } } diff --git a/examples/declarative/webview/qml-in-html.qml b/examples/declarative/webview/qml-in-html.qml index b9c8d94..43cc61b 100644 --- a/examples/declarative/webview/qml-in-html.qml +++ b/examples/declarative/webview/qml-in-html.qml @@ -6,10 +6,10 @@ Rectangle { Flickable { width: parent.width height: parent.height/2 - viewportWidth: Web.width*Web.scale - viewportHeight: Web.height*Web.scale + viewportWidth: web.width*web.scale + viewportHeight: web.height*web.scale WebView { - id: Web + id: web width: 250 height: 420 scale: 0.75 diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml index 0807cc5..9332f3e 100644 --- a/examples/declarative/webview/transparent.qml +++ b/examples/declarative/webview/transparent.qml @@ -4,10 +4,10 @@ import Qt 4.6 // if the HTML does not specify a background Rectangle { color: "green" - width: Web.width - height: Web.height + width: web.width + height: web.height WebView { - id: Web + id: web html: "Hello World!" } } diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index e0e53ef..bea38c8 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -29,20 +29,20 @@ Rectangle { height: childrenRect.height + 20 Text { x: 10 - id: TitleText + id: titleText text: title font.bold: true } Text { text: 'by ' + tagline - anchors.left: TitleText.right + anchors.left: titleText.right anchors.leftMargin: 10 font.italic: true } Text { x: 10 text: content - anchors.top: TitleText.bottom + anchors.top: titleText.bottom width: 580 wrap: true onLinkActivated: { print('link clicked: ' + link) } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index 7ebc2b2..bad1d88 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -28,24 +28,24 @@ Rectangle { Component { id: feedDelegate Item { - id: Delegate - height: Wrapper.height + 10 + id: delegate + height: wrapper.height + 10 MouseRegion { - anchors.fill: Wrapper - onPressed: { Delegate.ListView.list.currentIndex = index; } - onClicked: { if (Wrapper.state == 'Details') { Wrapper.state = '';} else {Wrapper.state = 'Details';} } + anchors.fill: wrapper + onPressed: { delegate.ListView.list.currentIndex = index; } + onClicked: { if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';} } } Rectangle { - id: Wrapper + id: wrapper y: 5 - height: TitleText.height + 10 + height: titleText.height + 10 width: 580 color: "#F0F0F0" radius: 5 Text { x: 10 y: 5 - id: TitleText + id: titleText text: '' + title + '' font.bold: true font.family: "Helvetica" @@ -54,20 +54,20 @@ Rectangle { } Text { x: 10 - id: Description + id: description text: description width: 560 wrap: true font.family: "Helvetica" - anchors.top: TitleText.bottom + anchors.top: titleText.bottom anchors.topMargin: 5 opacity: 0 } states: [ State { name: "Details" - PropertyChanges { target: Wrapper; height: childrenRect.height + 10 } - PropertyChanges { target: Description; opacity: 1 } + PropertyChanges { target: wrapper; height: childrenRect.height + 10 } + PropertyChanges { target: description; opacity: 1 } } ] transitions: [ -- cgit v0.12 From 2d7ad6196158a6138c946a5d26eefe9ac32f0773 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 6 Oct 2009 14:31:56 +1000 Subject: lowercase ids --- doc/src/snippets/declarative/GroupBox.qml | 4 ++-- .../declarative/gridview/dummydata/ContactModel.qml | 2 +- doc/src/snippets/declarative/gridview/gridview.qml | 12 ++++++------ doc/src/snippets/declarative/listview/highlight.qml | 14 +++++++------- doc/src/snippets/declarative/listview/listview.qml | 12 ++++++------ doc/src/snippets/declarative/pathview/pathattributes.qml | 12 ++++++------ doc/src/snippets/declarative/pathview/pathview.qml | 12 ++++++------ examples/declarative/states/transitions.qml | 10 +++++----- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/src/snippets/declarative/GroupBox.qml b/doc/src/snippets/declarative/GroupBox.qml index 13e7eb6..6c5431e 100644 --- a/doc/src/snippets/declarative/GroupBox.qml +++ b/doc/src/snippets/declarative/GroupBox.qml @@ -1,12 +1,12 @@ import Qt 4.6 ContentWrapper { - id: Container; width: parent.width; height: contents.height + id: container; width: parent.width; height: contents.height children: [ Rectangle { width: parent.width; height: contents.height color: "white"; pen.width: 2; pen.color: "#adaeb0"; radius: 10 - VerticalLayout { + Column { id: layout; width: parent.width; margin: 5; spacing: 2 Content { } } diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml index 6868385..3cf9ba7 100644 --- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml +++ b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml @@ -1,7 +1,7 @@ import Qt 4.6 ListModel { - id: ContactModel + id: contactModel ListElement { name: "Bill Smith" number: "555 3264" diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index d0f0623..1a2021c 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -11,11 +11,11 @@ Rectangle { // instantiated for each visible item in the list. //! [0] Component { - id: Delegate + id: delegate Item { - id: Wrapper + id: wrapper width: 80; height: 78 - VerticalLayout { + Column { Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter } Text { text: name; anchors.horizontalCenter: parent.horizontalCenter } } @@ -26,7 +26,7 @@ Rectangle { // by each ListView and placed behind the current item. //! [1] Component { - id: Highlight + id: highlight Rectangle { color: "lightsteelblue" radius: 5 @@ -37,9 +37,9 @@ Rectangle { //! [2] GridView { width: parent.width; height: parent.height - model: ContactModel; delegate: Delegate + model: ContactModel; delegate: delegate cellWidth: 80; cellHeight: 80 - highlight: Highlight + highlight: highlight focus: true } //! [2] diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index 97eac45..2234ee7 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -11,9 +11,9 @@ Rectangle { // instantiated for each visible item in the list. //! [0] Component { - id: Delegate + id: delegate Item { - id: Wrapper + id: wrapper width: 180; height: 40 Column { x: 5; y: 5 @@ -28,22 +28,22 @@ Rectangle { // highlight moves to the current item. //! [1] Component { - id: Highlight + id: highlight Rectangle { width: 180; height: 40 color: "lightsteelblue"; radius: 5 y: SpringFollow { - source: List.currentItem.y + source: list.currentItem.y spring: 3 damping: 0.2 } } } ListView { - id: List + id: list width: parent.height; height: parent.height - model: ContactModel; delegate: Delegate - highlight: Highlight + model: ContactModel; delegate: delegate + highlight: highlight highlightFollowsCurrentItem: false focus: true } diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index c907077..be0f3ad 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -12,11 +12,11 @@ Rectangle { // instantiated for each visible item in the list. //! [0] Component { - id: Delegate + id: delegate Item { - id: Wrapper + id: wrapper width: 180; height: 40 - VerticalLayout { + Column { x: 5; y: 5 Text { text: 'Name: ' + name } Text { text: 'Number: ' + number } @@ -28,7 +28,7 @@ Rectangle { // by each ListView and placed behind the current item. //! [1] Component { - id: Highlight + id: highlight Rectangle { color: "lightsteelblue" radius: 5 @@ -40,8 +40,8 @@ Rectangle { ListView { width: parent.width; height: parent.height model: ContactModel - delegate: Delegate - highlight: Highlight + delegate: delegate + highlight: highlight focus: true } //! [2] diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml index 92d6966..19a192c 100644 --- a/doc/src/snippets/declarative/pathview/pathattributes.qml +++ b/doc/src/snippets/declarative/pathview/pathattributes.qml @@ -5,22 +5,22 @@ Rectangle { //! [0] //! [1] Component { - id: Delegate + id: delegate Item { - id: Wrapper + id: wrapper width: 80; height: 80 scale: PathView.scale opacity: PathView.opacity - VerticalLayout { - Image { anchors.horizontalCenter: Name.horizontalCenter; width: 64; height: 64; source: icon } - Text { id: Name; text: name; font.pointSize: 16} + Column { + Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } + Text { id: name; text: name; font.pointSize: 16} } } } //! [1] //! [2] PathView { - anchors.fill: parent; model: MenuModel; delegate: Delegate + anchors.fill: parent; model: MenuModel; delegate: delegate path: Path { startX: 120; startY: 100 PathAttribute { name: "scale"; value: 1.0 } diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml index 004a1d2..5605139 100644 --- a/doc/src/snippets/declarative/pathview/pathview.qml +++ b/doc/src/snippets/declarative/pathview/pathview.qml @@ -5,20 +5,20 @@ Rectangle { //! [0] //! [1] Component { - id: Delegate + id: delegate Item { - id: Wrapper + id: wrapper width: 80; height: 80 - VerticalLayout { - Image { anchors.horizontalCenter: Name.horizontalCenter; width: 64; height: 64; source: icon } - Text { id: Name; text: name; font.pointSize: 16} + Column { + Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } + Text { id: name; text: name; font.pointSize: 16} } } } //! [1] //! [2] PathView { - anchors.fill: parent; model: MenuModel; delegate: Delegate + anchors.fill: parent; model: MenuModel; delegate: delegate path: Path { startX: 120; startY: 100 PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 } diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index be1419d..cc6894d 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -1,25 +1,25 @@ import Qt 4.6 Rectangle { - id: Page + id: page width: 300; height: 300; color: "white" // A target region. Clicking in here sets the state to '' - the default state Rectangle { x: 0; y: 0; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rectangle { x: 150; y: 50; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rectangle { x: 0; y: 200; width: 50; height: 50 color: "transparent"; border.color: "black" - MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } + MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } } } // Rect which will be moved when my state changes Rectangle { id: myrect; width: 50; height: 50; color: "red" } @@ -34,7 +34,7 @@ Rectangle { y: 50 } }, - // In state 'Position2', change y to 100. We do not specify 'x' here - + // In state 'Position2', change y to 100. We do not specify 'x' here - // it will therefore be restored to its default value of 0, if it // had been changed. State { -- cgit v0.12 From 0a90113262eab4e05bf73c0b69b1f5633a10e768 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 --- 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 2a18238357e3442a2e9a6eb2fe8b9ff78704c174 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 --- 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 180bdb06feed8c5fe08f88b9eb16b7676615851f 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 --- 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 231d8d7c02161e93b3a97a1bacb3c402f16e1fcb 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 --- 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 3da33626c056169f5fadf94f12997180cb3a08b4 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 --- 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 b1310cb8fcc4b48750f82502a7140f2ebb8a44c7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 06:55:34 +0200 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 --- .../qabstractitemview/tst_qabstractitemview.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index d3af076..1a9a5f9 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -181,6 +181,10 @@ public: virtual ~tst_QAbstractItemView(); void basic_tests(TestView *view); +public slots: + void initTestCase(); + void cleanupTestCase(); + private slots: void getSetCheck(); void emptyModels_data(); @@ -312,6 +316,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"); @@ -1186,15 +1201,12 @@ void tst_QAbstractItemView::task250754_fontChange() QFont font = tree.font(); font.setPointSize(5); tree.setFont(font); - QTest::qWait(30); - - QVERIFY(!tree.verticalScrollBar()->isVisible()); + QTRY_VERIFY(!tree.verticalScrollBar()->isVisible()); font.setPointSize(45); tree.setFont(font); - QTest::qWait(30); //now with the huge items, the scrollbar must be visible - QVERIFY(tree.verticalScrollBar()->isVisible()); + QTRY_VERIFY(tree.verticalScrollBar()->isVisible()); qApp->setStyleSheet(app_css); } -- cgit v0.12 From 7851cbd64d15d39a0e9cc99efa6c2d007c935ce9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 07:34:12 +0200 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 --- tests/auto/qcssparser/qcssparser.pro | 8 +++++--- tests/auto/qcssparser/tst_qcssparser.cpp | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 2f99142..6ce559b 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -3,9 +3,11 @@ SOURCES += tst_qcssparser.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" QT += xml - -wince*: { +wince* { 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 c2facb0..d7a126d 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 39dc3026d1da03d5fcf8e5c516fadd7e4ea8a861 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 --- 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 0fedc2d3066a17e8062ec5271d8e53475c5cc312 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 --- 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 37bd7a5711e57ea8c45ae75102ddee3ab905a0e5 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 --- 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 146988463cc0d03be415aa8ff07031b6bcf27975 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 --- 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 f18ea32865521e21f47ea2745181e0e70db0266f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 10:15:42 +0200 Subject: Stabilize tests on X11 --- 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 bec7a9cced7b69aef707bad4931fa4d3c35b37fa 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 --- 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 1015ee9016f3a46bb05077a9eff83c8736b2541e 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 --- 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 92658a6..1b21527 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 b7503346c1b7d245625b1b9e7cf7ae89a86467f0 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 ) --- 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 6d56096ba0f88e25efd77072f58804dd1f160c0a 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 --- 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 f1ea73bad48816222e192a95f8589493743f0c28 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 --- 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 501d0fc639e7ec9b26a102eac857123d86215ccf 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 --- 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 56087f7ffa0c64c34f55cf24a24d9337592b6c23 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 --- 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 e6fdab148b207b6e0cf9279b4b82578d95f021a9 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 --- .../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 72f1e06aa6238f55729c4f3606d06ad7d37fe6df 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 ) --- 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 7ed2e44c48ac625993cf33cdbb70f82b0a3cb1af 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. --- 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 6c0b82c..68b1afb 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 9225889d8958e71c8683df752ff2207c11334c9a 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." --- 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 65a101502bb04ea95110ce6e12a3848c790eb7a1 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 --- 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 c8d2160f3aa9b6709874c9cf4a634a46728d6cc6 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 --- 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 7a8503d179e0f9afebb2ca57e824f1be61becf17 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 --- 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 914cae63fd9045b8ac5877a974551f29eec24d72 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 --- 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 8c4eb2b62983ec09bdfb2bde2723df12ac4e00ef 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 --- 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 396a06a52a0f00639c9e528caf80ae2294e80bd2 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Tue, 6 Oct 2009 12:00:22 +0200 Subject: Added properties highlightMoveSpeed and highlightResizeSpeed (ListView) The speed of the moving and resizing animations of the highlight component were hardcoded, now they are accessible through these new properties. Reviewed-by: thartman --- src/declarative/fx/qfxlistview.cpp | 49 ++++++++++++++++++++++++++++++++++++-- src/declarative/fx/qfxlistview.h | 11 +++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 501b4df..1247021 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -178,6 +178,7 @@ public: , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0) , ownModel(false), wrap(false), autoHighlight(true) , haveHighlightRange(false), strictHighlightRange(false) + , highlightMoveSpeed(400), highlightResizeSpeed(400) {} void init(); @@ -390,6 +391,8 @@ public: QString sectionExpression; QString currentSection; qreal spacing; + qreal highlightMoveSpeed; + qreal highlightResizeSpeed; bool ownModel : 1; bool wrap : 1; @@ -667,11 +670,11 @@ void QFxListViewPrivate::createHighlight() const QLatin1String posProp(orient == Qt::Vertical ? "y" : "x"); highlightPosAnimator = new QmlEaseFollow(q); highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp)); - highlightPosAnimator->setVelocity(400); + highlightPosAnimator->setVelocity(highlightMoveSpeed); highlightPosAnimator->setEnabled(autoHighlight); const QLatin1String sizeProp(orient == Qt::Vertical ? "height" : "width"); highlightSizeAnimator = new QmlEaseFollow(q); - highlightSizeAnimator->setVelocity(400); + highlightSizeAnimator->setVelocity(highlightResizeSpeed); highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp)); highlightSizeAnimator->setEnabled(autoHighlight); } @@ -1259,6 +1262,48 @@ QString QFxListView::currentSection() const return d->currentSection; } +/*! + \qmlproperty real ListView::highlightMoveSpeed + + This property holds the moving animation speed of the highlight delegate. +*/ +qreal QFxListView::highlightMoveSpeed() const +{ + Q_D(const QFxListView);\ + return d->highlightMoveSpeed; +} + +void QFxListView::setHighlightMoveSpeed(qreal speed) +{ + Q_D(QFxListView);\ + if (d->highlightMoveSpeed != speed) + { + d->highlightMoveSpeed = speed; + emit highlightMoveSpeedChanged(); + } +} + +/*! + \qmlproperty real ListView::highlightResizeSpeed + + This property holds the resizing animation speed of the highlight delegate. +*/ +qreal QFxListView::highlightResizeSpeed() const +{ + Q_D(const QFxListView);\ + return d->highlightResizeSpeed; +} + +void QFxListView::setHighlightResizeSpeed(qreal speed) +{ + Q_D(QFxListView);\ + if (d->highlightResizeSpeed != speed) + { + d->highlightResizeSpeed = speed; + emit highlightResizeSpeedChanged(); + } +} + void QFxListView::viewportMoved() { Q_D(QFxListView); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index fc15967..3cff422 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -77,6 +77,9 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) + + Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) + Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) Q_CLASSINFO("DefaultProperty", "data") public: @@ -126,6 +129,12 @@ public: void setSectionExpression(const QString &); QString currentSection() const; + qreal highlightMoveSpeed() const; + void setHighlightMoveSpeed(qreal); + + qreal highlightResizeSpeed() const; + void setHighlightResizeSpeed(qreal); + static QFxListViewAttached *qmlAttachedProperties(QObject *); public Q_SLOTS: @@ -138,6 +147,8 @@ Q_SIGNALS: void currentIndexChanged(); void currentSectionChanged(); void sectionExpressionChanged(); + void highlightMoveSpeedChanged(); + void highlightResizeSpeedChanged(); protected: virtual void viewportMoved(); -- cgit v0.12 From 1f47353f90f6e1a3122eee14b9011bdeb7c7a93f 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 --- 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 cadad3fdc7f6de95979f5b5be070da0853c46ba4 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. --- 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 3d2ef8ab18dcf0b772d2f6ddeb5cf5295ca09db6 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 --- 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 9956ef7fd66f5a0a2ebf9b810e5f6ffe3649cf20 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 --- 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 a6ed1f886d323d68001e3e1b50efe064073691ea 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 --- 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 13cf7c64acd1652bad90966e06464b35b84e9513 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 --- 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 590b9b0e7587494e110cc3c498ff69ddab6f7520 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. --- 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 6a061c1b66de4048222ef49c3d34c3e424e2a6c8 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 --- 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 2f7e879..3a118bd 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 @@ -233,6 +235,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 9dcd06efae3e2d78ef402bf06e655e7e95550a39 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 --- 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 1f5afc4300d3d7e3063f4e2c80a280a5098717d1 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 --- 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 9c73671c3b917a2a6a22411fb17c46dfa5e21049 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 --- doc/src/s60-introduction.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/s60-introduction.qdoc b/doc/src/s60-introduction.qdoc index d0a1976..086ee52 100644 --- a/doc/src/s60-introduction.qdoc +++ b/doc/src/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 a6bf8c28a8b8792167f6c93a08e871376651ba1a 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 --- 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 cb368e06bea269422efcbdbe8136d424b6ff5052 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 --- 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 6c14af1cdb02d1d6957ad23ec435e2b95dda5b4a 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 --- 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 0d51611fa524091ddca3c6c11edb0eae8ffe3b02 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 --- 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 ba4c0b0048bab894047bc363ef7f7a3e12ef4d02 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 --- 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 d824af2348d11a7f364a1046a704268830f35f13 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 --- 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 6bbe0f3105fb8ec70aeb0952bec671b72b9f5400 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 --- 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 ad52b10726aa72c253e220c06d3c7c76ef76366e 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 --- 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 600e163..8409ec7e 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -1333,6 +1333,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 1627b135a7ec37862d7e3764fd545e75ca38bfd7 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 --- 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 5237963..2602ed0 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2886,6 +2886,7 @@ void tst_QGraphicsView::task245469_itemsAtPointWithClip() parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); QGraphicsView view(&scene); + view.resize(150,150); view.rotate(90); view.show(); #ifdef Q_WS_X11 -- cgit v0.12 From a2b8c2b6b5c7de30a3b0d390c3d9885aabb98c57 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 11:44:21 +0200 Subject: tst_QGraphicsItem::QTBUG_4233_updateCachedWithSceneRect WinCE fix We need some more time on Windows mobile to receive all events. Reviewed-by: thartman --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 215334c..86145f6 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6510,7 +6510,7 @@ void tst_QGraphicsItem::QTBUG_4233_updateCachedWithSceneRect() view.show(); QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); - QCOMPARE(tester->repaints, 1); + QTRY_COMPARE(tester->repaints, 1); scene.update(); // triggers "updateAll" optimization qApp->processEvents(); -- cgit v0.12 From f83ae188edb09a94b25b962c8a8b793180d22b67 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 --- 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 971adae01406f71ed9f0bb9cb2be5eddc259e77e 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 --- 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 283670c8fbdda2898879066c7e14d3b0cb5ef442 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 --- 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 addc0cbdbe21da27f7ad9f0ee05a16e24afa392d 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 --- 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 cbc2508fc8cb0f16a061f778f777f8363640fcc8 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. --- 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 e8a3b49d6d42b213fd4fd55837f6180935a8a603 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. --- 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 6372c2865ab6924127b78f968bdd41f8d3f9c637 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. --- .../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 af8ff76bf25b6b4d01d89bea42baab65ed7e09ea 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. --- 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 aaf695a3fad8d84f3d9483a573732350445d453a 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. --- 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 2f268b40b290c4513d2d06b75ad681b5550eeaa8 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. --- .../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 e8c73ac916ce5cb0492c1d1ba817e59b8df34158 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. --- .../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 a815840a7f2272b128de4a52497626c49373c8c9 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. --- .../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 6d17e09c274803d324e8a8db579aaafaefaab33f 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. --- .../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 6b623c04060d274c048c0d4c6dbc5a90d1c31604 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. --- .../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 d846af0de2ee2b3b76f81f2c0fd3ccceb645b511 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(). --- 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 9dbcdc00239abbaf899f04fc5ecc2bdb885ad08d 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(). --- 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 15e2ecda958868b5c372bcd59cba8065c086581e 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 --- 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 7cbcf8e8ef91636de1727d5bd6294a9f07c66804 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 --- .../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 8037c03174124bc136900c88254d118ab48b010f 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 --- 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 56187037e3fe46800bfa670197a149121f00573e 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 --- 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 c81b79080eb8f0c956c97fc80d5118baf7703df4 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 6 Oct 2009 16:12:11 +0200 Subject: Build fix. --- 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 85b17ee0222d96bbd93f758ac3b2bd3139c76ec8 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 --- 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 54645071fad98b46a44d88b50095dc21ff63fff6 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 --- 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 493eb0264c095c62b6573789225a22cadf946348 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 --- 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 fa35247d31bd35d72c307f4a6a231400aade0c0b 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 --- 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 96b047f0f27674ee402ab3624dbb906346ac1847 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 --- 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 27c2df52128e32c785239dbc9322a4b7beb0078c 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. --- .../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 092c773b95b1f126d36ab7c918fb098ddad6cae3 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 --- .../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 28cdb974cce58111a19e8691f4dd929a5c9f74ea 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 --- 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 ffeb69003a9c676064cdf7ec099a02c2fbcf2ad3 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 --- 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 9cf618492d1c89b489bf7e52e45c9577f9d52c1c 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. --- 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 c6a3119..e927a7a 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -335,10 +335,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 d47b7e6d0adcd675ba9da11818b3fa9acc3caff5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:51:18 +0200 Subject: Autotest: add a few more tests, with IP address and actual hostname --- tests/auto/networkselftest/tst_networkselftest.cpp | 78 ++++++++++++++++++++-- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index e927a7a..5a82f28 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -46,6 +46,10 @@ class tst_NetworkSelfTest: public QObject { Q_OBJECT + QHostAddress cachedIpAddress; +public: + QHostAddress serverIpAddress(); + private slots: void hostTest(); void dnsResolution_data(); @@ -303,6 +307,16 @@ static void netChat(int port, const QList &chat) } } +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 @@ -331,6 +345,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() @@ -469,7 +486,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" @@ -479,7 +507,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") @@ -487,7 +525,8 @@ void tst_NetworkSelfTest::httpProxy() << Chat::discardUntil(" ") << Chat::expect("200 ") << Chat::discardUntil("\r\n\r\n") - << ftpChat()); + << ftpChat() + ); } void tst_NetworkSelfTest::httpProxyBasicAuth() @@ -540,11 +579,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)) @@ -555,7 +605,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)) @@ -564,6 +624,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 2d2b4e8a77a30449d8b4ebc88979b3aff45a8222 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 --- 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 681a278c7108c2bd87be6279694875cdb391e3db Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 7 Oct 2009 09:31:27 +1000 Subject: Fix to not crash if item has no parent for some reason. --- src/declarative/util/qmlstateoperations.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index a9a5bd5..921aa6c 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -208,9 +208,12 @@ void QmlParentChange::saveOriginals() d->origParent = d->target->parentItem(); - //try to determine the items original stack position so we can restore it - if (!d->origParent) + if (!d->origParent) { d->origStackBefore = 0; + return; + } + + //try to determine the item's original stack position so we can restore it int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; QList children = d->origParent->childItems(); for (int i = 0; i < children.count(); ++i) { -- cgit v0.12 From 87580b48d0fa45bd8fd45ea9e5f222b10ce087ed Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 7 Oct 2009 09:40:51 +1000 Subject: Simplify Rectangle painting. --- src/declarative/fx/qfxrect.cpp | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index e802c94..f35fe3d 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -74,7 +74,7 @@ void QFxPen::setColor(const QColor &c) void QFxPen::setWidth(int w) { - if (_width == w) + if (_width == w && _valid) return; _width = w; @@ -425,41 +425,18 @@ void QFxRect::drawRect(QPainter &p) if (d->smooth) p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - int offset = 0; const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0; - const int realpw = d->pen && d->pen->isValid() ? d->pen->width() : 0; - if (d->radius > 0) { + if (d->radius > 0) generateRoundedRect(); - //### implicit conversion to int - offset = int(d->radius+realpw+1); - } else { + else generateBorderedRect(); - offset = realpw+1; - } - //basically same code as QFxImage uses to paint sci images - int w = width()+pw; - int h = height()+pw; - int xOffset = offset; - int xSide = xOffset * 2; - bool xMiddles=true; - if (xSide > w) { - xMiddles=false; - xOffset = w/2 + 1; - xSide = xOffset * 2; - } - int yOffset = offset; - int ySide = yOffset * 2; - bool yMiddles=true; - if (ySide > h) { - yMiddles = false; - yOffset = h/2 + 1; - ySide = yOffset * 2; - } + int xOffset = (d->rectImage.width()-1)/2; + int yOffset = (d->rectImage.height()-1)/2; + Q_ASSERT(d->rectImage.width() == 2*xOffset + 1); + Q_ASSERT(d->rectImage.height() == 2*yOffset + 1); - Q_ASSERT(d->rectImage.width() >= 2*xOffset + 1); - Q_ASSERT(d->rectImage.height() >= 2*yOffset + 1); QMargins margins(xOffset, yOffset, xOffset, yOffset); QTileRules rules(Qt::StretchTile, Qt::StretchTile); qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules); -- cgit v0.12 From 1042b1e1930131750d54112ec8f3deb6f70a9c76 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 7 Oct 2009 10:49:27 +1000 Subject: Fix so items are stretched to width of viewer if viewer is resized; otherwise, shrink viewer to width of main canvas item. (Last fix did not work because usually items should resize with the viewer.) --- tools/qmlviewer/qmlviewer.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index e185536..07b68ea 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -55,6 +55,26 @@ QT_BEGIN_NAMESPACE + +class SizedMenuBar : public QMenuBar +{ + Q_OBJECT +public: + SizedMenuBar(QWidget *parent, QWidget *referenceWidget) + : QMenuBar(parent), refWidget(referenceWidget) + { + } + + virtual QSize sizeHint() const + { + return QSize(refWidget->sizeHint().width(), QMenuBar::sizeHint().height()); + } + +private: + QWidget *refWidget; +}; + + class PreviewDeviceSkin : public DeviceSkin { Q_OBJECT @@ -281,10 +301,6 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) } else { recdlg->warning->hide(); } - - - if (!(flags & Qt::FramelessWindowHint)) - createMenu(menuBar(),0); canvas = new QmlView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); @@ -296,13 +312,16 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); QObject::connect(canvas, SIGNAL(errors(QList)), this, SLOT(executeErrors())); + if (!(flags & Qt::FramelessWindowHint)) + createMenu(menuBar(),0); + QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(0); layout->setSpacing(0); setLayout(layout); if (mb) layout->addWidget(mb); - layout->addWidget(canvas, 0, Qt::AlignLeft); + layout->addWidget(canvas); setupProxy(); canvas->engine()->networkAccessManager()->setCookieJar(new PersistentCookieJar(this)); @@ -319,7 +338,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) QMenuBar *QmlViewer::menuBar() const { if (!mb) - mb = new QMenuBar((QWidget*)this); + mb = new SizedMenuBar((QWidget*)this, canvas); return mb; } @@ -650,8 +669,8 @@ void QmlViewer::openQml(const QString& fileName) if (!skin) { canvas->updateGeometry(); - canvas->resize(canvas->sizeHint()); - canvas->updateGeometry(); + if (mb) + mb->updateGeometry(); resize(sizeHint()); } else { if (scaleSkin) -- cgit v0.12 From e25009d28c58b3ff7541374475f8c2c278cef02e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 11:01:05 +1000 Subject: Refactor tileSize to the gameCanvas item --- demos/declarative/samegame/content/samegame.js | 25 ++++++++++++------------- demos/declarative/samegame/samegame.qml | 1 + 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index cf55b59..ba2346f 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -1,8 +1,7 @@ /* This script file handles the game logic */ //Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for tileSize 40 +var maxX = 10;//Nums are for gameCanvas.tileSize 40 var maxY = 15; -var tileSize = 40; var maxIndex = maxX*maxY; var board = new Array(maxIndex); var tileSrc = "content/BoomBlock.qml"; @@ -31,8 +30,8 @@ function initBoard() } //Calculate board size - maxX = Math.floor(gameCanvas.width/tileSize); - maxY = Math.floor(gameCanvas.height/tileSize); + maxX = Math.floor(gameCanvas.width/gameCanvas.tileSize); + maxY = Math.floor(gameCanvas.height/gameCanvas.tileSize); maxIndex = maxY*maxX; //Close dialogs @@ -56,8 +55,8 @@ var floodBoard;//Set to 1 if the floodFill reaches off that node //NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope function handleClick(x,y) { - xIdx = Math.floor(x/tileSize); - yIdx = Math.floor(y/tileSize); + xIdx = Math.floor(x/gameCanvas.tileSize); + yIdx = Math.floor(y/gameCanvas.tileSize); if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) return; if(board[index(xIdx, yIdx)] == null) @@ -111,7 +110,7 @@ function shuffleDown() }else{ if(fallDist > 0){ obj = board[index(xIdx,yIdx)]; - obj.targetY += fallDist * tileSize; + obj.targetY += fallDist * gameCanvas.tileSize; board[index(xIdx,yIdx+fallDist)] = obj; board[index(xIdx,yIdx)] = null; } @@ -129,7 +128,7 @@ function shuffleDown() obj = board[index(xIdx,yIdx)]; if(obj == null) continue; - obj.targetX -= fallDist * tileSize; + obj.targetX -= fallDist * gameCanvas.tileSize; board[index(xIdx-fallDist,yIdx)] = obj; board[index(xIdx,yIdx)] = null; } @@ -188,11 +187,11 @@ function createBlock(xIdx,yIdx){ } dynamicObject.type = Math.floor(Math.random() * 3); dynamicObject.parent = gameCanvas; - dynamicObject.x = xIdx*tileSize; - dynamicObject.targetX = xIdx*tileSize; - dynamicObject.targetY = yIdx*tileSize; - dynamicObject.width = tileSize; - dynamicObject.height = tileSize; + dynamicObject.x = xIdx*gameCanvas.tileSize; + dynamicObject.targetX = xIdx*gameCanvas.tileSize; + dynamicObject.targetY = yIdx*gameCanvas.tileSize; + dynamicObject.width = gameCanvas.tileSize; + dynamicObject.height = gameCanvas.tileSize; dynamicObject.spawned = true; board[index(xIdx,yIdx)] = dynamicObject; }else{//isError or isLoading diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 92d85f3..709f4e9 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -21,6 +21,7 @@ Rectangle { Item { id: gameCanvas property int score: 0 + property int tileSize: 40 z: 20; anchors.centerIn: parent width: parent.width - (parent.width % tileSize); -- cgit v0.12 From 95821d745a60e60422294dd718cbed5678ef5f1f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 11:03:21 +1000 Subject: Add SameGame based advanced tutorial Could use some cleanup, as I didn't manage to get code snippets working correctly. Also might benefit from being re-written by a good tutor. --- doc/src/declarative/advtutorial.qdoc | 18 ++ doc/src/declarative/advtutorial1.qdoc | 116 +++++++++++ doc/src/declarative/advtutorial2.qdoc | 113 +++++++++++ doc/src/declarative/advtutorial3.qdoc | 197 +++++++++++++++++++ doc/src/declarative/advtutorial4.qdoc | 120 ++++++++++++ doc/src/declarative/qtdeclarative.qdoc | 1 + .../tutorials/samegame/samegame1/Block.qml | 10 + .../tutorials/samegame/samegame1/Button.qml | 25 +++ .../samegame/samegame1/pics/background.png | Bin 0 -> 153328 bytes .../tutorials/samegame/samegame1/pics/redStone.png | Bin 0 -> 2604 bytes .../tutorials/samegame/samegame1/samegame.qml | 38 ++++ .../tutorials/samegame/samegame2/Block.qml | 10 + .../tutorials/samegame/samegame2/Button.qml | 25 +++ .../samegame/samegame2/pics/background.png | Bin 0 -> 153328 bytes .../tutorials/samegame/samegame2/pics/redStone.png | Bin 0 -> 2604 bytes .../tutorials/samegame/samegame2/samegame.js | 59 ++++++ .../tutorials/samegame/samegame2/samegame.qml | 39 ++++ .../tutorials/samegame/samegame3/Block.qml | 19 ++ .../tutorials/samegame/samegame3/Button.qml | 25 +++ .../tutorials/samegame/samegame3/Dialog.qml | 21 ++ .../samegame/samegame3/pics/background.png | Bin 0 -> 153328 bytes .../samegame/samegame3/pics/blueStone.png | Bin 0 -> 2691 bytes .../samegame/samegame3/pics/greenStone.png | Bin 0 -> 2662 bytes .../tutorials/samegame/samegame3/pics/redStone.png | Bin 0 -> 2604 bytes .../tutorials/samegame/samegame3/samegame.js | 185 ++++++++++++++++++ .../tutorials/samegame/samegame3/samegame.qml | 56 ++++++ .../tutorials/samegame/samegame4/README | 10 + .../samegame/samegame4/content/BoomBlock.qml | 54 +++++ .../samegame/samegame4/content/Button.qml | 25 +++ .../samegame/samegame4/content/Dialog.qml | 21 ++ .../samegame/samegame4/content/pics/background.png | Bin 0 -> 153328 bytes .../samegame/samegame4/content/pics/blueStar.png | Bin 0 -> 278 bytes .../samegame/samegame4/content/pics/blueStone.png | Bin 0 -> 2691 bytes .../samegame/samegame4/content/pics/greenStar.png | Bin 0 -> 273 bytes .../samegame/samegame4/content/pics/greenStone.png | Bin 0 -> 2662 bytes .../samegame/samegame4/content/pics/redStar.png | Bin 0 -> 274 bytes .../samegame/samegame4/content/pics/redStone.png | Bin 0 -> 2604 bytes .../samegame/samegame4/content/pics/star.png | Bin 0 -> 262 bytes .../samegame4/content/pics/yellowStone.png | Bin 0 -> 2667 bytes .../samegame/samegame4/content/samegame.js | 217 +++++++++++++++++++++ .../tutorials/samegame/samegame4/highscores/README | 1 + .../samegame/samegame4/highscores/score_data.xml | 2 + .../samegame/samegame4/highscores/score_style.xsl | 28 +++ .../samegame/samegame4/highscores/scores.php | 34 ++++ .../tutorials/samegame/samegame4/samegame.qml | 71 +++++++ 45 files changed, 1540 insertions(+) create mode 100644 doc/src/declarative/advtutorial.qdoc create mode 100644 doc/src/declarative/advtutorial1.qdoc create mode 100644 doc/src/declarative/advtutorial2.qdoc create mode 100644 doc/src/declarative/advtutorial3.qdoc create mode 100644 doc/src/declarative/advtutorial4.qdoc create mode 100644 examples/declarative/tutorials/samegame/samegame1/Block.qml create mode 100644 examples/declarative/tutorials/samegame/samegame1/Button.qml create mode 100644 examples/declarative/tutorials/samegame/samegame1/pics/background.png create mode 100644 examples/declarative/tutorials/samegame/samegame1/pics/redStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame1/samegame.qml create mode 100644 examples/declarative/tutorials/samegame/samegame2/Block.qml create mode 100644 examples/declarative/tutorials/samegame/samegame2/Button.qml create mode 100644 examples/declarative/tutorials/samegame/samegame2/pics/background.png create mode 100644 examples/declarative/tutorials/samegame/samegame2/pics/redStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame2/samegame.js create mode 100644 examples/declarative/tutorials/samegame/samegame2/samegame.qml create mode 100644 examples/declarative/tutorials/samegame/samegame3/Block.qml create mode 100644 examples/declarative/tutorials/samegame/samegame3/Button.qml create mode 100644 examples/declarative/tutorials/samegame/samegame3/Dialog.qml create mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/background.png create mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/blueStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/greenStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/redStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame3/samegame.js create mode 100644 examples/declarative/tutorials/samegame/samegame3/samegame.qml create mode 100644 examples/declarative/tutorials/samegame/samegame4/README create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/Button.qml create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/background.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/star.png create mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png create mode 100755 examples/declarative/tutorials/samegame/samegame4/content/samegame.js create mode 100644 examples/declarative/tutorials/samegame/samegame4/highscores/README create mode 100755 examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml create mode 100755 examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl create mode 100755 examples/declarative/tutorials/samegame/samegame4/highscores/scores.php create mode 100644 examples/declarative/tutorials/samegame/samegame4/samegame.qml diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc new file mode 100644 index 0000000..c8075de --- /dev/null +++ b/doc/src/declarative/advtutorial.qdoc @@ -0,0 +1,18 @@ +/*! +\page advtutorial.html +\title Advanced Tutorial + +This tutorial goes step-by-step through creating a full application using just QML. It is assumed that you already know basic QML (such as from doing the simple tutorial) and the focus is on showing how to turn that knowledge into a complete and functioning application. + +In this tutorial we recreate, step by step, the Same Game demo in $QTDIR/demos/declarative/samegame.qml. The results of the individual steps are in the $QTDIR/examples/declarative/tutorials/samegame directory. + +Tutorial chapters: + +\list +\o \l {advtutorial1}{Advanced Tutorial 1 - Basic Game Screen and Block} +\o \l {advtutorial2}{Advanced Tutorial 2 - Dynamically create the Blocks} +\o \l {advtutorial3}{Advanced Tutorial 3 - Implement the Game Logic} +\o \l {advtutorial4}{Advanced Tutorial 4 - Finishing Touches} +\endlist + +*/ diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc new file mode 100644 index 0000000..b940986 --- /dev/null +++ b/doc/src/declarative/advtutorial1.qdoc @@ -0,0 +1,116 @@ +/*! +\page advtutorial1.html +\example declarative/tutorials/samegame/samegame1 +\title Advanced Tutorial 1 - Creating the Game canvas and block +\target advtutorial1 + +The first step is to create the items in your application. In Same Game we have a main game screen and the blocks that populate it. + +\image declarative-adv-tutorial1.png + +Here is the QML code for the basic elements. The game window: + +\code +import Qt 4.6 + +Rectangle { + id: Screen + width: 490; height: 720 + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "pics/background.png" + fillMode: "PreserveAspectCrop" + } + } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: print("Implement me!"); + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: Who knows?"; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} +\endcode + +This gives you a basic game window, with room for the game canvas. A new game +button and room to display the score. The one thing you may not recognize here +is the SystemPalette item. This item provides access to the Qt system palette +and is used to make the button look more like a system button (for exact native +feel you would use a QPushButton). Since we want a fully QML button, and the Fx +primitives don't include a button, we had to write our own. Below is the code +which we wrote to do this: + +\code +import Qt 4.6 + +Rectangle { + id: Container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + + Text { + id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + } +} +\endcode +Note that this Button component was written to be fairly generic, in case we +want to use a similarly styled button later. + +And here is a simple block: +\code +import Qt 4.6 + +Item { + id:block + + Image { id: img + source: "pics/redStone.png"; + anchors.fill: parent + } +} +\endcode + +Since it doesn't do anything yet it's very simple, just an image. As the +tutorial progresses and the block starts doing things the file will become +more than just an image. Note that we've set the image to be the size of the itm. This will be used later, when we dynamically create and size the block items the image will be scaled automatically to the correct size. + +You should be familiar with all that goes on in these files so far. This is a +very basic start and doesn't move at all - next we will populate the game canvas +with some blocks. + +[\l {advtutorial.html}{Advanced Tutorial}] [Next: \l {advtutorial2}{Advanced Tutorial 2}] +*/ + diff --git a/doc/src/declarative/advtutorial2.qdoc b/doc/src/declarative/advtutorial2.qdoc new file mode 100644 index 0000000..c17f9c4 --- /dev/null +++ b/doc/src/declarative/advtutorial2.qdoc @@ -0,0 +1,113 @@ +/*! +\page advtutorial2.html +\title Advanced Tutorial 2 - Populating the Game Canvas +\target advtutorial2 + +Now that we've written some basic elements, let's start writing the game. The +first thing to do is to generate all of the blocks. Now we need to dynamically +generate all of these blocks, because you have a new, random set of blocks +every time. As they are dynamically generated every time the new game button is +clicked, as opposed to on startup, we will be dynamically generating the blocks +in the ECMA script, as opposed to using a Repeater. + +This adds enough script to justify a new file, samegame.js, the intial version +of which is shown below + +\code +//Note that X/Y referred to here are in game coordinates +var maxX = 10;//Nums are for tileSize 40 +var maxY = 15; +var tileSize = 40; +var maxIndex = maxX*maxY; +var board = new Array(maxIndex); +var tileSrc = "Block.qml"; +var component; + +//Index function used instead of a 2D array +function index(xIdx,yIdx) { + return xIdx + (yIdx * maxX); +} + +function initBoard() +{ + //Calculate board size + maxX = Math.floor(background.width/tileSize); + maxY = Math.floor(background.height/tileSize); + maxIndex = maxY*maxX; + + //Initialize Board + board = new Array(maxIndex); + for(xIdx=0; xIdx= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(board[index(xIdx, yIdx)] == null) + return; + //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + floodFill(xIdx,yIdx, -1); + if(fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function victoryCheck() +{ + //awards bonuses for no tiles left + deservesBonus = true; + for(xIdx=maxX-1; xIdx>=0; xIdx--) + if(board[index(xIdx, maxY - 1)] != null) + deservesBonus = false; + if(deservesBonus) + gameCanvas.score += 500; + //Checks for game over + if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))) + dialog.show("Game Over. Your score is " + gameCanvas.score); +} +\endcode + +You'll notice them referring to the 'gameCanvas' item. This is an item that has been added to the QML for easy interfacing. It is placed next to the background image and replaces the background as the item to create the blocks in. Its code is shown below: +\code + Item { + id: gameCanvas + property int score: 0 + property int tileSize: 40 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); + + MouseRegion { + id: gameMR + anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + } + } +\endcode + +This item is the exact size of the board, contains a score property, and a mouse region for input. The blocks are now created as its children, and its size is used as the noe determining board size. Since it needs to bind its size to a multiple of tileSize, tileSize needs to be moved into a QML property and out of the script file. It can still be accessed from the script. + +The mouse region simply calls handleClick(), which deals with the input events.Should those events cause the player to score, gameCanvas.score is updated. The score display text item has also been changed to bind its text property to gamecanvas.score. Note that if score was a global variable in the samegame.js file yo ucould not bind to it. You can only bind to QML properties. + +victoryCheck() mostly just updates score. But it also pops up a dialog saying 'Game Over' when the game is over. In this example we wanted a pure-QML, animated dialog, and since the Fx primitives set doesn't contain one, we wrote our own. Below is the code for the Dialog element, note how it's designed so as to be quite usable imperatively from within the script file: +\code +import Qt 4.6 + +Rectangle { + id: page + function forceClose() { + page.closed(); + page.opacity = 0; + } + function show(txt) { + MyText.text = txt; + page.opacity = 1; + } + signal closed(); + color: "white"; border.width: 1; width: MyText.width + 20; height: 60; + opacity: 0 + opacity: Behavior { + NumberAnimation { duration: 1000 } + } + Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" } + MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } +} +\endcode +And this is how it's used in the main QML file: +\code + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } +\endcode +Combined with the line of code in victoryCheck, this causes a dialog to appear when the game is over, informing the user of that fact. + +We now have a working game! The blocks can be clicked, the player can score, and the game can end (and then you start a new one). Below is a screenshot of what has been accomplished so far: + +\image declarative-adv-tutorial3.png + +Here is the QML code as it is now for the main file: + +\code +import Qt 4.6 + +Rectangle { + id: Screen + width: 490; height: 720 + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + Script { source: "samegame.js" } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "pics/background.png" + fillMode: "PreserveAspectCrop" + } + + Item { + id: gameCanvas + property int score: 0 + property int tileSize: 40 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); + + MouseRegion { + id: gameMR + anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: initBoard(); + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: " + gameCanvas.score; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} +\endcode + +And the code for the block: +\code +import Qt 4.6 + +Item { + id:block + property int type: 0 + + Image { id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + anchors.fill: parent + } +} +\endcode + +The game works, but it's a little boring right now. Where's the smooth animated transitions? Where's the high scores? If you were a QML expert you could have written these in for the first iteration, but in this tutorial they've been saved until the next chapter - where your application becomes alive! + +[Previous: \l {advtutorial2}{Advanced Tutorial 2}] [\l {advtutorial.html}{Advanced Tutorial}] [Next: \l {advtutorial4}{Advanced Tutorial 4}] + +*/ + diff --git a/doc/src/declarative/advtutorial4.qdoc b/doc/src/declarative/advtutorial4.qdoc new file mode 100644 index 0000000..5ad1ec3 --- /dev/null +++ b/doc/src/declarative/advtutorial4.qdoc @@ -0,0 +1,120 @@ +/*! +\page advtutorial4.html +\title Advanced Tutorial 4 - Finishing Touches +\target advtutorial4 + +Now we're going to do two things to liven the game up. Animate the blocks and add a web-based high score system. + +If you compare the samegame3 directory with samegame4, you'll noticed that we've cleaned the directory structure up. We now have a lot of files, and so they've been split up into folders - the most notable one being a content folder which we've placed all the QML but the main file. + +\section2 Animated Blocks + +The most vital animations are that the blocks move fluidly around the board. QML has many tools for fluid behavior, and in this case we're going to use the Follow element. By having the script set targetX and targetY, instead of x and y directly, we can set the x and y of the block to a follow. SpringFollow is a property value source, which means that you can set a property to be one of these elements and it will automatically bind the property to the element's value. The SpringFollow's value follows another value over time, when the value it is tracking changes the SpringFollow's value will also change, but it will move smoothly there over time with a spring-like movement (based on the spring parameters specified). This is shown in the below snippet of code from Block.qml: +\code + property int targetX: 0 + property int targetY: 0 + + x: SpringFollow { source: targetX; spring: 2; damping: 0.2 } + y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } +\endcode + +We also have to change the samegame.js code, so that wherever it was setting the x or y it now sets targetX and targetY (including when creating the block). This simple change is all you need to get spring moving blocks that no longer teleport around the board. If you try doing just this though, you'll notice that they now never jump from one point to another, even in the initialization! This gives an odd effect of having them all jump out of the corner (0,0) on start up. We'd rather that they fall down from the top in rows. To do this, we disable the x Follow (but not the y follow) and only enable it after we've set the x in the createBlock function. The above snippet now becomes: + +\code + property bool spawned: false + property int targetX: 0 + property int targetY: 0 + + x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } +\endcode + +The next-most vital animation is a smooth exit. For this animation, we'll use a Behavior element. A Behavior is also a property value source, and it is much like SpringFollow except that it doesn't model the behavior of a spring. You specify how a Behavior transitions using the standard animations. As we want the blocks to smoothly fade in and out we'll set a Behavior on the block image's opacity, like so: +\code + Image { id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + anchors.fill: parent + } +\endcode + +Note that the 'opacity: 0' makes it start out transparent. We could set the opacity in the script file when we create the blocks, but instead we use states (as this is useful for the next animation we'll implement). The below snippet is set on the root element of Block.qml: +\code + property bool dying: false + states: [ + State{ name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, State{ name: "DeathState"; when: dying == true + PropertyChanges { target: img; opacity: 0 } + } + ] +\endcode + +Now it will automatically fade in, as we set spawned to true already when implementing the block movement animations. To fade out, we set 'dying' to true instead of setting opacity to 0 when a block is destroyed (in the floodFill function). + +The least vital animations are a cool-looking particle effect when they get destroyed. First we create a Particles Element in the block, like so: +\code + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; opacity: 0 + lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false + angle: 0; angleDeviation: 360; velocity: 100; velocityDeviation:30 + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } +\endcode +To fully understand this you'll want to look at the Particles element documentation, but it's important to note that count is set to zero. +We next extend the 'dying' state, which triggers the particles by setting the count to non-zero. The code for that state looks like this: +\code + State{ name: "DeathState"; when: dying == true + PropertyChanges { target: particles; count: 50 } + PropertyChanges { target: particles; opacity: 1 } + PropertyChanges { target: particles; emitting: false } // i.e. emit only once + PropertyChanges { target: img; opacity: 0 } + } +\endcode +And now the game should be beautifully animated and smooth, with a subtle (or not-so-subtle) animation added for all of the player's actions. + +\section2 Web-based High Scores + +Another extension we might want for the game is some way of storing and retriveing high scores. In this tutorial we'll show you how to integrate a web enabled high score storage into your QML application. The implementation we've done is very simple - the high score data is posted to a php script running on a server somewhere, and that server then stores it and displays it to visitors. You could request an XML or QML file from that same server, which contained and displayed the scores, but that's beyond the scope of this tutorial. + +For better high score data, we want the name and time of the player. The time is obtained in the script fairly simply, but we have to ask the player for their name. We thus re-use the dialog QML file to pop up a dialog asking for the player's name (and if they exit this dialog without entering it they have a way to opt out of posting their high score). When the dialog is closed, if the player entered their name we can send the data to the web service in the followign snippet out of the script file: +\code +function sendHighScore(name) { + var postman = new XMLHttpRequest() + var postData = "name="+name+"&score="+gameCanvas.score + +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); + postman.open("POST", scoresURL, true); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + dialog.show("Your score has been uploaded."); + } + } + postman.send(postData); +} +\endcode + +This is the same XMLHttpRequest() as you'll find in browser javascript, and can be used in the same way to dynamically get XML or QML from the web service to display the high scores. We don't worry about the response here though, we just post the high score data to the web server. If it had returned a QML file (or a URL to a QML file) you could instantiate it in much the same way as you did the blocks. + +An alternate way to access and submit web-based data would be to use QML elements designed for this purpose - XmlListModel makes it very easy to fetch and display XML based data such as RSS in a QML application (see the Flickr demo for an example). + +By following this tutorial you've now ben shown how to write a fully functional application in QML, with the application logic written in a script file and with both many fluid animations and being web-enabled. Congratulations, you should now be skilled enough to write your own QML applications. + +[Previous: \l {advtutorial3}{Advanced Tutorial 3}] [\l {advtutorial.html}{Advanced Tutorial}] +*/ diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 06cba15..f94b9f8 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -64,6 +64,7 @@ \list \o \l {qmlexamples}{Examples} \o \l {tutorial}{Tutorial: 'Hello World'} + \o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'} \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} \o \l {qmlforcpp}{QML For C++ Programmers} \endlist diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml new file mode 100644 index 0000000..228ac4e --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id:block + + Image { id: img + source: "pics/redStone.png"; + anchors.fill: parent + } +} diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml new file mode 100644 index 0000000..2354218 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Rectangle { + id: Container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + + Text { + id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + } +} diff --git a/examples/declarative/tutorials/samegame/samegame1/pics/background.png b/examples/declarative/tutorials/samegame/samegame1/pics/background.png new file mode 100644 index 0000000..25e885f Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame1/pics/background.png differ diff --git a/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png new file mode 100644 index 0000000..b099f60 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml new file mode 100644 index 0000000..d18718d --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -0,0 +1,38 @@ +import Qt 4.6 + +Rectangle { + id: Screen + width: 490; height: 720 + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "pics/background.png" + fillMode: "PreserveAspectCrop" + } + } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: print("Implement me!"); + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: Who knows?"; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml new file mode 100644 index 0000000..228ac4e --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id:block + + Image { id: img + source: "pics/redStone.png"; + anchors.fill: parent + } +} diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml new file mode 100644 index 0000000..2354218 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Rectangle { + id: Container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + + Text { + id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + } +} diff --git a/examples/declarative/tutorials/samegame/samegame2/pics/background.png b/examples/declarative/tutorials/samegame/samegame2/pics/background.png new file mode 100644 index 0000000..25e885f Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame2/pics/background.png differ diff --git a/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png new file mode 100644 index 0000000..b099f60 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js new file mode 100644 index 0000000..064d87e --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -0,0 +1,59 @@ +//Note that X/Y referred to here are in game coordinates +var maxX = 10;//Nums are for tileSize 40 +var maxY = 15; +var tileSize = 40; +var maxIndex = maxX*maxY; +var board = new Array(maxIndex); +var tileSrc = "Block.qml"; +var component; + +//Index function used instead of a 2D array +function index(xIdx,yIdx) { + return xIdx + (yIdx * maxX); +} + +function initBoard() +{ + //Calculate board size + maxX = Math.floor(background.width/tileSize); + maxY = Math.floor(background.height/tileSize); + maxIndex = maxY*maxX; + + //Initialize Board + board = new Array(maxIndex); + for(xIdx=0; xIdx= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(board[index(xIdx, yIdx)] == null) + return; + //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + floodFill(xIdx,yIdx, -1); + if(fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function floodFill(xIdx,yIdx,type) +{ + if(board[index(xIdx, yIdx)] == null) + return; + var first = false; + if(type == -1){ + first = true; + type = board[index(xIdx,yIdx)].type; + + //Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + return; + floodBoard[index(xIdx, yIdx)] = 1; + floodFill(xIdx+1,yIdx,type); + floodFill(xIdx-1,yIdx,type); + floodFill(xIdx,yIdx+1,type); + floodFill(xIdx,yIdx-1,type); + if(first==true && fillFound == 0) + return;//Can't remove single tiles + board[index(xIdx,yIdx)].opacity = 0; + board[index(xIdx,yIdx)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + //Fall down + for(xIdx=0; xIdx=0; yIdx--){ + if(board[index(xIdx,yIdx)] == null){ + fallDist += 1; + }else{ + if(fallDist > 0){ + obj = board[index(xIdx,yIdx)]; + obj.y += fallDist * gameCanvas.tileSize; + board[index(xIdx,yIdx+fallDist)] = obj; + board[index(xIdx,yIdx)] = null; + } + } + } + } + //Fall to the left + fallDist = 0; + for(xIdx=0; xIdx 0){ + for(yIdx=0; yIdx=0; xIdx--) + if(board[index(xIdx, maxY - 1)] != null) + deservesBonus = false; + if(deservesBonus) + gameCanvas.score += 500; + //Checks for game over + if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))) + dialog.show("Game Over. Your score is " + gameCanvas.score); +} + +//only floods up and right, to see if it can find adjacent same-typed tiles +function floodMoveCheck(xIdx, yIdx, type) +{ + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return false; + if(board[index(xIdx, yIdx)] == null) + return false; + myType = board[index(xIdx, yIdx)].type; + if(type == myType) + return true; + return floodMoveCheck(xIdx + 1, yIdx, myType) || + floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); +} diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml new file mode 100644 index 0000000..ea43ab2 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -0,0 +1,56 @@ +import Qt 4.6 + +Rectangle { + id: Screen + width: 490; height: 720 + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + Script { source: "samegame.js" } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "pics/background.png" + fillMode: "PreserveAspectCrop" + } + + Item { + id: gameCanvas + property int score: 0 + property int tileSize: 40 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); + + MouseRegion { + id: gameMR + anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: initBoard(); + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: " + gameCanvas.score; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} diff --git a/examples/declarative/tutorials/samegame/samegame4/README b/examples/declarative/tutorials/samegame/samegame4/README new file mode 100644 index 0000000..244b205 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/README @@ -0,0 +1,10 @@ +This demo uses pictures from the KDE project (www.kde.org), +specifically the images from the KSame game. These images are + +background.png +blueStone.png +redStone.png +greenStone.png +yellowStone.png + +and are presumably under the same GPL2 license as the rest of kdegames diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml new file mode 100644 index 0000000..a495cd0 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -0,0 +1,54 @@ +import Qt 4.6 + +Item { id:block + property bool dying: false + property bool spawned: false + property int type: 0 + property int targetX: 0 + property int targetY: 0 + + x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + + Image { id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + anchors.fill: parent + } + + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; opacity: 0 + lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false + angle: 0; angleDeviation: 360; velocity: 100; velocityDeviation:30 + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } + + states: [ + State{ name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + State{ name: "DeathState"; when: dying == true + PropertyChanges { target: particles; count: 50 } + PropertyChanges { target: particles; opacity: 1 } + PropertyChanges { target: particles; emitting: false } // i.e. emit only once + PropertyChanges { target: img; opacity: 0 } + } + ] +} diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml new file mode 100644 index 0000000..2354218 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Rectangle { + id: Container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + + Text { + id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + } +} diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml new file mode 100644 index 0000000..401d211 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -0,0 +1,21 @@ +import Qt 4.6 + +Rectangle { + id: page + function forceClose() { + page.closed(); + page.opacity = 0; + } + function show(txt) { + MyText.text = txt; + page.opacity = 1; + } + signal closed(); + color: "white"; border.width: 1; width: MyText.width + 20; height: 60; + opacity: 0 + opacity: Behavior { + NumberAnimation { duration: 1000 } + } + Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" } + MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } +} diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png new file mode 100644 index 0000000..25e885f Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png new file mode 100644 index 0000000..ff9588f Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png new file mode 100644 index 0000000..bf342e0 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png new file mode 100644 index 0000000..cd06854 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png new file mode 100644 index 0000000..5ac14a5 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png new file mode 100644 index 0000000..0a4dffe Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png new file mode 100644 index 0000000..b099f60 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png new file mode 100644 index 0000000..defbde5 Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png new file mode 100644 index 0000000..c56124a Binary files /dev/null and b/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js new file mode 100755 index 0000000..cf55b59 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -0,0 +1,217 @@ +/* This script file handles the game logic */ +//Note that X/Y referred to here are in game coordinates +var maxX = 10;//Nums are for tileSize 40 +var maxY = 15; +var tileSize = 40; +var maxIndex = maxX*maxY; +var board = new Array(maxIndex); +var tileSrc = "content/BoomBlock.qml"; +var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; +var timer; +var component; + +//Index function used instead of a 2D array +function index(xIdx,yIdx) { + return xIdx + (yIdx * maxX); +} + +function timeStr(msecs) { + var secs = Math.floor(msecs/1000); + var m = Math.floor(secs/60); + var ret = "" + m + "m " + (secs%60) + "s"; + return ret; +} + +function initBoard() +{ + for(i = 0; i= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(board[index(xIdx, yIdx)] == null) + return; + //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + floodFill(xIdx,yIdx, -1); + if(fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function floodFill(xIdx,yIdx,type) +{ + if(board[index(xIdx, yIdx)] == null) + return; + var first = false; + if(type == -1){ + first = true; + type = board[index(xIdx,yIdx)].type; + + //Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + return; + floodBoard[index(xIdx, yIdx)] = 1; + floodFill(xIdx+1,yIdx,type); + floodFill(xIdx-1,yIdx,type); + floodFill(xIdx,yIdx+1,type); + floodFill(xIdx,yIdx-1,type); + if(first==true && fillFound == 0) + return;//Can't remove single tiles + board[index(xIdx,yIdx)].dying = true; + board[index(xIdx,yIdx)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + //Fall down + for(xIdx=0; xIdx=0; yIdx--){ + if(board[index(xIdx,yIdx)] == null){ + fallDist += 1; + }else{ + if(fallDist > 0){ + obj = board[index(xIdx,yIdx)]; + obj.targetY += fallDist * tileSize; + board[index(xIdx,yIdx+fallDist)] = obj; + board[index(xIdx,yIdx)] = null; + } + } + } + } + //Fall to the left + fallDist = 0; + for(xIdx=0; xIdx 0){ + for(yIdx=0; yIdx=0; xIdx--) + if(board[index(xIdx, maxY - 1)] != null) + deservesBonus = false; + if(deservesBonus) + gameCanvas.score += 500; + //Checks for game over + if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ + timer = new Date() - timer; + if(scoresURL != "") + scoreName.show("You've won! Please enter your name: "); + else + dialog.show("Game Over. Your score is " + gameCanvas.score); + } +} + +//only floods up and right, to see if it can find adjacent same-typed tiles +function floodMoveCheck(xIdx, yIdx, type) +{ + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return false; + if(board[index(xIdx, yIdx)] == null) + return false; + myType = board[index(xIdx, yIdx)].type; + if(type == myType) + return true; + return floodMoveCheck(xIdx + 1, yIdx, myType) || + floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); +} + +function createBlock(xIdx,yIdx){ + if(component==null) + component = createComponent(tileSrc); + + // Note that we don't wait for the component to become ready. This will + // only work if the block QML is a local file. Otherwise the component will + // not be ready immediately. There is a statusChanged signal on the + // component you could use if you want to wait to load remote files. + if(component.isReady){ + dynamicObject = component.createObject(); + if(dynamicObject == null){ + print("error creating block"); + print(component.errorsString()); + return false; + } + dynamicObject.type = Math.floor(Math.random() * 3); + dynamicObject.parent = gameCanvas; + dynamicObject.x = xIdx*tileSize; + dynamicObject.targetX = xIdx*tileSize; + dynamicObject.targetY = yIdx*tileSize; + dynamicObject.width = tileSize; + dynamicObject.height = tileSize; + dynamicObject.spawned = true; + board[index(xIdx,yIdx)] = dynamicObject; + }else{//isError or isLoading + print("error loading block component"); + print(component.errorsString()); + return false; + } + return true; +} + +function sendHighScore(name) { + var postman = new XMLHttpRequest() + var postData = "name="+name+"&score="+gameCanvas.score + +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); + postman.open("POST", scoresURL, true); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + dialog.show("Your score has been uploaded."); + } + } + postman.send(postData); +} diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/README b/examples/declarative/tutorials/samegame/samegame4/highscores/README new file mode 100644 index 0000000..eaa00fa --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/highscores/README @@ -0,0 +1 @@ +The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it. diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml new file mode 100755 index 0000000..c3fd90d --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml @@ -0,0 +1,2 @@ +1000000Alan the Tester0x00 +6213Alan12x1751 diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl new file mode 100755 index 0000000..670354c --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl @@ -0,0 +1,28 @@ + + + + + SameGame High Scores + +

SameGame High Scores

+
+ + + + + + + + + + + + + + + +
NameScoreGrid SizeTime, s
+ + + + diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php b/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php new file mode 100755 index 0000000..3cceb2d --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php @@ -0,0 +1,34 @@ +"; + echo "SameGame High Scores"; + if($score > 0){#Sending in a new high score + $name = $_POST["name"]; + $grid = $_POST["gridSize"]; + $time = $_POST["time"]; + if($name == "") + $name = "Anonymous"; + //if($grid != "10x10"){ + //Need a standard, so as to reject others? + //} + $file = fopen("score_data.xml", "a"); #It's XML. Happy? + $ret = fwrite($file, "". $score . "" + . $name . "" . $grid . "" + . $time . "\n"); + echo "Your score has been recorded. Thanks for playing!"; + if($ret == False) + echo "
There was an error though, so don't expect to see that score again."; + }else{#Read high score list + #Now uses XSLT to display. So just print the file. With XML cruft added. + #Note that firefox at least won't apply the XSLT on a php file. So redirecting + $file = fopen("scores.xml", "w"); + $ret = fwrite($file, '' . "\n" + . '' . "\n" + . "\n" . file_get_contents("score_data.xml") . "\n"); + if($ret == False) + echo "There was an internal error. Sorry."; + else + echo ''; + } + echo ""; +?> diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml new file mode 100644 index 0000000..ede4362 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -0,0 +1,71 @@ +import Qt 4.6 +import "content" + +Rectangle { + id: Screen + width: 490; height: 720 + + Script { source: "content/samegame.js" } + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "content/pics/background.png" + fillMode: "PreserveAspectCrop" + } + + Item { + id: gameCanvas + property int score: 0 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); + + MouseRegion { + id: gameMR + anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + Dialog { + id: scoreName; anchors.centerIn: parent; z: 22; + TextInput { + id: Editor + onAccepted: { + if(scoreName.opacity==1&&Editor.text!="") + sendHighScore(Editor.text); + scoreName.forceClose(); + } + anchors.verticalCenter: parent.verticalCenter + width: 72; focus: true + anchors.right: scoreName.right + } + } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: {initBoard();} + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: " + gameCanvas.score; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} -- cgit v0.12 From e1452cfc79a1fed77e646427092e181b7eb2ca2f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 7 Oct 2009 11:18:22 +1000 Subject: Fix portability of visual tests: fix filenames to be relative to base (URL). Still not font-portable. --- .../bindinganimation/data/bindinganimation.qml | 4 ++-- .../visual/colorAnimation/data/colorAnimation.qml | 6 +++--- tests/auto/declarative/visual/easing/data/easing.qml | 6 +++--- .../declarative/visual/flickable/data/flickable.qml | 6 +++--- .../auto/declarative/visual/focusscope/data/test.qml | 12 ++++++------ .../declarative/visual/focusscope/data/test2.qml | 4 ++-- .../declarative/visual/focusscope/data/test3.qml | 20 ++++++++++---------- .../visual/pauseAnimation/data/pauseAnimation.qml | 12 ++++++------ .../declarative/visual/qfxtext/elide/data/elide.qml | 2 +- .../auto/declarative/visual/repeater/data/basic1.qml | 2 +- .../auto/declarative/visual/repeater/data/basic2.qml | 2 +- .../auto/declarative/visual/repeater/data/basic3.qml | 2 +- .../auto/declarative/visual/repeater/data/basic4.qml | 2 +- tests/auto/declarative/visual/tst_visual.cpp | 2 ++ tools/qmlviewer/qfxtester.cpp | 4 ++-- tools/qmlviewer/qfxtester.h | 8 ++++---- 16 files changed, 48 insertions(+), 46 deletions(-) diff --git a/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.qml index 1d2f6da..2501797 100644 --- a/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.qml +++ b/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.0.png" + image: "bindinganimation.0.png" } Frame { msec: 976 @@ -498,7 +498,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/bindinganimation/data/bindinganimation.1.png" + image: "bindinganimation.1.png" } Frame { msec: 1936 diff --git a/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.qml index 8f7f068..6654021 100644 --- a/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.qml +++ b/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.qml @@ -258,7 +258,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.0.png" + image: "colorAnimation.0.png" } Frame { msec: 976 @@ -498,7 +498,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.1.png" + image: "colorAnimation.1.png" } Frame { msec: 1936 @@ -738,7 +738,7 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/colorAnimation/data/colorAnimation.2.png" + image: "colorAnimation.2.png" } Frame { msec: 2896 diff --git a/tests/auto/declarative/visual/easing/data/easing.qml b/tests/auto/declarative/visual/easing/data/easing.qml index d991596..c41d676 100644 --- a/tests/auto/declarative/visual/easing/data/easing.qml +++ b/tests/auto/declarative/visual/easing/data/easing.qml @@ -258,7 +258,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/easing/data/easing.0.png" + image: "easing.0.png" } Frame { msec: 976 @@ -514,7 +514,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/easing/data/easing.1.png" + image: "easing.1.png" } Frame { msec: 1936 @@ -770,7 +770,7 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/easing/data/easing.2.png" + image: "easing.2.png" } Frame { msec: 2896 diff --git a/tests/auto/declarative/visual/flickable/data/flickable.qml b/tests/auto/declarative/visual/flickable/data/flickable.qml index 45bb989..730c128 100644 --- a/tests/auto/declarative/visual/flickable/data/flickable.qml +++ b/tests/auto/declarative/visual/flickable/data/flickable.qml @@ -298,7 +298,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/flickable/data/flickable.0.png" + image: "flickable.0.png" } Frame { msec: 976 @@ -538,7 +538,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/flickable/data/flickable.1.png" + image: "flickable.1.png" } Frame { msec: 1936 @@ -786,6 +786,6 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/flickable/data/flickable.2.png" + image: "flickable.2.png" } } diff --git a/tests/auto/declarative/visual/focusscope/data/test.qml b/tests/auto/declarative/visual/focusscope/data/test.qml index 95e23fc..d86c034 100644 --- a/tests/auto/declarative/visual/focusscope/data/test.qml +++ b/tests/auto/declarative/visual/focusscope/data/test.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.0.png" + image: "test.0.png" } Frame { msec: 976 @@ -506,7 +506,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.1.png" + image: "test.1.png" } Frame { msec: 1936 @@ -770,7 +770,7 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.2.png" + image: "test.2.png" } Frame { msec: 2896 @@ -1042,7 +1042,7 @@ VisualTest { } Frame { msec: 3840 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.3.png" + image: "test.3.png" } Frame { msec: 3856 @@ -1306,7 +1306,7 @@ VisualTest { } Frame { msec: 4800 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.4.png" + image: "test.4.png" } Frame { msec: 4816 @@ -1554,7 +1554,7 @@ VisualTest { } Frame { msec: 5760 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test.5.png" + image: "test.5.png" } Frame { msec: 5776 diff --git a/tests/auto/declarative/visual/focusscope/data/test2.qml b/tests/auto/declarative/visual/focusscope/data/test2.qml index 4ad4b89..fedc96a 100644 --- a/tests/auto/declarative/visual/focusscope/data/test2.qml +++ b/tests/auto/declarative/visual/focusscope/data/test2.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test2.0.png" + image: "test2.0.png" } Frame { msec: 976 @@ -482,7 +482,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test2.1.png" + image: "test2.1.png" } Frame { msec: 1936 diff --git a/tests/auto/declarative/visual/focusscope/data/test3.qml b/tests/auto/declarative/visual/focusscope/data/test3.qml index 86025a6..8ce7944 100644 --- a/tests/auto/declarative/visual/focusscope/data/test3.qml +++ b/tests/auto/declarative/visual/focusscope/data/test3.qml @@ -258,7 +258,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.0.png" + image: "test3.0.png" } Frame { msec: 976 @@ -530,7 +530,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.1.png" + image: "test3.1.png" } Frame { msec: 1936 @@ -802,7 +802,7 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.2.png" + image: "test3.2.png" } Frame { msec: 2896 @@ -1074,7 +1074,7 @@ VisualTest { } Frame { msec: 3840 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.3.png" + image: "test3.3.png" } Frame { msec: 3856 @@ -1330,7 +1330,7 @@ VisualTest { } Frame { msec: 4800 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.4.png" + image: "test3.4.png" } Frame { msec: 4816 @@ -1594,7 +1594,7 @@ VisualTest { } Frame { msec: 5760 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.5.png" + image: "test3.5.png" } Frame { msec: 5776 @@ -1858,7 +1858,7 @@ VisualTest { } Frame { msec: 6720 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.6.png" + image: "test3.6.png" } Frame { msec: 6736 @@ -2130,7 +2130,7 @@ VisualTest { } Frame { msec: 7680 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.7.png" + image: "test3.7.png" } Frame { msec: 7696 @@ -2402,7 +2402,7 @@ VisualTest { } Frame { msec: 8640 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.8.png" + image: "test3.8.png" } Frame { msec: 8656 @@ -2658,7 +2658,7 @@ VisualTest { } Frame { msec: 9600 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/focusscope/data/test3.9.png" + image: "test3.9.png" } Frame { msec: 9616 diff --git a/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.qml b/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.qml index 5d42d03..73c6542 100644 --- a/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.qml +++ b/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.0.png" + image: "pauseAnimation.0.png" } Frame { msec: 976 @@ -482,7 +482,7 @@ VisualTest { } Frame { msec: 1920 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.1.png" + image: "pauseAnimation.1.png" } Frame { msec: 1936 @@ -722,7 +722,7 @@ VisualTest { } Frame { msec: 2880 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.2.png" + image: "pauseAnimation.2.png" } Frame { msec: 2896 @@ -962,7 +962,7 @@ VisualTest { } Frame { msec: 3840 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.3.png" + image: "pauseAnimation.3.png" } Frame { msec: 3856 @@ -1202,7 +1202,7 @@ VisualTest { } Frame { msec: 4800 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.4.png" + image: "pauseAnimation.4.png" } Frame { msec: 4816 @@ -1442,7 +1442,7 @@ VisualTest { } Frame { msec: 5760 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/pauseAnimation/data/pauseAnimation.5.png" + image: "pauseAnimation.5.png" } Frame { msec: 5776 diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/elide.qml b/tests/auto/declarative/visual/qfxtext/elide/data/elide.qml index e62c1b7..59f17f7 100644 --- a/tests/auto/declarative/visual/qfxtext/elide/data/elide.qml +++ b/tests/auto/declarative/visual/qfxtext/elide/data/elide.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/qfxtext/elide/data/elide.0.png" + image: "elide.0.png" } Frame { msec: 976 diff --git a/tests/auto/declarative/visual/repeater/data/basic1.qml b/tests/auto/declarative/visual/repeater/data/basic1.qml index ad7e911..9535a2c 100644 --- a/tests/auto/declarative/visual/repeater/data/basic1.qml +++ b/tests/auto/declarative/visual/repeater/data/basic1.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/repeater/data/basic1.0.png" + image: "basic1.0.png" } Frame { msec: 976 diff --git a/tests/auto/declarative/visual/repeater/data/basic2.qml b/tests/auto/declarative/visual/repeater/data/basic2.qml index 082f349..81bc1f7 100644 --- a/tests/auto/declarative/visual/repeater/data/basic2.qml +++ b/tests/auto/declarative/visual/repeater/data/basic2.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/repeater/data/basic2.0.png" + image: "basic2.0.png" } Frame { msec: 976 diff --git a/tests/auto/declarative/visual/repeater/data/basic3.qml b/tests/auto/declarative/visual/repeater/data/basic3.qml index e76bf6f..417eaab 100644 --- a/tests/auto/declarative/visual/repeater/data/basic3.qml +++ b/tests/auto/declarative/visual/repeater/data/basic3.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/repeater/data/basic3.0.png" + image: "basic3.0.png" } Frame { msec: 976 diff --git a/tests/auto/declarative/visual/repeater/data/basic4.qml b/tests/auto/declarative/visual/repeater/data/basic4.qml index cdff83f..264d825 100644 --- a/tests/auto/declarative/visual/repeater/data/basic4.qml +++ b/tests/auto/declarative/visual/repeater/data/basic4.qml @@ -242,7 +242,7 @@ VisualTest { } Frame { msec: 960 - image: "/Users/akennedy/Qt/kinetic/tests/auto/declarative/visual/repeater/data/basic4.0.png" + image: "basic4.0.png" } Frame { msec: 976 diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index 458b96e..d95fa5b 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -78,6 +78,8 @@ void tst_visual::visual() QProcess p; p.start(qmlviewer, arguments); QVERIFY(p.waitForFinished()); + if (p.exitCode() != 0) + qDebug() << p.readAllStandardError(); QCOMPARE(p.exitStatus(), QProcess::NormalExit); QCOMPARE(p.exitCode(), 0); } diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qmlviewer/qfxtester.cpp index 7903fa9..a6a46eb 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qmlviewer/qfxtester.cpp @@ -285,9 +285,9 @@ void QFxTester::updateCurrentTime(int msec) } if (options & QmlViewer::TestImages && !frame->image().isEmpty()) { - QImage goodImage(frame->image()); + QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { - QString reject(frame->image() + ".reject.png"); + QString reject(frame->image().toLocalFile() + ".reject.png"); qWarning() << "QFxTester: Image mismatch. Reject saved to:" << reject; img.save(reject); diff --git a/tools/qmlviewer/qfxtester.h b/tools/qmlviewer/qfxtester.h index bb027f6..52987db 100644 --- a/tools/qmlviewer/qfxtester.h +++ b/tools/qmlviewer/qfxtester.h @@ -44,7 +44,7 @@ class QFxVisualTestFrame : public QObject Q_OBJECT Q_PROPERTY(int msec READ msec WRITE setMsec) Q_PROPERTY(QString hash READ hash WRITE setHash) - Q_PROPERTY(QString image READ image WRITE setImage) + Q_PROPERTY(QUrl image READ image WRITE setImage) public: QFxVisualTestFrame() : m_msec(-1) {} @@ -54,13 +54,13 @@ public: QString hash() const { return m_hash; } void setHash(const QString &hash) { m_hash = hash; } - QString image() const { return m_image; } - void setImage(const QString &image) { m_image = image; } + QUrl image() const { return m_image; } + void setImage(const QUrl &image) { m_image = image; } private: int m_msec; QString m_hash; - QString m_image; + QUrl m_image; }; QML_DECLARE_TYPE(QFxVisualTestFrame) -- cgit v0.12 From a996e73fa08f97ddbe5b860445d2ec7bd5cd69d0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 7 Oct 2009 11:31:36 +1000 Subject: Remove QFxFlowView and flowview example (will be moved to research/declarative-ui-examples). Functionality should eventually be added to grid view. --- examples/declarative/flowview/FlickrView.qml | 46 ---- examples/declarative/flowview/RoundedRect.qml | 4 - examples/declarative/flowview/flowview.qml | 147 ---------- src/declarative/extra/extra.pri | 2 - src/declarative/extra/qfxflowview.cpp | 379 -------------------------- src/declarative/extra/qfxflowview.h | 108 -------- 6 files changed, 686 deletions(-) delete mode 100644 examples/declarative/flowview/FlickrView.qml delete mode 100644 examples/declarative/flowview/RoundedRect.qml delete mode 100644 examples/declarative/flowview/flowview.qml delete mode 100644 src/declarative/extra/qfxflowview.cpp delete mode 100644 src/declarative/extra/qfxflowview.h diff --git a/examples/declarative/flowview/FlickrView.qml b/examples/declarative/flowview/FlickrView.qml deleted file mode 100644 index b73ae1a..0000000 --- a/examples/declarative/flowview/FlickrView.qml +++ /dev/null @@ -1,46 +0,0 @@ -import Qt 4.6 - -Rectangle { - radius: 5; - border.width: 1; - width:400; - height: 120; - color: background; - - XmlListModel { - id: feedModel - source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2" - query: "/rss/channel/item" - namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" } - XmlRole { name: "url"; query: "media:content/@url/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "tags"; query: "media:category/string()" } - XmlRole { name: "photoWidth"; query: "media:content/@width/string()" } - XmlRole { name: "photoHeight"; query: "media:content/@height/string()" } - XmlRole { name: "photoType"; query: "media:content/@type/string()" } - XmlRole { name: "photoAuthor"; query: "author/string()" } - XmlRole { name: "photoDate"; query: "pubDate/string()" } - } - - ListView { - clip: true - orientation: "Horizontal" - width: parent.width - height: 86 - y: 17 - model: feedModel - delegate: - Item { width: 90; height: 86 - Rectangle { - anchors.centerIn: parent - width: 86; height: 86; - color: "white"; radius: 5 - Image { source: imagePath; x: 5; y: 5 } - } - } - } -} - diff --git a/examples/declarative/flowview/RoundedRect.qml b/examples/declarative/flowview/RoundedRect.qml deleted file mode 100644 index 7d2b58b..0000000 --- a/examples/declarative/flowview/RoundedRect.qml +++ /dev/null @@ -1,4 +0,0 @@ -import Qt 4.6 - -Rectangle { radius: 5; border.width: 1; width:400; height: 120; color: background; } - diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml deleted file mode 100644 index f6b042d..0000000 --- a/examples/declarative/flowview/flowview.qml +++ /dev/null @@ -1,147 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 800 - height: 800 - color: "black" - - Rectangle { - id: myPhone - transformOrigin: "Center" - anchors.centerIn: parent - width: 800 - height: 480 - clip: true - - states: State { - name: "rotated" - PropertyChanges { target: myListView; z: 2 } - PropertyChanges { target: topBar; y: -30 } - PropertyChanges { target: bottomBar; y: 480 } - PropertyChanges { target: leftBar; x: 0 } - PropertyChanges { target: rightBar; x: 770 } - } - transitions: Transition { - from: "" ; to: "rotated" - reversible: true - SequentialAnimation { - NumberAnimation { targets: [topBar, bottomBar]; properties: "x,y"; easing: "easeInOutQuad" } - NumberAnimation { targets: [leftBar, rightBar]; properties: "x,y"; easing: "easeInOutQuad"} - } - } - - color: "lightsteelblue" - - VisualDataModel { - id: model - model: ListModel { - ListElement { background: "red"; weblet: "RoundedRect.qml" } - ListElement { background: "yellow"; weblet: "RoundedRect.qml" } - ListElement { background: "blue"; weblet: "RoundedRect.qml" } - ListElement { background: "green"; weblet: "FlickrView.qml" } - ListElement { background: "orange"; weblet: "RoundedRect.qml" } - ListElement { background: "lightblue"; weblet: "RoundedRect.qml" } - } - delegate: Package { - Item { id: list; Package.name: "list"; width:120; height: 400; } - Item { id: gridItem; Package.name: "grid"; width:400; height: 120; } - Loader { id: myContent; width:400; height: 120; source: weblet } - - StateGroup { - states: [ - State { - name: "InList" - when: myPhone.state == "rotated" - ParentChange { target: myContent; parent: list } - PropertyChanges { target: myContent; x: 120; y: 0; rotation: 90} - }, - State { - name: "InGrid" - when: myPhone.state != "rotated" - ParentChange { target: myContent; parent: gridItem } - PropertyChanges { target: myContent; x: 0; y: 0; } - } - ] - transitions: [ - Transition { - from: "*"; to: "InGrid" - SequentialAnimation { - ParentAction{} - PauseAnimation { duration: 50 * list.FlowView.column } - NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } - } - }, - Transition { - from: "*"; to: "InList" - SequentialAnimation { - ParentAction{} - PauseAnimation { duration: 50 * (gridItem.FlowView.row * 2 + gridItem.FlowView.column) } - NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } - } - } - ] - } - - } - } - - Item { - FlowView { - id: myListView - vertical: true - y: 40 - x: 40 - width: 800 - height: 400 - column: 1 - model: model.parts.list - } - - FlowView { - z: 1 - y: 60 - width: 800 - height: 400 - column: 2 - model: model.parts.grid - } - } - - Rectangle { - id: topBar - width: 800 - height: 30 - } - Rectangle { - id: bottomBar - width: 800 - height: 30 - y: 450 - } - Rectangle { - id: leftBar - x: -30 - width: 30 - height: 480 - } - Rectangle { - id: rightBar - x: 800 - width: 30 - height: 480 - } - } - - Rectangle { - width: 80 - height: 80 - anchors.right: parent.right - anchors.bottom: parent.bottom - Text { text: "Switch" } - MouseRegion { - anchors.fill: parent - onClicked: if(myPhone.state == "rotated") myPhone.state=""; else myPhone.state = "rotated"; - } - } - -} diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index ae07a19..6730550 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -5,7 +5,6 @@ SOURCES += \ extra/qfxintegermodel.cpp \ extra/qmlfolderlistmodel.cpp \ extra/qfxanimatedimageitem.cpp \ - extra/qfxflowview.cpp \ extra/qfxparticles.cpp \ extra/qmlbehavior.cpp \ extra/qbindablemap.cpp \ @@ -19,7 +18,6 @@ HEADERS += \ extra/qmlfolderlistmodel.h \ extra/qfxanimatedimageitem.h \ extra/qfxanimatedimageitem_p.h \ - extra/qfxflowview.h \ extra/qfxparticles.h \ extra/qmlbehavior.h \ extra/qbindablemap.h \ diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp deleted file mode 100644 index b2470ba..0000000 --- a/src/declarative/extra/qfxflowview.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxvisualitemmodel.h" -#include "qfxflowview.h" - -#include - -QT_BEGIN_NAMESPACE - -class QFxFlowViewAttached : public QObject -{ -Q_OBJECT -Q_PROPERTY(int row READ row NOTIFY posChanged) -Q_PROPERTY(int column READ column NOTIFY posChanged) -public: - QFxFlowViewAttached(QObject *parent); - - int row() const; - int column() const; - -Q_SIGNALS: - void posChanged(); - -private: - friend class QFxFlowView; - int m_row; - int m_column; -}; - - -QFxFlowView::QFxFlowView() -: m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1) -{ - setAcceptedMouseButtons(Qt::LeftButton); -} - -QFxVisualModel *QFxFlowView::model() const -{ - return m_model; -} - -void QFxFlowView::setModel(QFxVisualModel *m) -{ - m_model = m; - refresh(); -} - -int QFxFlowView::columns() const -{ - return m_columns; -} - -void QFxFlowView::setColumns(int c) -{ - m_columns = c; - refresh(); -} - -bool QFxFlowView::vertical() const -{ - return m_vertical; -} - -void QFxFlowView::setVertical(bool v) -{ - m_vertical = v; -} - -class QFxFlowViewValue : public QmlTimeLineValue -{ -public: - enum Property { xProperty, yProperty }; - - QFxFlowViewValue(QFxItem *item, Property p) - : m_item(item), m_property(p) {} - - qreal value() const { - return (m_property == xProperty)?m_item->x():m_item->y(); - } - void setValue(qreal v) { - if (m_property == xProperty) m_item->setX(v); - else m_item->setY(v); - } -private: - QFxItem *m_item; - Property m_property; -}; - -void QFxFlowView::refresh() -{ - if (m_model && m_columns >= 1) { - for (int ii = 0; ii < m_model->count(); ++ii) { - if (QFxItem *item = m_model->item(ii)) { - item->setParent(this); - item->setZValue(0); - m_items << item; - } - } - - reflow(); - } -} - -void QFxFlowView::reflow(bool animate) -{ - qreal y = 0; - qreal maxY = 0; - qreal x = 0; - int row = 0; - int column = -1; - if (animate) - clearTimeLine(); - - for (int ii = 0; ii < m_items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - row = 0; - column++; - } - - QFxItem *item = m_items.at(ii); - QFxFlowViewAttached *att = - (QFxFlowViewAttached *)qmlAttachedPropertiesObject(item); - att->m_row = row; - att->m_column = column; - emit att->posChanged(); - - - if (animate) { - if (vertical()) - moveItem(item, QPointF(y, x)); - else - moveItem(item, QPointF(x, y)); - } else { - if (vertical()) { - item->setX(y); - item->setY(x); - } else { - item->setX(x); - item->setY(y); - } - } - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - ++row; - } -} - -void QFxFlowView::reflowDrag(const QPointF &dp) -{ - qreal y = 0; - qreal maxY = 0; - qreal x = 0; - - clearTimeLine(); - - QList items; - - bool dragUsed = false; - bool dragSeen = false; - for (int ii = 0; ii < m_items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - } - - QFxItem *item = m_items.at(ii); - if (item == m_dragItem) - dragSeen = true; - if (item == m_dragItem && dragUsed) - continue; - QRectF r; - if (vertical()) - r = QRectF(y, x, item->width(), item->height()); - else - r = QRectF(x, y, item->width(), item->height()); - if (r.contains(dp)) { - dragUsed = true; - if (dragSeen) - m_dragIdx = items.count() + 1; - else - m_dragIdx = items.count(); - - items.append(m_dragItem); - if (m_dragItem != item) { - if (dragSeen) - items.insert(items.count() - 1, item); - else - items.append(item); - } - } else { - if (m_dragItem != item) - items.append(item); - } - - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - } - - y = 0; - maxY = 0; - x = 0; - clearTimeLine(); - for (int ii = 0; ii < items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - } - - QFxItem *item = items.at(ii); - if (item != m_dragItem) { - if (vertical()) - moveItem(item, QPointF(y, x)); - else - moveItem(item, QPointF(x, y)); - } - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - } - -} - -void QFxFlowView::moveItem(QFxItem *item, const QPointF &p) -{ - QFxFlowViewValue *xv = new QFxFlowViewValue(item, QFxFlowViewValue::xProperty); - QFxFlowViewValue *yv = new QFxFlowViewValue(item, QFxFlowViewValue::yProperty); - m_values << xv << yv; - m_timeline.move(*xv, p.x(), 100); - m_timeline.move(*yv, p.y(), 100); -} - -void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - for (int ii = 0; ii < m_items.count(); ++ii) { - QFxItem *item = m_items.at(ii); - QRectF r = rectForItem(ii); - - if (r.contains(event->pos())) { - m_dragItem = item; - m_dragItem->setZValue(1); - m_dragOffset = r.topLeft() - event->pos(); - event->accept(); - return; - } - } - event->ignore(); -} - -QRectF QFxFlowView::rectForItem(int idx) const -{ - QFxItem *item = m_items.at(idx); - QRectF r(item->x(), item->y(), item->width(), item->height()); - return r; -} - -void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - Q_UNUSED(event); - if (m_dragItem) { - m_dragItem->setZValue(0); - - clearTimeLine(); - - if (m_dragIdx != -1) { - m_items.removeAll(m_dragItem); - m_items.insert(m_dragIdx, m_dragItem); - } - - reflow(true); - m_dragItem = 0; - m_dragIdx = -1; - } -} - -QFxFlowViewAttached::QFxFlowViewAttached(QObject *parent) -: QObject(parent), m_row(0), m_column(0) -{ -} - -int QFxFlowViewAttached::row() const -{ - return m_row; -} - -int QFxFlowViewAttached::column() const -{ - return m_column; -} - -QFxFlowViewAttached *QFxFlowView::qmlAttachedProperties(QObject *obj) -{ - return new QFxFlowViewAttached(obj); -} - -void QFxFlowView::clearTimeLine() -{ - m_timeline.clear(); - qDeleteAll(m_values); - m_values.clear(); -} - -void QFxFlowView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - if (m_dragItem) { - QPointF p = event->pos() + m_dragOffset; - m_dragItem->setX(p.x()); - m_dragItem->setY(p.y()); - - for (int ii = 0; ii < m_items.count(); ++ii) { - if (m_items.at(ii) != m_dragItem && rectForItem(ii).contains(event->pos())) { - reflowDrag(event->pos()); - } - } - } -} - -QML_DEFINE_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, FlowView, QFxFlowView); - -QT_END_NAMESPACE - -#include "qfxflowview.moc" diff --git a/src/declarative/extra/qfxflowview.h b/src/declarative/extra/qfxflowview.h deleted file mode 100644 index 2d7a8bd..0000000 --- a/src/declarative/extra/qfxflowview.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXFLOWVIEW_H -#define QFXFLOWVIEW_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QFxVisualModel; -class QFxFlowViewValue; -class QFxFlowViewAttached; -class Q_DECLARATIVE_EXPORT QFxFlowView : public QFxItem -{ - Q_OBJECT - Q_PROPERTY(QFxVisualModel *model READ model WRITE setModel) - Q_PROPERTY(int column READ columns WRITE setColumns) - Q_PROPERTY(bool vertical READ vertical WRITE setVertical) - -public: - QFxFlowView(); - - QFxVisualModel *model() const; - void setModel(QFxVisualModel *); - - int columns() const; - void setColumns(int); - - bool vertical() const; - void setVertical(bool); - - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - - static QFxFlowViewAttached *qmlAttachedProperties(QObject *); - -private: - QRectF rectForItem(int idx) const; - void refresh(); - void reflow(bool animate = false); - void reflowDrag(const QPointF &); - void clearTimeLine(); - int m_columns; - QFxVisualModel *m_model; - QList m_items; - bool m_vertical; - void moveItem(QFxItem *item, const QPointF &); - - QPointF m_dragOffset; - QFxItem *m_dragItem; - - QmlTimeLine m_timeline; - QList m_values; - int m_dragIdx; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QFxFlowView) - -QT_END_HEADER - -#endif // QFXFLOWVIEW_H -- cgit v0.12 From 5b77922f3782de4b96d6cf07ebb88419de130eac Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 12:46:59 +1000 Subject: SameGame tutorial images --- doc/src/declarative/pics/declarative-adv-tutorial1.png | Bin 0 -> 81295 bytes doc/src/declarative/pics/declarative-adv-tutorial2.png | Bin 0 -> 170388 bytes doc/src/declarative/pics/declarative-adv-tutorial3.png | Bin 0 -> 220052 bytes doc/src/declarative/pics/declarative-adv-tutorial4.png | Bin 0 -> 273086 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/src/declarative/pics/declarative-adv-tutorial1.png create mode 100644 doc/src/declarative/pics/declarative-adv-tutorial2.png create mode 100644 doc/src/declarative/pics/declarative-adv-tutorial3.png create mode 100644 doc/src/declarative/pics/declarative-adv-tutorial4.png diff --git a/doc/src/declarative/pics/declarative-adv-tutorial1.png b/doc/src/declarative/pics/declarative-adv-tutorial1.png new file mode 100644 index 0000000..990a329 Binary files /dev/null and b/doc/src/declarative/pics/declarative-adv-tutorial1.png differ diff --git a/doc/src/declarative/pics/declarative-adv-tutorial2.png b/doc/src/declarative/pics/declarative-adv-tutorial2.png new file mode 100644 index 0000000..b410d50 Binary files /dev/null and b/doc/src/declarative/pics/declarative-adv-tutorial2.png differ diff --git a/doc/src/declarative/pics/declarative-adv-tutorial3.png b/doc/src/declarative/pics/declarative-adv-tutorial3.png new file mode 100644 index 0000000..e192772 Binary files /dev/null and b/doc/src/declarative/pics/declarative-adv-tutorial3.png differ diff --git a/doc/src/declarative/pics/declarative-adv-tutorial4.png b/doc/src/declarative/pics/declarative-adv-tutorial4.png new file mode 100644 index 0000000..03c9f46 Binary files /dev/null and b/doc/src/declarative/pics/declarative-adv-tutorial4.png differ -- cgit v0.12 From 19d080d319dccac15654294af80530bed9ef11ea Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 13:12:24 +1000 Subject: Switch Same Game tutorial to using snippets properly --- doc/src/declarative/advtutorial1.qdoc | 80 +--------- doc/src/declarative/advtutorial2.qdoc | 76 +--------- doc/src/declarative/advtutorial3.qdoc | 166 ++------------------- doc/src/declarative/advtutorial4.qdoc | 80 ++-------- .../declarative/pics/declarative-adv-tutorial4.gif | Bin 0 -> 58337629 bytes .../declarative/pics/declarative-adv-tutorial4.png | Bin 273086 -> 0 bytes .../tutorials/samegame/samegame1/Block.qml | 2 + .../tutorials/samegame/samegame1/Button.qml | 2 + .../tutorials/samegame/samegame1/samegame.qml | 2 + .../tutorials/samegame/samegame2/samegame.js | 2 + .../tutorials/samegame/samegame2/samegame.qml | 4 + .../tutorials/samegame/samegame3/Block.qml | 2 + .../tutorials/samegame/samegame3/Dialog.qml | 2 + .../tutorials/samegame/samegame3/samegame.js | 4 + .../tutorials/samegame/samegame3/samegame.qml | 6 + .../samegame/samegame4/content/BoomBlock.qml | 10 +- .../samegame/samegame4/content/samegame.js | 2 + 17 files changed, 73 insertions(+), 367 deletions(-) create mode 100644 doc/src/declarative/pics/declarative-adv-tutorial4.gif delete mode 100644 doc/src/declarative/pics/declarative-adv-tutorial4.png diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc index b940986..48b32cd 100644 --- a/doc/src/declarative/advtutorial1.qdoc +++ b/doc/src/declarative/advtutorial1.qdoc @@ -10,46 +10,7 @@ The first step is to create the items in your application. In Same Game we have Here is the QML code for the basic elements. The game window: -\code -import Qt 4.6 - -Rectangle { - id: Screen - width: 490; height: 720 - - SystemPalette { id: activePalette; colorGroup: Qt.Active } - - Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top - - Image { - id: background - anchors.fill: parent; source: "pics/background.png" - fillMode: "PreserveAspectCrop" - } - } - - Rectangle { - id: ToolBar - color: activePalette.window - height: 32; width: parent.width - anchors.bottom: Screen.bottom - - Button { - id: btnA; text: "New Game"; onClicked: print("Implement me!"); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - - Text { - id: Score - text: "Score: Who knows?"; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - } -} -\endcode +\snippet declarative/tutorials/samegame/samegame1/samegame.qml 0 This gives you a basic game window, with room for the game canvas. A new game button and room to display the score. The one thing you may not recognize here @@ -59,49 +20,14 @@ feel you would use a QPushButton). Since we want a fully QML button, and the Fx primitives don't include a button, we had to write our own. Below is the code which we wrote to do this: -\code -import Qt 4.6 - -Rectangle { - id: Container - - signal clicked - property string text: "Button" - - color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; - - gradient: Gradient { - GradientStop { - id: topGrad; position: 0.0 - color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } +\snippet declarative/tutorials/samegame/samegame1/Button.qml 0 - Text { - id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText - } -} -\endcode Note that this Button component was written to be fairly generic, in case we want to use a similarly styled button later. And here is a simple block: -\code -import Qt 4.6 -Item { - id:block - - Image { id: img - source: "pics/redStone.png"; - anchors.fill: parent - } -} -\endcode +\snippet declarative/tutorials/samegame/samegame1/Block.qml 0 Since it doesn't do anything yet it's very simple, just an image. As the tutorial progresses and the block starts doing things the file will become diff --git a/doc/src/declarative/advtutorial2.qdoc b/doc/src/declarative/advtutorial2.qdoc index c17f9c4..2d2fe19 100644 --- a/doc/src/declarative/advtutorial2.qdoc +++ b/doc/src/declarative/advtutorial2.qdoc @@ -13,68 +13,7 @@ in the ECMA script, as opposed to using a Repeater. This adds enough script to justify a new file, samegame.js, the intial version of which is shown below -\code -//Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for tileSize 40 -var maxY = 15; -var tileSize = 40; -var maxIndex = maxX*maxY; -var board = new Array(maxIndex); -var tileSrc = "Block.qml"; -var component; - -//Index function used instead of a 2D array -function index(xIdx,yIdx) { - return xIdx + (yIdx * maxX); -} - -function initBoard() -{ - //Calculate board size - maxX = Math.floor(background.width/tileSize); - maxY = Math.floor(background.height/tileSize); - maxIndex = maxY*maxX; - - //Initialize Board - board = new Array(maxIndex); - for(xIdx=0; xIdx= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) - return; - if(board[index(xIdx, yIdx)] == null) - return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) - floodFill(xIdx,yIdx, -1); - if(fillFound <= 0) - return; - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - shuffleDown(); - victoryCheck(); -} - -function victoryCheck() -{ - //awards bonuses for no tiles left - deservesBonus = true; - for(xIdx=maxX-1; xIdx>=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) - deservesBonus = false; - if(deservesBonus) - gameCanvas.score += 500; - //Checks for game over - if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))) - dialog.show("Game Over. Your score is " + gameCanvas.score); -} -\endcode +\snippet declarative/tutorials/samegame/samegame3/samegame.js 1 +\snippet declarative/tutorials/samegame/samegame3/samegame.js 2 You'll notice them referring to the 'gameCanvas' item. This is an item that has been added to the QML for easy interfacing. It is placed next to the background image and replaces the background as the item to create the blocks in. Its code is shown below: -\code - Item { - id: gameCanvas - property int score: 0 - property int tileSize: 40 - - z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); - - MouseRegion { - id: gameMR - anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); - } - } -\endcode + +\snippet declarative/tutorials/samegame/samegame3/samegame.qml 1 This item is the exact size of the board, contains a score property, and a mouse region for input. The blocks are now created as its children, and its size is used as the noe determining board size. Since it needs to bind its size to a multiple of tileSize, tileSize needs to be moved into a QML property and out of the script file. It can still be accessed from the script. The mouse region simply calls handleClick(), which deals with the input events.Should those events cause the player to score, gameCanvas.score is updated. The score display text item has also been changed to bind its text property to gamecanvas.score. Note that if score was a global variable in the samegame.js file yo ucould not bind to it. You can only bind to QML properties. victoryCheck() mostly just updates score. But it also pops up a dialog saying 'Game Over' when the game is over. In this example we wanted a pure-QML, animated dialog, and since the Fx primitives set doesn't contain one, we wrote our own. Below is the code for the Dialog element, note how it's designed so as to be quite usable imperatively from within the script file: -\code -import Qt 4.6 - -Rectangle { - id: page - function forceClose() { - page.closed(); - page.opacity = 0; - } - function show(txt) { - MyText.text = txt; - page.opacity = 1; - } - signal closed(); - color: "white"; border.width: 1; width: MyText.width + 20; height: 60; - opacity: 0 - opacity: Behavior { - NumberAnimation { duration: 1000 } - } - Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" } - MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } -} -\endcode + +\snippet declarative/tutorials/samegame/samegame3/Dialog.qml 0 + And this is how it's used in the main QML file: -\code - Dialog { id: dialog; anchors.centerIn: parent; z: 21 } -\endcode + +\snippet declarative/tutorials/samegame/samegame3/samegame.qml 2 + Combined with the line of code in victoryCheck, this causes a dialog to appear when the game is over, informing the user of that fact. We now have a working game! The blocks can be clicked, the player can score, and the game can end (and then you start a new one). Below is a screenshot of what has been accomplished so far: @@ -107,87 +43,11 @@ We now have a working game! The blocks can be clicked, the player can score, and Here is the QML code as it is now for the main file: -\code -import Qt 4.6 - -Rectangle { - id: Screen - width: 490; height: 720 - - SystemPalette { id: activePalette; colorGroup: Qt.Active } - Script { source: "samegame.js" } - - Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top - - Image { - id: background - anchors.fill: parent; source: "pics/background.png" - fillMode: "PreserveAspectCrop" - } - - Item { - id: gameCanvas - property int score: 0 - property int tileSize: 40 - - z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); - - MouseRegion { - id: gameMR - anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); - } - } - } - - Dialog { id: dialog; anchors.centerIn: parent; z: 21 } - - Rectangle { - id: ToolBar - color: activePalette.window - height: 32; width: parent.width - anchors.bottom: Screen.bottom - - Button { - id: btnA; text: "New Game"; onClicked: initBoard(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - - Text { - id: Score - text: "Score: " + gameCanvas.score; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - } -} -\endcode +\snippet declarative/tutorials/samegame/samegame3/samegame.qml 0 And the code for the block: -\code -import Qt 4.6 - -Item { - id:block - property int type: 0 - - Image { id: img - source: { - if(type == 0){ - "pics/redStone.png"; - } else if(type == 1) { - "pics/blueStone.png"; - } else { - "pics/greenStone.png"; - } - } - anchors.fill: parent - } -} -\endcode + +\snippet declarative/tutorials/samegame/samegame3/Block.qml 0 The game works, but it's a little boring right now. Where's the smooth animated transitions? Where's the high scores? If you were a QML expert you could have written these in for the first iteration, but in this tutorial they've been saved until the next chapter - where your application becomes alive! diff --git a/doc/src/declarative/advtutorial4.qdoc b/doc/src/declarative/advtutorial4.qdoc index 5ad1ec3..291d2f2 100644 --- a/doc/src/declarative/advtutorial4.qdoc +++ b/doc/src/declarative/advtutorial4.qdoc @@ -10,6 +10,7 @@ If you compare the samegame3 directory with samegame4, you'll noticed that we've \section2 Animated Blocks The most vital animations are that the blocks move fluidly around the board. QML has many tools for fluid behavior, and in this case we're going to use the Follow element. By having the script set targetX and targetY, instead of x and y directly, we can set the x and y of the block to a follow. SpringFollow is a property value source, which means that you can set a property to be one of these elements and it will automatically bind the property to the element's value. The SpringFollow's value follows another value over time, when the value it is tracking changes the SpringFollow's value will also change, but it will move smoothly there over time with a spring-like movement (based on the spring parameters specified). This is shown in the below snippet of code from Block.qml: + \code property int targetX: 0 property int targetY: 0 @@ -20,32 +21,11 @@ The most vital animations are that the blocks move fluidly around the board. QML We also have to change the samegame.js code, so that wherever it was setting the x or y it now sets targetX and targetY (including when creating the block). This simple change is all you need to get spring moving blocks that no longer teleport around the board. If you try doing just this though, you'll notice that they now never jump from one point to another, even in the initialization! This gives an odd effect of having them all jump out of the corner (0,0) on start up. We'd rather that they fall down from the top in rows. To do this, we disable the x Follow (but not the y follow) and only enable it after we've set the x in the createBlock function. The above snippet now becomes: -\code - property bool spawned: false - property int targetX: 0 - property int targetY: 0 - - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } -\endcode +\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 1 The next-most vital animation is a smooth exit. For this animation, we'll use a Behavior element. A Behavior is also a property value source, and it is much like SpringFollow except that it doesn't model the behavior of a spring. You specify how a Behavior transitions using the standard animations. As we want the blocks to smoothly fade in and out we'll set a Behavior on the block image's opacity, like so: -\code - Image { id: img - source: { - if(type == 0){ - "pics/redStone.png"; - } else if(type == 1) { - "pics/blueStone.png"; - } else { - "pics/greenStone.png"; - } - } - opacity: 0 - opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } - anchors.fill: parent - } -\endcode + +\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 2 Note that the 'opacity: 0' makes it start out transparent. We could set the opacity in the script file when we create the blocks, but instead we use states (as this is useful for the next animation we'll implement). The below snippet is set on the root element of Block.qml: \code @@ -62,53 +42,25 @@ Note that the 'opacity: 0' makes it start out transparent. We could set the opac Now it will automatically fade in, as we set spawned to true already when implementing the block movement animations. To fade out, we set 'dying' to true instead of setting opacity to 0 when a block is destroyed (in the floodFill function). The least vital animations are a cool-looking particle effect when they get destroyed. First we create a Particles Element in the block, like so: -\code - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; opacity: 0 - lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false - angle: 0; angleDeviation: 360; velocity: 100; velocityDeviation:30 - source: { - if(type == 0){ - "pics/redStar.png"; - } else if (type == 1) { - "pics/blueStar.png"; - } else { - "pics/greenStar.png"; - } - } - } -\endcode + +\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 3 + To fully understand this you'll want to look at the Particles element documentation, but it's important to note that count is set to zero. -We next extend the 'dying' state, which triggers the particles by setting the count to non-zero. The code for that state looks like this: -\code - State{ name: "DeathState"; when: dying == true - PropertyChanges { target: particles; count: 50 } - PropertyChanges { target: particles; opacity: 1 } - PropertyChanges { target: particles; emitting: false } // i.e. emit only once - PropertyChanges { target: img; opacity: 0 } - } -\endcode -And now the game should be beautifully animated and smooth, with a subtle (or not-so-subtle) animation added for all of the player's actions. +We next extend the 'dying' state, which triggers the particles by setting the count to non-zero. The code for the states now look like this: + +\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 4 + +And now the game should be beautifully animated and smooth, with a subtle (or not-so-subtle) animation added for all of the player's actions. The end result is shown below: + +\image declarative-adv-tutorial4.gif \section2 Web-based High Scores Another extension we might want for the game is some way of storing and retriveing high scores. In this tutorial we'll show you how to integrate a web enabled high score storage into your QML application. The implementation we've done is very simple - the high score data is posted to a php script running on a server somewhere, and that server then stores it and displays it to visitors. You could request an XML or QML file from that same server, which contained and displayed the scores, but that's beyond the scope of this tutorial. For better high score data, we want the name and time of the player. The time is obtained in the script fairly simply, but we have to ask the player for their name. We thus re-use the dialog QML file to pop up a dialog asking for the player's name (and if they exit this dialog without entering it they have a way to opt out of posting their high score). When the dialog is closed, if the player entered their name we can send the data to the web service in the followign snippet out of the script file: -\code -function sendHighScore(name) { - var postman = new XMLHttpRequest() - var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); - postman.open("POST", scoresURL, true); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - dialog.show("Your score has been uploaded."); - } - } - postman.send(postData); -} -\endcode + +\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 1 This is the same XMLHttpRequest() as you'll find in browser javascript, and can be used in the same way to dynamically get XML or QML from the web service to display the high scores. We don't worry about the response here though, we just post the high score data to the web server. If it had returned a QML file (or a URL to a QML file) you could instantiate it in much the same way as you did the blocks. diff --git a/doc/src/declarative/pics/declarative-adv-tutorial4.gif b/doc/src/declarative/pics/declarative-adv-tutorial4.gif new file mode 100644 index 0000000..a67666d Binary files /dev/null and b/doc/src/declarative/pics/declarative-adv-tutorial4.gif differ diff --git a/doc/src/declarative/pics/declarative-adv-tutorial4.png b/doc/src/declarative/pics/declarative-adv-tutorial4.png deleted file mode 100644 index 03c9f46..0000000 Binary files a/doc/src/declarative/pics/declarative-adv-tutorial4.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml index 228ac4e..b76e61a 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Item { @@ -8,3 +9,4 @@ Item { anchors.fill: parent } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 2354218..3846cf7 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Rectangle { @@ -23,3 +24,4 @@ Rectangle { id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index d18718d..8b32cae 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Rectangle { @@ -36,3 +37,4 @@ Rectangle { } } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 064d87e..2bf68b5 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -1,3 +1,4 @@ +//![0] //Note that X/Y referred to here are in game coordinates var maxX = 10;//Nums are for tileSize 40 var maxY = 15; @@ -57,3 +58,4 @@ function createBlock(xIdx,yIdx){ } return true; } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml index e446fa4..78a3d83 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml @@ -5,7 +5,9 @@ Rectangle { width: 490; height: 720 SystemPalette { id: activePalette; colorGroup: Qt.Active } + //![2] Script { source: "samegame.js" } + //![2] Item { width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top @@ -23,11 +25,13 @@ Rectangle { height: 32; width: parent.width anchors.bottom: Screen.bottom + //![1] Button { id: btnA; text: "New Game"; onClicked: initBoard(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } + //![1] Text { id: Score diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml index 2f28923..30a8d3a 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Item { @@ -17,3 +18,4 @@ Item { anchors.fill: parent } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index 401d211..5fe6aa0 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Rectangle { @@ -19,3 +20,4 @@ Rectangle { Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" } MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js index 16b349d..8fecfef 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js @@ -72,6 +72,7 @@ function createBlock(xIdx,yIdx){ var fillFound;//Set after a floodFill call to the number of tiles found var floodBoard;//Set to 1 if the floodFill reaches off that node //NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope +//![1] function handleClick(x,y) { xIdx = Math.floor(x/gameCanvas.tileSize); @@ -88,6 +89,7 @@ function handleClick(x,y) shuffleDown(); victoryCheck(); } +//![1] function floodFill(xIdx,yIdx,type) { @@ -156,6 +158,7 @@ function shuffleDown() } } +//![2] function victoryCheck() { //awards bonuses for no tiles left @@ -169,6 +172,7 @@ function victoryCheck() if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))) dialog.show("Game Over. Your score is " + gameCanvas.score); } +//![2] //only floods up and right, to see if it can find adjacent same-typed tiles function floodMoveCheck(xIdx, yIdx, type) diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index ea43ab2..a0883da 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -1,3 +1,4 @@ +//![0] import Qt 4.6 Rectangle { @@ -16,6 +17,7 @@ Rectangle { fillMode: "PreserveAspectCrop" } + //![1] Item { id: gameCanvas property int score: 0 @@ -30,9 +32,12 @@ Rectangle { anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); } } + //![1] } + //![2] Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + //![2] Rectangle { id: ToolBar @@ -54,3 +59,4 @@ Rectangle { } } } +//![0] diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index a495cd0..7ad8b07 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -1,15 +1,18 @@ import Qt 4.6 Item { id:block + property int type: 0 property bool dying: false + //![1] property bool spawned: false - property int type: 0 property int targetX: 0 property int targetY: 0 x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + //![1] + //![2] Image { id: img source: { if(type == 0){ @@ -24,7 +27,9 @@ Item { id:block opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } anchors.fill: parent } + //![2] + //![3] Particles { id: particles width:1; height:1; anchors.centerIn: parent; opacity: 0 lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false @@ -39,7 +44,9 @@ Item { id:block } } } + //![3] + //![4] states: [ State{ name: "AliveState"; when: spawned == true && dying == false PropertyChanges { target: img; opacity: 1 } @@ -51,4 +58,5 @@ Item { id:block PropertyChanges { target: img; opacity: 0 } } ] + //![4] } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index cf55b59..ce9c169 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -203,6 +203,7 @@ function createBlock(xIdx,yIdx){ return true; } +//![1] function sendHighScore(name) { var postman = new XMLHttpRequest() var postData = "name="+name+"&score="+gameCanvas.score @@ -215,3 +216,4 @@ function sendHighScore(name) { } postman.send(postData); } +//![1] -- cgit v0.12 From 07b3465405ccd59dc5c447cffc47cc1a17f674f0 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 15:18:06 +1000 Subject: Add three failing tests to the QML ECMAscript autotest Tests the creation, deletion and toString functions for QML objects. Task-number: QT-2252 --- .../qmlecmascript/data/dynamicCreation.helper.qml | 5 ++ .../qmlecmascript/data/dynamicCreation.qml | 16 +++++ .../qmlecmascript/data/dynamicDeletion.qml | 20 +++++++ .../declarative/qmlecmascript/data/qmlToString.qml | 11 ++++ .../qmlecmascript/tst_qmlecmascript.cpp | 69 ++++++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml create mode 100644 tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml create mode 100644 tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml create mode 100644 tests/auto/declarative/qmlecmascript/data/qmlToString.qml diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml new file mode 100644 index 0000000..58ca26e --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml @@ -0,0 +1,5 @@ +import Qt.Test 1.0 + +MyQmlObject{ + objectName: "desolateObject" +} diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml new file mode 100644 index 0000000..f3eb75f --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml @@ -0,0 +1,16 @@ +import Qt.test 1.0 + +MyQmlObject{ + id: obj + objectName: "obj" + function createOne() + { + obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); + } + + function createTwo() + { + var component = createComponent('dynamicCreation.helper.qml'); + obj.objectProperty = component.createObject(); + } +} diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml new file mode 100644 index 0000000..618723f --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml @@ -0,0 +1,20 @@ +import Qt.test 1.0 + +MyQmlObject{ + id: obj + objectName: "obj" + function create() + { + obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); + } + + function killIt(wait) + { + if(obj.objectProperty == undefined || obj.objectProperty == null) + return; + if(wait > 0) + obj.objectProperty.destroy(wait); + else + obj.objectProperty.destroy(); + } +} diff --git a/tests/auto/declarative/qmlecmascript/data/qmlToString.qml b/tests/auto/declarative/qmlecmascript/data/qmlToString.qml new file mode 100644 index 0000000..ac296ce --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/qmlToString.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 + +MyQmlObject{ + id: obj + objectName: "objName" + function testToString() + { + obj.stringProperty = obj.toString(); + } + +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index d5d20b6..778b37f 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "testtypes.h" @@ -50,6 +51,9 @@ private slots: void outerBindingOverridesInnerBinding(); void aliasPropertyAndBinding(); void nonExistantAttachedObject(); + void dynamicCreation(); + void dynamicDestruction(); + void objectToString(); private: QmlEngine engine; @@ -531,6 +535,71 @@ void tst_qmlecmascript::aliasPropertyAndBinding() QCOMPARE(object->property("c3").toInt(), 19); } +/* + Test using createQmlObject to dynamically generate an item + Also using createComponent is tested. +*/ +void tst_qmlecmascript::dynamicCreation() +{ + QmlComponent component(&engine, TEST_FILE("dynamicCreation.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QObject *createdQmlObject = 0; + QObject *createdComponent = 0; + + QMetaObject::invokeMethod(object, "createOne"); + createdQmlObject = object->objectProperty(); + QVERIFY(createdQmlObject); + QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); + + QMetaObject::invokeMethod(object, "createTwo"); + createdComponent = object->objectProperty(); + QVERIFY(createdComponent); + QCOMPARE(createdQmlObject->objectName(), QString("desolateObject")); +} + +/* + Tests the destroy function +*/ +void tst_qmlecmascript::dynamicDestruction() +{ + QmlComponent component(&engine, TEST_FILE("dynamicDeletion.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QGuard createdQmlObject = 0; + + QMetaObject::invokeMethod(object, "create"); + createdQmlObject = object->objectProperty(); + QVERIFY(createdQmlObject); + QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); + + QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 0)); + QVERIFY(createdQmlObject); + QTest::qWait(0); + QVERIFY(!createdQmlObject); + + QMetaObject::invokeMethod(object, "create"); + QVERIFY(createdQmlObject); + QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 100)); + QVERIFY(createdQmlObject); + QTest::qWait(0); + QVERIFY(createdQmlObject); + QTest::qWait(100); + QVERIFY(!createdQmlObject); +} + +/* + tests that id.toString() works +*/ +void tst_qmlecmascript::objectToString() +{ + QmlComponent component(&engine, TEST_FILE("qmlToString.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QMetaObject::invokeMethod(object, "testToString"); + QVERIFY(object->stringProperty().startsWith("Qml Object, \"objName\" MyQmlObject_QML_15")); +} + QTEST_MAIN(tst_qmlecmascript) #include "tst_qmlecmascript.moc" -- cgit v0.12 From 8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 7 Oct 2009 15:42:53 +1000 Subject: Get two of those new autotests to pass. The third will not pass until QT-2240 is fixed. --- .../qmlecmascript/data/dynamicCreation.helper.qml | 4 ++-- .../qmlecmascript/data/dynamicCreation.qml | 2 +- .../qmlecmascript/data/dynamicDeletion.qml | 14 +++++++------- .../declarative/qmlecmascript/tst_qmlecmascript.cpp | 20 +++++++++----------- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml index 58ca26e..b26d6e1 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml @@ -1,5 +1,5 @@ -import Qt.Test 1.0 +import Qt.test 1.0 MyQmlObject{ - objectName: "desolateObject" + objectName: "objectTwo" } diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml index f3eb75f..ef39590 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml @@ -5,7 +5,7 @@ MyQmlObject{ objectName: "obj" function createOne() { - obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); + obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"objectOne"}', obj); } function createTwo() diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml index 618723f..ba87b32 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml @@ -8,13 +8,13 @@ MyQmlObject{ obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); } - function killIt(wait) + function killOther() { - if(obj.objectProperty == undefined || obj.objectProperty == null) - return; - if(wait > 0) - obj.objectProperty.destroy(wait); - else - obj.objectProperty.destroy(); + obj.objectProperty.destroy(100); + } + + function killMe() + { + obj.destroy();//Must not segfault } } diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 778b37f..3f01192 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -550,12 +550,12 @@ void tst_qmlecmascript::dynamicCreation() QMetaObject::invokeMethod(object, "createOne"); createdQmlObject = object->objectProperty(); QVERIFY(createdQmlObject); - QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); + QCOMPARE(createdQmlObject->objectName(), QString("objectOne")); QMetaObject::invokeMethod(object, "createTwo"); createdComponent = object->objectProperty(); QVERIFY(createdComponent); - QCOMPARE(createdQmlObject->objectName(), QString("desolateObject")); + QCOMPARE(createdComponent->objectName(), QString("objectTwo")); } /* @@ -564,7 +564,7 @@ void tst_qmlecmascript::dynamicCreation() void tst_qmlecmascript::dynamicDestruction() { QmlComponent component(&engine, TEST_FILE("dynamicDeletion.qml")); - MyQmlObject *object = qobject_cast(component.create()); + QGuard object = qobject_cast(component.create()); QVERIFY(object != 0); QGuard createdQmlObject = 0; @@ -573,19 +573,17 @@ void tst_qmlecmascript::dynamicDestruction() QVERIFY(createdQmlObject); QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); - QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 0)); - QVERIFY(createdQmlObject); - QTest::qWait(0); - QVERIFY(!createdQmlObject); - - QMetaObject::invokeMethod(object, "create"); - QVERIFY(createdQmlObject); - QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 100)); + QMetaObject::invokeMethod(object, "killOther"); QVERIFY(createdQmlObject); QTest::qWait(0); QVERIFY(createdQmlObject); QTest::qWait(100); QVERIFY(!createdQmlObject); + + QMetaObject::invokeMethod(object, "killMe"); + QVERIFY(object); + QTest::qWait(0); + QVERIFY(!object); } /* -- cgit v0.12