From ad6dafee9be288bcef6b2c4b318b234d2995abff Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 10 May 2010 16:23:44 +0200 Subject: Optimize QPixmapIconEngine's pixmap() function Replace needlessly expensive cache key generation Task-number: QTBUG-9850 Reviewed-by: Trond --- src/gui/image/qicon.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 891b1db..5ef0ff9 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -261,21 +261,28 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - QString key = QLatin1String("$qt_icon_") - + QString::number(pm.cacheKey()) - + QString::number(pe->mode) - + QString::number(QApplication::palette().cacheKey()) - + QLatin1Char('_') - + QString::number(actualSize.width()) - + QLatin1Char('_') - + QString::number(actualSize.height()) - + QLatin1Char('_'); - + struct { + quint64 pmc; + qint32 w; + qint32 h; + quint64 pac; + qint32 m; // Make struct size a multiple of 4, for safety's sake + } dill; + + dill.pmc = pm.cacheKey(); + dill.w = actualSize.width(); + dill.h = actualSize.height(); + dill.pac = QApplication::palette().cacheKey(); + dill.m = pe->mode; + + QString keyBase = QLatin1String("$qt_icon_") + + QString::fromRawData((QChar *)&dill, sizeof(dill)/sizeof(QChar)); + QString key = keyBase + QString::number(mode, 16); if (mode == QIcon::Active) { - if (QPixmapCache::find(key + QString::number(mode), pm)) + if (QPixmapCache::find(key, pm)) return pm; // horray - if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) { + if (QPixmapCache::find(keyBase + QString::number(QIcon::Normal, 16), pm)) { QStyleOption opt(0); opt.palette = QApplication::palette(); QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); @@ -284,7 +291,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St } } - if (!QPixmapCache::find(key + QString::number(mode), pm)) { + if (!QPixmapCache::find(key, pm)) { if (pm.size() != actualSize) pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (pe->mode != mode && mode != QIcon::Normal) { @@ -294,7 +301,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!generated.isNull()) pm = generated; } - QPixmapCache::insert(key + QString::number(mode), pm); + QPixmapCache::insert(key, pm); } return pm; } -- cgit v0.12 From 6c19bdb8552f3cc6ced2a20868f1f1952f94a69c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 13 May 2010 13:19:35 +1000 Subject: Dates and variants are not considered nested objects --- src/declarative/util/qdeclarativelistmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 0985a6b..a8a445a 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -999,7 +999,8 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash *ro QScriptValueIterator it(value); while (it.hasNext()) { it.next(); - if (it.value().isObject()) { + QScriptValue value = it.value(); + if (!value.isVariant() && !value.isRegExp() && !value.isDate() && value.isObject()) { qmlInfo(m_listModel) << "Cannot add nested list values when modifying or after modification from a worker script"; return false; } -- cgit v0.12 From 72094648438d8214dcaabddf4d94d9d7e346675a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 13 May 2010 14:32:19 +1000 Subject: Fix crash on remote content. Breakage was actually quite bad, just hard to reproduce. Task-number: QTBUG-10565 --- src/declarative/qml/qdeclarativecompositetypemanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 0ea198d..6014b10 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -509,7 +509,9 @@ void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeDa unit->errors = u->errors; doComplete(unit); return; - } else if (u->status == QDeclarativeCompositeTypeData::Waiting) { + } else if (u->status == QDeclarativeCompositeTypeData::Waiting + || u->status == QDeclarativeCompositeTypeData::WaitingResources) + { waiting++; } } -- cgit v0.12 From ae8e4afcadc9ff084e1d1859c29fbc8b629e3392 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 13 May 2010 15:07:21 +1000 Subject: Add an example spinner. Also add missing increment/decrementCurrentIndex() slots to PathView, and tweak the number of points cached along a Path. --- examples/declarative/declarative.pro | 1 + examples/declarative/spinner/content/Spinner.qml | 25 ++++++++++++++++ .../declarative/spinner/content/spinner-bg.png | Bin 0 -> 345 bytes .../declarative/spinner/content/spinner-select.png | Bin 0 -> 320 bytes examples/declarative/spinner/main.qml | 18 +++++++++++ examples/declarative/spinner/spinner.qmlproject | 16 ++++++++++ src/declarative/graphicsitems/qdeclarativepath.cpp | 4 ++- .../graphicsitems/qdeclarativepathview.cpp | 33 +++++++++++++++++++-- .../graphicsitems/qdeclarativepathview_p.h | 4 +++ .../tst_qdeclarativepathview.cpp | 30 +++++++++++++++++-- 10 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 examples/declarative/spinner/content/Spinner.qml create mode 100644 examples/declarative/spinner/content/spinner-bg.png create mode 100644 examples/declarative/spinner/content/spinner-select.png create mode 100644 examples/declarative/spinner/main.qml create mode 100644 examples/declarative/spinner/spinner.qmlproject diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro index ba9b628..913b2b0 100644 --- a/examples/declarative/declarative.pro +++ b/examples/declarative/declarative.pro @@ -37,6 +37,7 @@ sources.files = \ scrollbar \ searchbox \ slideswitch \ + spinner \ sql \ states \ tabwidget \ diff --git a/examples/declarative/spinner/content/Spinner.qml b/examples/declarative/spinner/content/Spinner.qml new file mode 100644 index 0000000..8145a28 --- /dev/null +++ b/examples/declarative/spinner/content/Spinner.qml @@ -0,0 +1,25 @@ +import Qt 4.7 + +Image { + property alias model: view.model + property alias delegate: view.delegate + property alias currentIndex: view.currentIndex + property real itemHeight: 30 + source: "spinner-bg.png" + clip: true + PathView { + id: view + anchors.fill: parent + pathItemCount: height/itemHeight + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 } + dragMargin: view.width/2 + path: Path { + startX: view.width/2; startY: -itemHeight/2 + PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight } + } + } + Keys.onDownPressed: view.incrementCurrentIndex() + Keys.onUpPressed: view.decrementCurrentIndex() +} diff --git a/examples/declarative/spinner/content/spinner-bg.png b/examples/declarative/spinner/content/spinner-bg.png new file mode 100644 index 0000000..b3556f1 Binary files /dev/null and b/examples/declarative/spinner/content/spinner-bg.png differ diff --git a/examples/declarative/spinner/content/spinner-select.png b/examples/declarative/spinner/content/spinner-select.png new file mode 100644 index 0000000..95a17a1 Binary files /dev/null and b/examples/declarative/spinner/content/spinner-select.png differ diff --git a/examples/declarative/spinner/main.qml b/examples/declarative/spinner/main.qml new file mode 100644 index 0000000..6be567a --- /dev/null +++ b/examples/declarative/spinner/main.qml @@ -0,0 +1,18 @@ +import Qt 4.7 +import "content" + +Rectangle { + width: 240; height: 320 + Column { + y: 20; x: 20; spacing: 20 + Spinner { + id: spinner + width: 200; height: 240 + focus: true + model: 20 + itemHeight: 30 + delegate: Text { font.pixelSize: 25; text: index; height: 30 } + } + Text { text: "Current item index: " + spinner.currentIndex } + } +} diff --git a/examples/declarative/spinner/spinner.qmlproject b/examples/declarative/spinner/spinner.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/spinner/spinner.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 3d0df87..2d08c7c 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -377,7 +377,9 @@ void QDeclarativePath::createPointCache() const { Q_D(const QDeclarativePath); qreal pathLength = d->_path.length(); - const int points = int(pathLength*2); + // more points means less jitter between items as they move along the + // path, but takes longer to generate + const int points = int(pathLength*5); const int lastElement = d->_path.elementCount() - 1; d->_pointCache.resize(points+1); diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 503d096..207cc25 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -49,6 +49,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -279,8 +280,8 @@ void QDeclarativePathViewPrivate::updateItem(QDeclarativeItem *item, qreal perce att->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); } QPointF pf = path->pointAt(percent); - item->setX(pf.x() - item->width()*item->scale()/2); - item->setY(pf.y() - item->height()*item->scale()/2); + item->setX(qRound(pf.x() - item->width()*item->scale()/2)); + item->setY(qRound(pf.y() - item->height()*item->scale()/2)); } void QDeclarativePathViewPrivate::regenerate() @@ -527,6 +528,33 @@ void QDeclarativePathView::setCurrentIndex(int idx) } /*! + \qmlmethod PathView::incrementCurrentIndex() + + Increments the current index. +*/ +void QDeclarativePathView::incrementCurrentIndex() +{ + setCurrentIndex(currentIndex()+1); +} + + +/*! + \qmlmethod PathView::decrementCurrentIndex() + + Decrements the current index. +*/ +void QDeclarativePathView::decrementCurrentIndex() +{ + Q_D(QDeclarativePathView); + if (d->model && d->model->count()) { + int idx = currentIndex()-1; + if (idx < 0) + idx = d->model->count() - 1; + setCurrentIndex(idx); + } +} + +/*! \qmlproperty real PathView::offset The offset specifies how far along the path the items are from their initial positions. @@ -1312,6 +1340,7 @@ int QDeclarativePathViewPrivate::calcCurrentIndex() if (offset < 0) offset += model->count(); current = qRound(qAbs(qmlMod(model->count() - offset, model->count()))); + current = current % model->count(); } return current; diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 85f47fd..349a01c 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -132,6 +132,10 @@ public: static QDeclarativePathViewAttached *qmlAttachedProperties(QObject *); +public Q_SLOTS: + void incrementCurrentIndex(); + void decrementCurrentIndex(); + Q_SIGNALS: void currentIndexChanged(); void offsetChanged(); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 62d0b89..0e16f66 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -438,7 +438,8 @@ void tst_QDeclarativePathView::pathMoved() for(int i=0; i(pathview, "wrapper", i); - QCOMPARE(curItem->pos() + offset, path->pointAt(0.25 + i*0.25)); + QPointF itemPos(path->pointAt(0.25 + i*0.25)); + QCOMPARE(curItem->pos() + offset, QPointF(qRound(itemPos.x()), qRound(itemPos.y()))); } pathview->setOffset(0.0); @@ -479,13 +480,36 @@ void tst_QDeclarativePathView::setCurrentIndex() QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 0); pathview->setCurrentIndex(2); - QTest::qWait(1000); firstItem = findItem(pathview, "wrapper", 2); - QCOMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->pos() + offset, start); QCOMPARE(canvas->rootObject()->property("currentA").toInt(), 2); QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 2); + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 1); + firstItem = findItem(pathview, "wrapper", 1); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 3); + firstItem = findItem(pathview, "wrapper", 3); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->incrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } -- cgit v0.12 From 5220b879a19b4fa1e28829e724c1ad12e85566f4 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 13 May 2010 15:21:38 +1000 Subject: ListModel::get() should return undefined if bad index specified --- src/declarative/util/qdeclarativelistmodel.cpp | 28 ++++++++++++++-------- .../tst_qdeclarativelistmodel.cpp | 4 +++- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index a8a445a..a8e1be8 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -537,10 +537,9 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) */ QScriptValue QDeclarativeListModel::get(int index) const { - if (index >= count() || index < 0) { + // the internal flat/nested class takes care of return value for bad index + if (index >= count() || index < 0) qmlInfo(this) << tr("get: index %1 out of range").arg(index); - return 0; - } return m_flat ? m_flat->get(index) : m_nested->get(index); } @@ -930,13 +929,14 @@ bool FlatListModel::insert(int index, const QScriptValue &value) QScriptValue FlatListModel::get(int index) const { - Q_ASSERT(index >= 0 && index < m_values.count()); - QScriptEngine *scriptEngine = m_scriptEngine ? m_scriptEngine : QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(m_listModel)); - if (!scriptEngine) + if (!scriptEngine) return 0; + if (index < 0 || index >= m_values.count()) + return scriptEngine->undefinedValue(); + QScriptValue rv = scriptEngine->newObject(); QHash row = m_values.at(index); @@ -1183,13 +1183,21 @@ bool NestedListModel::append(const QScriptValue& valuemap) } QScriptValue NestedListModel::get(int index) const -{ - ModelNode *node = qvariant_cast(_root->values.at(index)); - if (!node) - return 0; +{ QDeclarativeEngine *eng = qmlEngine(m_listModel); if (!eng) return 0; + + if (index < 0 || index >= count()) { + QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(eng); + if (seng) + return seng->undefinedValue(); + return 0; + } + + ModelNode *node = qvariant_cast(_root->values.at(index)); + if (!node) + return 0; return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng); } diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index ec97461..aed4781 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -282,7 +282,9 @@ void tst_qdeclarativelistmodel::dynamic() int actual = e.evaluate().toInt(); if (e.hasError()) qDebug() << e.error(); // errors not expected - QVERIFY(!e.hasError()); + + if (QTest::currentDataTag() != QLatin1String("clear3") && QTest::currentDataTag() != QLatin1String("remove3")) + QVERIFY(!e.hasError()); QCOMPARE(actual,result); } -- cgit v0.12 From 2e04552969f925f7e32e2757dc2ebb3e93936a03 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 13 May 2010 15:23:23 +1000 Subject: Follow-up on Flickable changes. - flicking and moving properties will not be removed - onMovement* and onFlick* signals are back in Reviewed-by: Martin Jones --- src/declarative/QmlChanges.txt | 5 +- .../graphicsitems/qdeclarativeflickable.cpp | 80 ++++++++++++++++++---- .../graphicsitems/qdeclarativeflickable_p.h | 16 +++-- .../graphicsitems/qdeclarativegridview.cpp | 19 +++-- .../graphicsitems/qdeclarativelistview.cpp | 18 +++-- 5 files changed, 94 insertions(+), 44 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 9ab3f08..604c14c 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -3,10 +3,9 @@ The changes below are pre Qt 4.7.0 RC Flickable: - overShoot is replaced by boundsBehavior enumeration - - flicking is replaced by flickingHorizontally and flickingVertically - - moving is replaced by movingHorizontally and movingVertically + - flickingHorizontally and flickingVertically properties added + - movingHorizontally and movingVertically properties added - flickDirection is renamed flickableDirection - - onMovementStarted, onMovementEnded, onFlickStarted and onFlickEnded signals removed Component: isReady, isLoading, isError and isNull properties removed, use status property instead QList models no longer provide properties in model object. The diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index a7a8983..a03a51d 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -230,13 +230,17 @@ void QDeclarativeFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); if (!flickingHorizontally && q->xflick()) { flickingHorizontally = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingHorizontallyChanged(); + if (!flickingVertically) + emit q->flickStarted(); } if (!flickingVertically && q->yflick()) { flickingVertically = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingVerticallyChanged(); + if (!flickingHorizontally) + emit q->flickStarted(); } } else { timeline.reset(data.move); @@ -365,6 +369,37 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() */ /*! + \qmlsignal Flickable::onMovementStarted() + + This handler is called when the view begins moving due to user + interaction. +*/ + +/*! + \qmlsignal Flickable::onMovementEnded() + + This handler is called when the view stops moving due to user + interaction. If a flick was generated, this handler will + be triggered once the flick stops. If a flick was not + generated, the handler will be triggered when the + user stops dragging - i.e. a mouse or touch release. +*/ + +/*! + \qmlsignal Flickable::onFlickStarted() + + This handler is called when the view is flicked. A flick + starts from the point that the mouse or touch is released, + while still in motion. +*/ + +/*! + \qmlsignal Flickable::onFlickEnded() + + This handler is called when the view stops moving due to a flick. +*/ + +/*! \qmlproperty real Flickable::visibleArea.xPosition \qmlproperty real Flickable::visibleArea.widthRatio \qmlproperty real Flickable::visibleArea.yPosition @@ -474,9 +509,10 @@ void QDeclarativeFlickable::setInteractive(bool interactive) d->vTime = d->timeline.time(); d->flickingHorizontally = false; d->flickingVertically = false; - emit flickingChanged(); // deprecated + emit flickingChanged(); emit flickingHorizontallyChanged(); emit flickingVerticallyChanged(); + emit flickEnded(); } emit interactiveChanged(); } @@ -799,8 +835,10 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0)); d->flickingVertically = false; d->flickY(d->vData.velocity); - if (d->flickingVertically) + if (d->flickingVertically) { + d->vMoved = true; movementStarting(); + } event->accept(); } else if (xflick()) { if (event->delta() > 0) @@ -809,8 +847,10 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0)); d->flickingHorizontally = false; d->flickX(d->hData.velocity); - if (d->flickingHorizontally) + if (d->flickingHorizontally) { + d->hMoved = true; movementStarting(); + } event->accept(); } else { QDeclarativeItem::wheelEvent(event); @@ -1269,11 +1309,11 @@ void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration) bool QDeclarativeFlickable::isFlicking() const { Q_D(const QDeclarativeFlickable); - qmlInfo(this) << "'flicking' is deprecated. Please use 'flickingHorizontally' and 'flickingVertically' instead."; return d->flickingHorizontally || d->flickingVertically; } /*! + \qmlproperty bool Flickable::flicking \qmlproperty bool Flickable::flickingHorizontally \qmlproperty bool Flickable::flickingVertically @@ -1322,11 +1362,11 @@ void QDeclarativeFlickable::setPressDelay(int delay) bool QDeclarativeFlickable::isMoving() const { Q_D(const QDeclarativeFlickable); - qmlInfo(this) << "'moving' is deprecated. Please use 'movingHorizontally' or 'movingVertically' instead."; return d->movingHorizontally || d->movingVertically; } /*! + \qmlproperty bool Flickable::moving \qmlproperty bool Flickable::movingHorizontally \qmlproperty bool Flickable::movingVertically @@ -1350,13 +1390,17 @@ void QDeclarativeFlickable::movementStarting() Q_D(QDeclarativeFlickable); if (d->hMoved && !d->movingHorizontally) { d->movingHorizontally = true; - emit movingChanged(); // deprecated + emit movingChanged(); emit movingHorizontallyChanged(); + if (!d->movingVertically) + emit movementStarted(); } - if (d->vMoved && !d->movingVertically) { + else if (d->vMoved && !d->movingVertically) { d->movingVertically = true; - emit movingChanged(); // deprecated + emit movingChanged(); emit movingVerticallyChanged(); + if (!d->movingHorizontally) + emit movementStarted(); } } @@ -1365,25 +1409,33 @@ void QDeclarativeFlickable::movementEnding() Q_D(QDeclarativeFlickable); if (d->flickingHorizontally) { d->flickingHorizontally = false; - emit flickingChanged(); // deprecated + emit flickingChanged(); emit flickingHorizontallyChanged(); + if (!d->flickingVertically) + emit flickEnded(); } if (d->flickingVertically) { d->flickingVertically = false; - emit flickingChanged(); // deprecated + emit flickingChanged(); emit flickingVerticallyChanged(); + if (!d->flickingHorizontally) + emit flickEnded(); } if (d->movingHorizontally) { d->movingHorizontally = false; d->hMoved = false; - emit movingChanged(); // deprecated + emit movingChanged(); emit movingHorizontallyChanged(); + if (!d->movingVertically) + emit movementEnded(); } if (d->movingVertically) { d->movingVertically = false; d->vMoved = false; - emit movingChanged(); // deprecated + emit movingChanged(); emit movingVerticallyChanged(); + if (!d->movingHorizontally) + emit movementEnded(); } d->hData.smoothVelocity.setValue(0); d->vData.smoothVelocity.setValue(0); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 7944e2b..05887b8 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -68,10 +68,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged) Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) - Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) // deprecated + Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged) Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged) - Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) // deprecated + Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged) Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged) Q_PROPERTY(FlickableDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickableDirectionChanged) // deprecated @@ -120,10 +120,10 @@ public: qreal contentY() const; void setContentY(qreal pos); - bool isMoving() const; // deprecated + bool isMoving() const; bool isMovingHorizontally() const; bool isMovingVertically() const; - bool isFlicking() const; // deprecated + bool isFlicking() const; bool isFlickingHorizontally() const; bool isFlickingVertically() const; @@ -160,10 +160,10 @@ Q_SIGNALS: void contentHeightChanged(); void contentXChanged(); void contentYChanged(); - void movingChanged(); // deprecated + void movingChanged(); void movingHorizontallyChanged(); void movingVerticallyChanged(); - void flickingChanged(); // deprecated + void flickingChanged(); void flickingHorizontallyChanged(); void flickingVerticallyChanged(); void horizontalVelocityChanged(); @@ -177,6 +177,10 @@ Q_SIGNALS: void maximumFlickVelocityChanged(); void flickDecelerationChanged(); void pressDelayChanged(); + void movementStarted(); + void movementEnded(); + void flickStarted(); + void flickEnded(); protected: virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 396acd0..fe78c84 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -347,8 +347,7 @@ public: void QDeclarativeGridViewPrivate::init() { Q_Q(QDeclarativeGridView); - QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped())); - QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped())); + QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); q->setFlag(QGraphicsItem::ItemIsFocusScope); q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick); addItemChangeListener(this, Geometry); @@ -878,13 +877,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); if (!flickingHorizontally && q->xflick()) { flickingHorizontally = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingHorizontallyChanged(); + emit q->flickStarted(); } if (!flickingVertically && q->yflick()) { flickingVertically = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingVerticallyChanged(); + emit q->flickStarted(); } } else { timeline.reset(data.move); @@ -2311,13 +2312,9 @@ void QDeclarativeGridView::destroyingItem(QDeclarativeItem *item) void QDeclarativeGridView::animStopped() { Q_D(QDeclarativeGridView); - if ((!d->movingVertically && d->flow == QDeclarativeGridView::LeftToRight) - || (!d->movingHorizontally && d->flow == QDeclarativeGridView::TopToBottom)) - { - d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer; - if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange) - d->updateHighlight(); - } + d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer; + if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange) + d->updateHighlight(); } void QDeclarativeGridView::refill() diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 20106cb..46e9ce3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -525,8 +525,7 @@ void QDeclarativeListViewPrivate::init() Q_Q(QDeclarativeListView); q->setFlag(QGraphicsItem::ItemIsFocusScope); addItemChangeListener(this, Geometry); - QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped())); - QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped())); + QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick); ::memset(sectionCache, 0, sizeof(QDeclarativeItem*) * sectionCacheSize); } @@ -1260,13 +1259,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); if (!flickingHorizontally && q->xflick()) { flickingHorizontally = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingHorizontallyChanged(); + emit q->flickStarted(); } if (!flickingVertically && q->yflick()) { flickingVertically = true; - emit q->flickingChanged(); // deprecated + emit q->flickingChanged(); emit q->flickingVerticallyChanged(); + emit q->flickStarted(); } correctFlick = true; } else { @@ -2890,12 +2891,9 @@ void QDeclarativeListView::destroyingItem(QDeclarativeItem *item) void QDeclarativeListView::animStopped() { Q_D(QDeclarativeListView); - if ((!d->movingVertically && d->orient == QDeclarativeListView::Vertical) || (!d->movingHorizontally && d->orient == QDeclarativeListView::Horizontal)) - { - d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; - if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange) - d->updateHighlight(); - } + d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; + if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange) + d->updateHighlight(); } QDeclarativeListViewAttached *QDeclarativeListView::qmlAttachedProperties(QObject *obj) -- cgit v0.12 From 29559bb440529e4afd766cad61578947e86fa948 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 May 2010 16:41:42 +0200 Subject: Note that you need to unset a flag to create a visual item This needs to be documented as long as its true, or else it's a common source of confusion when writing QML items. --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9433ba0..f251ba1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1194,7 +1194,10 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec width and height, \l {anchor-layout}{anchoring} and key handling. You can subclass QDeclarativeItem to provide your own custom visual item that inherits - these features. + these features. Note that, because it does not draw anything, QDeclarativeItem sets the + QGraphicsItem::ItemHasNoContents flag. If you subclass QDeclarativeItem to create a visual + item, you will need to unset this flag. + */ /*! -- cgit v0.12 From 3c1cb52aae6f7a5bd94c28a0b183e2375526724b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 10 May 2010 12:45:27 +0200 Subject: Removed dependency of QDeclarativeWebView to private Qt (Declarative) API Exchanged the use of QDeclarativePaintedItem with the use of QGraphicsWebView and its tiled backing store. --- .../webbrowser/content/FlickableWebView.qml | 29 +-- src/imports/webkit/qdeclarativewebview.cpp | 237 ++++++++------------- src/imports/webkit/qdeclarativewebview_p.h | 32 ++- 3 files changed, 113 insertions(+), 185 deletions(-) diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 7efbaa3..32d69d8 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -12,8 +12,8 @@ Flickable { id: flickable width: parent.width - contentWidth: Math.max(parent.width,webView.width*webView.scale) - contentHeight: Math.max(parent.height,webView.height*webView.scale) + contentWidth: Math.max(parent.width,webView.width) + contentHeight: Math.max(parent.height,webView.height) anchors.top: headerSpace.bottom anchors.bottom: parent.top anchors.left: parent.left @@ -28,7 +28,6 @@ Flickable { WebView { id: webView - pixelCacheSize: 4000000 transformOrigin: Item.TopLeft function fixUrl(url) @@ -48,8 +47,6 @@ Flickable { url: fixUrl(webBrowser.urlString) smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions - smoothCache: true // We do want smooth rendering - fillColor: "white" focus: true zoomFactor: 1 @@ -59,14 +56,13 @@ Flickable { { if (centerX) { var sc = zoom/contentsScale; - scaleAnim.to = sc; + scaleAnim.to = zoom; flickVX.from = flickable.contentX flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) finalX.value = flickVX.to flickVY.from = flickable.contentY flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) finalY.value = flickVY.to - finalZoom.value = zoom quickZoom.start() } } @@ -74,8 +70,8 @@ Flickable { Keys.onLeftPressed: webView.contentsScale -= 0.1 Keys.onRightPressed: webView.contentsScale += 0.1 - preferredWidth: flickable.width*zoomFactor - preferredHeight: flickable.height*zoomFactor + preferredWidth: flickable.width + preferredHeight: flickable.height contentsScale: 1/zoomFactor onContentsSizeChanged: { // zoom out @@ -108,9 +104,8 @@ Flickable { NumberAnimation { id: scaleAnim target: webView - property: "scale" - from: 1 - to: 0 // set before calling + property: "contentsScale" + // the to property is set before calling easing.type: Easing.Linear duration: 200 } @@ -133,16 +128,6 @@ Flickable { to: 0 // set before calling } } - PropertyAction { - id: finalZoom - target: webView - property: "contentsScale" - } - PropertyAction { - target: webView - property: "scale" - value: 1.0 - } // Have to set the contentXY, since the above 2 // size changes may have started a correction if // contentsScale < 1.0. diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index 9571470..9e24007 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -42,11 +42,9 @@ #include "qdeclarativewebview_p.h" #include "qdeclarativewebview_p_p.h" -#include - #include #include -#include +#include #include #include @@ -61,29 +59,29 @@ #include #include #include -#include QT_BEGIN_NAMESPACE static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system -class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate +class QDeclarativeWebViewPrivate { - Q_DECLARE_PUBLIC(QDeclarativeWebView) - public: - QDeclarativeWebViewPrivate() - : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), + QDeclarativeWebViewPrivate(QDeclarativeWebView* qq) + : q(qq), page(0), preferredwidth(0), preferredheight(0), progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), newWindowComponent(0), newWindowParent(0), pressTime(400), rendering(true) { + QObject::connect(q, SIGNAL(focusChanged(bool)), q, SLOT(propagateFocusToWebPage(bool))); } - void focusChanged(bool); + + QDeclarativeWebView *q; QUrl url; // page url might be different if it has not loaded yet QWebPage *page; + QGraphicsWebView* view; int preferredwidth, preferredheight; qreal progress; @@ -101,7 +99,6 @@ public: QPoint pressPoint; int pressTime; // milliseconds before it's a "hold" - static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { static_cast(prop->data)->windowObjects.append(o); static_cast(prop->data)->updateWindowObjects(); @@ -169,34 +166,39 @@ public: */ QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) - : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) + : QDeclarativeItem(parent) { init(); } QDeclarativeWebView::~QDeclarativeWebView() { - Q_D(QDeclarativeWebView); delete d->page; + delete d; } void QDeclarativeWebView::init() { - Q_D(QDeclarativeWebView); + d = new QDeclarativeWebViewPrivate(this); QWebSettings::enablePersistentStorage(); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, false); + setFlag(QGraphicsItem::ItemHasNoContents, true); + setClip(true); d->page = 0; + d->view = new QGraphicsWebView(this); + d->view->setResizesToContents(true); + d->view->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize())); + connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged())); } void QDeclarativeWebView::componentComplete() { - QDeclarativePaintedItem::componentComplete(); - Q_D(QDeclarativeWebView); + QDeclarativeItem::componentComplete(); switch (d->pending) { case QDeclarativeWebViewPrivate::PendingUrl: setUrl(d->pending_url); @@ -216,7 +218,6 @@ void QDeclarativeWebView::componentComplete() QDeclarativeWebView::Status QDeclarativeWebView::status() const { - Q_D(const QDeclarativeWebView); return d->status; } @@ -230,13 +231,11 @@ QDeclarativeWebView::Status QDeclarativeWebView::status() const */ qreal QDeclarativeWebView::progress() const { - Q_D(const QDeclarativeWebView); return d->progress; } void QDeclarativeWebView::doLoadStarted() { - Q_D(QDeclarativeWebView); if (!d->url.isEmpty()) { d->status = Loading; @@ -247,7 +246,6 @@ void QDeclarativeWebView::doLoadStarted() void QDeclarativeWebView::doLoadProgress(int p) { - Q_D(QDeclarativeWebView); if (d->progress == p/100.0) return; d->progress = p/100.0; @@ -256,12 +254,7 @@ void QDeclarativeWebView::doLoadProgress(int p) void QDeclarativeWebView::pageUrlChanged() { - Q_D(QDeclarativeWebView); - - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - expandToWebPage(); + updateContentsSize(); if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) @@ -275,7 +268,6 @@ void QDeclarativeWebView::pageUrlChanged() void QDeclarativeWebView::doLoadFinished(bool ok) { - Q_D(QDeclarativeWebView); if (title().isEmpty()) pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() @@ -302,21 +294,17 @@ void QDeclarativeWebView::doLoadFinished(bool ok) */ QUrl QDeclarativeWebView::url() const { - Q_D(const QDeclarativeWebView); return d->url; } void QDeclarativeWebView::setUrl(const QUrl &url) { - Q_D(QDeclarativeWebView); if (url == d->url) return; if (isComponentComplete()) { d->url = url; - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); + updateContentsSize(); QUrl seturl = url; if (seturl.isEmpty()) seturl = QUrl(QLatin1String("about:blank")); @@ -338,16 +326,14 @@ void QDeclarativeWebView::setUrl(const QUrl &url) */ int QDeclarativeWebView::preferredWidth() const { - Q_D(const QDeclarativeWebView); return d->preferredwidth; } void QDeclarativeWebView::setPreferredWidth(int iw) { - Q_D(QDeclarativeWebView); if (d->preferredwidth == iw) return; d->preferredwidth = iw; - //expandToWebPage(); + updateContentsSize(); emit preferredWidthChanged(); } @@ -358,14 +344,14 @@ void QDeclarativeWebView::setPreferredWidth(int iw) */ int QDeclarativeWebView::preferredHeight() const { - Q_D(const QDeclarativeWebView); return d->preferredheight; } + void QDeclarativeWebView::setPreferredHeight(int ih) { - Q_D(QDeclarativeWebView); if (d->preferredheight == ih) return; d->preferredheight = ih; + updateContentsSize(); emit preferredHeightChanged(); } @@ -383,55 +369,45 @@ QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) return this->page()->mainFrame()->evaluateJavaScript(scriptSource); } -void QDeclarativeWebViewPrivate::focusChanged(bool hasFocus) +void QDeclarativeWebView::propagateFocusToWebPage(bool hasFocus) { - Q_Q(QDeclarativeWebView); QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); - q->page()->event(&e); - QDeclarativeItemPrivate::focusChanged(hasFocus); + page()->event(&e); } -void QDeclarativeWebView::initialLayout() +void QDeclarativeWebView::updateDeclarativeWebViewSize() { - // nothing useful to do at this point + QSizeF size = d->view->geometry().size() * contentsScale(); + setImplicitWidth(size.width()); + setImplicitHeight(size.height()); } -void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) +void QDeclarativeWebView::initialLayout() { - expandToWebPage(); + // nothing useful to do at this point } -void QDeclarativeWebView::expandToWebPage() +void QDeclarativeWebView::updateContentsSize() { - Q_D(QDeclarativeWebView); - QSize cs = page()->mainFrame()->contentsSize(); - if (cs.width() < d->preferredwidth) - cs.setWidth(d->preferredwidth); - if (cs.height() < d->preferredheight) - cs.setHeight(d->preferredheight); - if (widthValid()) - cs.setWidth(width()); - if (heightValid()) - cs.setHeight(height()); - if (cs != page()->viewportSize()) { - page()->setViewportSize(cs); - } - if (cs != contentsSize()) - setContentsSize(cs); + if (d->page) + d->page->setPreferredContentsSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); } void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if (newGeometry.size() != oldGeometry.size()) - expandToWebPage(); - QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeWebView::paintPage(const QRect& r) -{ - dirtyCache(r); - update(); + if (newGeometry.size() != oldGeometry.size() && d->page) { + QSize cs = d->page->preferredContentsSize(); + if (widthValid()) + cs.setWidth(width()); + if (heightValid()) + cs.setHeight(height()); + if (cs != d->page->preferredContentsSize()) + d->page->setPreferredContentsSize(cs); + } + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); } /*! @@ -473,7 +449,6 @@ void QDeclarativeWebView::paintPage(const QRect& r) */ QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() { - Q_D(QDeclarativeWebView); return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); } @@ -484,8 +459,7 @@ QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject void QDeclarativeWebViewPrivate::updateWindowObjects() { - Q_Q(QDeclarativeWebView); - if (!q->isComponentComplete() || !page) + if (!q->isComponentCompletePublic() || !page) return; for (int ii = 0; ii < windowObjects.count(); ++ii) { @@ -499,29 +473,17 @@ void QDeclarativeWebViewPrivate::updateWindowObjects() bool QDeclarativeWebView::renderingEnabled() const { - Q_D(const QDeclarativeWebView); return d->rendering; } void QDeclarativeWebView::setRenderingEnabled(bool enabled) { - Q_D(QDeclarativeWebView); if (d->rendering == enabled) return; d->rendering = enabled; emit renderingEnabledChanged(); - setCacheFrozen(!enabled); - if (enabled) - clearCache(); -} - - -void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) -{ - Q_D(QDeclarativeWebView); - if (d->rendering) - page()->mainFrame()->render(p,r); + d->view->setTiledBackingStoreFrozen(!enabled); } QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) @@ -556,7 +518,6 @@ QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsScene return me; } - /*! \qmlsignal WebView::onDoubleClick(clickx,clicky) @@ -588,7 +549,6 @@ void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) */ bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) { - Q_D(QDeclarativeWebView); if (contentsScale() >= maxzoom/zoomFactor()) return false; qreal ozf = contentsScale(); @@ -617,13 +577,11 @@ bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) */ int QDeclarativeWebView::pressGrabTime() const { - Q_D(const QDeclarativeWebView); return d->pressTime; } void QDeclarativeWebView::setPressGrabTime(int ms) { - Q_D(QDeclarativeWebView); if (d->pressTime == ms) return; d->pressTime = ms; @@ -632,8 +590,6 @@ void QDeclarativeWebView::setPressGrabTime(int ms) void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QDeclarativeWebView); - setFocus (true); QMouseEvent *me = sceneMouseEventToMouseEvent(event); @@ -661,14 +617,12 @@ void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) ); delete me; if (!event->isAccepted()) { - QDeclarativePaintedItem::mousePressEvent(event); + QDeclarativeItem::mousePressEvent(event); } } void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QDeclarativeWebView); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); page()->event(me); d->pressTimer.stop(); @@ -685,7 +639,7 @@ void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) ); delete me; if (!event->isAccepted()) { - QDeclarativePaintedItem::mouseReleaseEvent(event); + QDeclarativeItem::mouseReleaseEvent(event); } setKeepMouseGrab(false); ungrabMouse(); @@ -693,7 +647,6 @@ void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void QDeclarativeWebView::timerEvent(QTimerEvent *event) { - Q_D(QDeclarativeWebView); if (event->timerId() == d->pressTimer.timerId()) { d->pressTimer.stop(); grabMouse(); @@ -703,8 +656,6 @@ void QDeclarativeWebView::timerEvent(QTimerEvent *event) void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QDeclarativeWebView); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); if (d->pressTimer.isActive()) { if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { @@ -728,9 +679,9 @@ void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } delete me; if (!event->isAccepted()) - QDeclarativePaintedItem::mouseMoveEvent(event); - + QDeclarativeItem::mouseMoveEvent(event); } + void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) { QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); @@ -744,21 +695,7 @@ void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) ); delete me; if (!event->isAccepted()) - QDeclarativePaintedItem::hoverMoveEvent(event); -} - -void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyPressEvent(event); -} - -void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyReleaseEvent(event); + QDeclarativeItem::hoverMoveEvent(event); } bool QDeclarativeWebView::sceneEvent(QEvent *event) @@ -773,7 +710,7 @@ bool QDeclarativeWebView::sceneEvent(QEvent *event) } } } - return QDeclarativePaintedItem::sceneEvent(event); + return QDeclarativeItem::sceneEvent(event); } @@ -842,15 +779,11 @@ QPixmap QDeclarativeWebView::icon() const */ void QDeclarativeWebView::setZoomFactor(qreal factor) { - Q_D(QDeclarativeWebView); if (factor == page()->mainFrame()->zoomFactor()) return; page()->mainFrame()->setZoomFactor(factor); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, - d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); - expandToWebPage(); + updateContentsSize(); emit zoomFactorChanged(); } @@ -868,37 +801,27 @@ qreal QDeclarativeWebView::zoomFactor() const */ void QDeclarativeWebView::setStatusText(const QString& s) { - Q_D(QDeclarativeWebView); d->statusText = s; emit statusTextChanged(); } void QDeclarativeWebView::windowObjectCleared() { - Q_D(QDeclarativeWebView); d->updateWindowObjects(); } QString QDeclarativeWebView::statusText() const { - Q_D(const QDeclarativeWebView); return d->statusText; } QWebPage *QDeclarativeWebView::page() const { - Q_D(const QDeclarativeWebView); if (!d->page) { QDeclarativeWebView *self = const_cast(this); QWebPage *wp = new QDeclarativeWebPage(self); - // QML items don't default to having a background, - // even though most we pages will set one anyway. - QPalette pal = QApplication::palette(); - pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); - wp->setPalette(pal); - wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); self->setPage(wp); @@ -954,14 +877,12 @@ QWebPage *QDeclarativeWebView::page() const */ QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const { - Q_D(const QDeclarativeWebView); d->settings.s = page()->settings(); return &d->settings; } void QDeclarativeWebView::setPage(QWebPage *page) { - Q_D(QDeclarativeWebView); if (d->page == page) return; if (d->page) { @@ -972,18 +893,15 @@ void QDeclarativeWebView::setPage(QWebPage *page) } } d->page = page; - d->page->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); + updateContentsSize(); d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); - connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); + connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize))); connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); @@ -991,6 +909,10 @@ void QDeclarativeWebView::setPage(QWebPage *page) connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); + + d->page->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true); + + d->view->setPage(page); } /*! @@ -1045,10 +967,7 @@ QString QDeclarativeWebView::html() const */ void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) { - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); + updateContentsSize(); if (isComponentComplete()) page()->mainFrame()->setHtml(html, baseUrl); else { @@ -1061,10 +980,7 @@ void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); + updateContentsSize(); if (isComponentComplete()) page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); @@ -1088,7 +1004,6 @@ QWebSettings *QDeclarativeWebView::settings() const QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) { - Q_D(QDeclarativeWebView); switch (type) { case QWebPage::WebBrowserWindow: { if (!d->newWindowComponent && d->newWindowParent) @@ -1142,13 +1057,11 @@ QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType t */ QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const { - Q_D(const QDeclarativeWebView); return d->newWindowComponent; } void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) { - Q_D(QDeclarativeWebView); if (newWindow == d->newWindowComponent) return; d->newWindowComponent = newWindow; @@ -1165,13 +1078,11 @@ void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow */ QDeclarativeItem *QDeclarativeWebView::newWindowParent() const { - Q_D(const QDeclarativeWebView); return d->newWindowParent; } void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) { - Q_D(QDeclarativeWebView); if (parent == d->newWindowParent) return; if (d->newWindowParent && parent) { @@ -1184,6 +1095,25 @@ void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) emit newWindowParentChanged(); } +QSize QDeclarativeWebView::contentsSize() const +{ + return d->page->mainFrame()->contentsSize() * contentsScale(); +} + +qreal QDeclarativeWebView::contentsScale() const +{ + return d->view->scale(); +} + +void QDeclarativeWebView::setContentsScale(qreal scale) +{ + if (scale == d->view->scale()) + return; + d->view->setScale(scale); + updateDeclarativeWebViewSize(); + emit contentsScaleChanged(); +} + /*! Returns the area of the largest element at position (\a x,\a y) that is no larger than \a maxwidth by \a maxheight pixels. @@ -1280,3 +1210,4 @@ QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) } QT_END_NAMESPACE + diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h index 81581d8..87bd938 100644 --- a/src/imports/webkit/qdeclarativewebview_p.h +++ b/src/imports/webkit/qdeclarativewebview_p.h @@ -42,12 +42,13 @@ #ifndef QDECLARATIVEWEBVIEW_H #define QDECLARATIVEWEBVIEW_H -#include +#include #include #include #include #include +#include QT_BEGIN_HEADER @@ -61,6 +62,7 @@ class QDeclarativeWebSettings; class QDeclarativeWebViewPrivate; class QNetworkRequest; class QDeclarativeWebView; +class QDeclarativeWebViewPrivate; class QDeclarativeWebPage : public QWebPage { @@ -85,7 +87,7 @@ class QDeclarativeWebViewAttached; //### TODO: browser plugins -class QDeclarativeWebView : public QDeclarativePaintedItem +class QDeclarativeWebView : public QDeclarativeItem { Q_OBJECT @@ -120,6 +122,9 @@ class QDeclarativeWebView : public QDeclarativePaintedItem Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) + Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged) + Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged) + public: QDeclarativeWebView(QDeclarativeItem *parent=0); ~QDeclarativeWebView(); @@ -182,6 +187,13 @@ public: QDeclarativeItem *newWindowParent() const; void setNewWindowParent(QDeclarativeItem *newWindow); + bool isComponentCompletePublic() const { return isComponentComplete(); } + + QSize contentsSize() const; + + void setContentsScale(qreal scale); + qreal contentsScale() const; + Q_SIGNALS: void preferredWidthChanged(); void preferredHeightChanged(); @@ -197,6 +209,8 @@ Q_SIGNALS: void newWindowComponentChanged(); void newWindowParentChanged(); void renderingEnabledChanged(); + void contentsSizeChanged(const QSize&); + void contentsScaleChanged(); void loadStarted(); void loadFinished(); @@ -212,38 +226,36 @@ public Q_SLOTS: QVariant evaluateJavaScript(const QString&); private Q_SLOTS: - void expandToWebPage(); - void paintPage(const QRect&); void doLoadStarted(); void doLoadProgress(int p); void doLoadFinished(bool ok); void setStatusText(const QString&); void windowObjectCleared(); void pageUrlChanged(); - void noteContentsSizeChanged(const QSize&); void initialLayout(); -protected: - void drawContents(QPainter *, const QRect &); + void propagateFocusToWebPage(bool); + void updateDeclarativeWebViewSize(); + +protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void timerEvent(QTimerEvent *event); void hoverMoveEvent (QGraphicsSceneHoverEvent * event); - void keyPressEvent(QKeyEvent* event); - void keyReleaseEvent(QKeyEvent* event); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); virtual bool sceneEvent(QEvent *event); QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); private: + void updateContentsSize(); void init(); virtual void componentComplete(); Q_DISABLE_COPY(QDeclarativeWebView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) + QDeclarativeWebViewPrivate* d; QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); friend class QDeclarativeWebPage; -- cgit v0.12 From cce4e4393277298b5b5246ab79e615173b2cb13a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 May 2010 18:36:15 +0200 Subject: Minor declarative webview tweaks Added a comment to the class docs, and cleaned up the visual tests a little. However the visual tests are old and text heavy, and since we never seem to check them we might wait on updating them for a little longer. --- src/imports/webkit/qdeclarativewebview.cpp | 7 +- .../qmlvisual/qfxwebview/autosize/autosize.qml | 61 ---- .../qfxwebview/autosize/data-X11/autosize.0.png | Bin 6886 -> 0 bytes .../qfxwebview/autosize/data-X11/autosize.qml | 83 ----- .../qfxwebview/autosize/data/autosize.0.png | Bin 6886 -> 0 bytes .../qfxwebview/autosize/data/autosize.qml | 83 ----- .../qmlvisual/webview/autosize/autosize.qml | 61 ++++ .../webview/autosize/data-X11/autosize.0.png | Bin 0 -> 10185 bytes .../webview/autosize/data-X11/autosize.1.png | Bin 0 -> 10185 bytes .../webview/autosize/data-X11/autosize.2.png | Bin 0 -> 10185 bytes .../webview/autosize/data-X11/autosize.3.png | Bin 0 -> 10185 bytes .../webview/autosize/data-X11/autosize.4.png | Bin 0 -> 10185 bytes .../webview/autosize/data-X11/autosize.qml | 115 +++++++ .../qmlvisual/webview/autosize/data/autosize.0.png | Bin 0 -> 10185 bytes .../qmlvisual/webview/autosize/data/autosize.1.png | Bin 0 -> 10185 bytes .../qmlvisual/webview/autosize/data/autosize.2.png | Bin 0 -> 10185 bytes .../qmlvisual/webview/autosize/data/autosize.3.png | Bin 0 -> 10185 bytes .../qmlvisual/webview/autosize/data/autosize.4.png | Bin 0 -> 10185 bytes .../qmlvisual/webview/autosize/data/autosize.qml | 115 +++++++ .../qmlvisual/webview/embedding/data/nesting.0.png | Bin 5659 -> 0 bytes .../qmlvisual/webview/embedding/data/nesting.qml | 363 --------------------- .../qmlvisual/webview/embedding/egg.qml | 26 -- .../qmlvisual/webview/embedding/nesting.html | 9 - .../qmlvisual/webview/embedding/nesting.qml | 9 - 24 files changed, 296 insertions(+), 636 deletions(-) delete mode 100644 tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml delete mode 100644 tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png delete mode 100644 tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml delete mode 100644 tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png delete mode 100644 tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png create mode 100644 tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml delete mode 100644 tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png delete mode 100644 tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml delete mode 100644 tests/auto/declarative/qmlvisual/webview/embedding/egg.qml delete mode 100644 tests/auto/declarative/qmlvisual/webview/embedding/nesting.html delete mode 100644 tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index 9e24007..36a25f6 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -126,6 +126,9 @@ public: dynamically adjust to a size appropriate for the content. This width may be large for typical online web pages. + If the width or height is explictly set, the rendered website + will be clipped, not scaled, to fit into the set dimensions. + If the preferredWidth is set, the width will be this amount or larger, usually laying out the web content to fit the preferredWidth. @@ -134,8 +137,8 @@ public: WebView { url: "http://www.nokia.com" - width: 490 - height: 400 + preferredWidth: 490 + preferredHeight: 400 scale: 0.5 smooth: false smoothCache: true diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml deleted file mode 100644 index c4a502e..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml +++ /dev/null @@ -1,61 +0,0 @@ -import Qt 4.7 -import org.webkit 1.0 - -// The WebView size is determined by the width, height, -// preferredWidth, and preferredHeight properties. -Rectangle { - id: rect - color: "white" - width: 200 - height: layout.height - Column { - id: layout - spacing: 2 - WebView { - html: "No width defined." - Rectangle { color: "#10000000" - anchors.fill: parent - } - } - WebView { - width: rect.width - html: "The width is full." - Rectangle { - color: "#10000000" - anchors.fill: parent - } - } - WebView { - width: rect.width/2 - html: "The width is half." - Rectangle { - color: "#10000000" - anchors.fill: parent - } - } - WebView { - preferredWidth: rect.width/2 - html: "The preferredWidth is half." - Rectangle { - color: "#10000000" - anchors.fill: parent - } - } - WebView { - preferredWidth: rect.width/2 - html: "The_preferredWidth_is_half." - Rectangle { - color: "#10000000" - anchors.fill: parent - } - } - WebView { - width: rect.width/2 - html: "The_width_is_half." - Rectangle { - color: "#10000000" - anchors.fill: parent - } - } - } -} diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png deleted file mode 100644 index 1f28b9a..0000000 Binary files a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png and /dev/null differ diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml deleted file mode 100644 index f4c4e29..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml +++ /dev/null @@ -1,83 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 32 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 48 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 64 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 80 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 96 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 112 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 128 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 144 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 160 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 176 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 192 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 208 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 224 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 240 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 256 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 272 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 288 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 304 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } -} diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png deleted file mode 100644 index 1f28b9a..0000000 Binary files a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png and /dev/null differ diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml deleted file mode 100644 index 273c2b0..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml +++ /dev/null @@ -1,83 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 32 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 48 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 64 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 80 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 96 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 112 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 128 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 144 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 160 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 176 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 192 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 208 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 224 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 240 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 256 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 272 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 288 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 304 - hash: "66539e1b1983d95386b0d30d6e969904" - } -} diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml new file mode 100644 index 0000000..c4a502e --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml @@ -0,0 +1,61 @@ +import Qt 4.7 +import org.webkit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + color: "white" + width: 200 + height: layout.height + Column { + id: layout + spacing: 2 + WebView { + html: "No width defined." + Rectangle { color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml new file mode 100644 index 0000000..6122138 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml @@ -0,0 +1,115 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b2d863e57dee2a297d038e18acc70f92" + } + Frame { + msec: 32 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 48 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 64 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 80 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 96 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 112 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 128 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 144 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 160 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 176 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 192 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 208 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 224 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 240 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 256 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 272 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 288 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 304 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 320 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 336 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 352 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 368 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 384 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 400 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 416 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 432 + hash: "903a4c7e619abba5342c8c827f26a722" + } +} diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png new file mode 100644 index 0000000..ed87174 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png differ diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml new file mode 100644 index 0000000..6122138 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml @@ -0,0 +1,115 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b2d863e57dee2a297d038e18acc70f92" + } + Frame { + msec: 32 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 48 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 64 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 80 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 96 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 112 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 128 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 144 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 160 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 176 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 192 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 208 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 224 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 240 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 256 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 272 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 288 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 304 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 320 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 336 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 352 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 368 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 384 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 400 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 416 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 432 + hash: "903a4c7e619abba5342c8c827f26a722" + } +} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png b/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png deleted file mode 100644 index 57de710..0000000 Binary files a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png and /dev/null differ diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml b/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml deleted file mode 100644 index 9664566..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml +++ /dev/null @@ -1,363 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "5dc8dca7a73022fbf2116b654b709244" - } - Frame { - msec: 32 - hash: "5dc8dca7a73022fbf2116b654b709244" - } - Frame { - msec: 48 - hash: "34079c4076ab6aadd8b64fcba7d95e15" - } - Frame { - msec: 64 - hash: "5ab5fc62b49e78d0609dcb4be6c9a157" - } - Frame { - msec: 80 - hash: "063cc7438bbffae717648d98006021a8" - } - Frame { - msec: 96 - hash: "c5cd16663e48639cbeade82c3bfa0403" - } - Frame { - msec: 112 - hash: "ea7f8df84ddbad0f683fe97ddb0a0130" - } - Frame { - msec: 128 - hash: "3c353e09bdb3a1e6ff388ad6020f55ea" - } - Frame { - msec: 144 - hash: "5b6de430365d0c9824337011916b0c0b" - } - Frame { - msec: 160 - hash: "48d353ac9e7ee1ce41361d0a2b47e008" - } - Frame { - msec: 176 - hash: "c96e4d02d343ddd78e8d3dd6aa8e0198" - } - Frame { - msec: 192 - hash: "543c63d77ec635b77672ba4c5160a3d4" - } - Frame { - msec: 208 - hash: "2d56ad9c2352e555fef613d625e71151" - } - Frame { - msec: 224 - hash: "18e433c3e3ee64510f875f674791d51c" - } - Frame { - msec: 240 - hash: "56889122c1ddacdd8ebd88310c7410bc" - } - Frame { - msec: 256 - hash: "d51c85458e0109bd5bf9528b741d98d0" - } - Frame { - msec: 272 - hash: "ac54137afc29a3022c6f01df7cdf2fd6" - } - Frame { - msec: 288 - hash: "c7a42b389bae3b729ba9e6cba7f54530" - } - Frame { - msec: 304 - hash: "7583b55841e80891652c3472c658f989" - } - Frame { - msec: 320 - hash: "95a7f8d47c3788261427727f82c9ff59" - } - Frame { - msec: 336 - hash: "a87bad3e2f010680e16cd1e3f5e03e99" - } - Frame { - msec: 352 - hash: "e16bc51653f21819e0eec412b99a069f" - } - Frame { - msec: 368 - hash: "f1e869580ac148ae207141c5f0adc185" - } - Frame { - msec: 384 - hash: "7e496e44363a16d7c62e4258af9ce087" - } - Frame { - msec: 400 - hash: "19e97915c84d3554c66d5a9ad3aa6a3e" - } - Frame { - msec: 416 - hash: "181181b48a1085d1850f18ca9b163549" - } - Frame { - msec: 432 - hash: "4637cb04595a543867bd43b0c1c829ea" - } - Frame { - msec: 448 - hash: "bd0a074fed5507f8556de6110bf56aa4" - } - Frame { - msec: 464 - hash: "9547618923edac6f7f9a3ff324c4f2d8" - } - Frame { - msec: 480 - hash: "a2f90c88eacb7c66878d45e33c2a787d" - } - Frame { - msec: 496 - hash: "d5ffd3e35d0426887c106069310f84d8" - } - Frame { - msec: 512 - hash: "6bc50a5b76e2a2ef0e6bee762abeb330" - } - Frame { - msec: 528 - hash: "d4439933c842ed8432434d272fea2845" - } - Frame { - msec: 544 - hash: "61699e6ec476ac3f090e4f485430421d" - } - Frame { - msec: 560 - hash: "02d7fa9bcd697d2cab364d0a3ca4a0e2" - } - Frame { - msec: 576 - hash: "914178cbf1f6a6822cc40f81823475e4" - } - Frame { - msec: 592 - hash: "280f867ea27891ee764332998567d40d" - } - Frame { - msec: 608 - hash: "ea0d00fe54a172a89c24eac781f7ae6d" - } - Frame { - msec: 624 - hash: "4e910fb507964a710e26f318c62227bf" - } - Frame { - msec: 640 - hash: "b0c3392eb739f270dd21f552ad999c23" - } - Frame { - msec: 656 - hash: "f3698c83b0972bd66a53ad95d4fc301e" - } - Frame { - msec: 672 - hash: "0d303a0d6a9b626943ac93cc6f3fb230" - } - Frame { - msec: 688 - hash: "ba56d49e6f51aa6f1bd2a7500e3538fd" - } - Frame { - msec: 704 - hash: "273ce89d5194168e5bfd1dcefad49be2" - } - Frame { - msec: 720 - hash: "c2beef4fb7996dbccdaff4f54bdc33f1" - } - Frame { - msec: 736 - hash: "1e1aa7d84f27158a8e61bd8698ddbf2a" - } - Frame { - msec: 752 - hash: "24e82479802e710c673133ca0413be66" - } - Frame { - msec: 768 - hash: "b77e935a690bcb396e15b942d772cf1b" - } - Frame { - msec: 784 - hash: "7b729c74df1d15d6b0e8e1fc19c2d710" - } - Frame { - msec: 800 - hash: "fd6cbdca3e481baaf35022dfea76e74c" - } - Frame { - msec: 816 - hash: "c975f6eb592793aa81895ffcb74ca577" - } - Frame { - msec: 832 - hash: "677c4039a650df53b4e885f37b049ab3" - } - Frame { - msec: 848 - hash: "89563aae36552cb1749ec06567e46d9d" - } - Frame { - msec: 864 - hash: "01f57402874de6608cc02937aaf91794" - } - Frame { - msec: 880 - hash: "50c9c4e5eaaadee1ff230975390d34e3" - } - Frame { - msec: 896 - hash: "20b7d277d398afad59afdf9e6b41a57e" - } - Frame { - msec: 912 - hash: "8f9ea938a2375afeba419199de66dd52" - } - Frame { - msec: 928 - hash: "b96745888ba954bcf304c0840a030f93" - } - Frame { - msec: 944 - hash: "f5715e931274011123160f7ad10d6c52" - } - Frame { - msec: 960 - image: "nesting.0.png" - } - Frame { - msec: 976 - hash: "459fe967816c795a177a3926093fae75" - } - Frame { - msec: 992 - hash: "c599a26083068b6db628c8d8416bab60" - } - Frame { - msec: 1008 - hash: "e0aee7d1152c971b1beee9d36542acb7" - } - Frame { - msec: 1024 - hash: "2af0facdf6412f7b06979aae25e4db26" - } - Frame { - msec: 1040 - hash: "f147a92cb1826f95d4fdb7d011ba79b1" - } - Frame { - msec: 1056 - hash: "12a1cb894b0fb8e44152cccacf855c1a" - } - Frame { - msec: 1072 - hash: "c7500cf58b74fef2c3e9820d1de8f843" - } - Frame { - msec: 1088 - hash: "3a031b2206835f8b2dc9837016df6ae6" - } - Frame { - msec: 1104 - hash: "7a4796b419bbc04237764dea0b1d47d5" - } - Frame { - msec: 1120 - hash: "151d350f0064e2faf0bfb9c58bc3e4f2" - } - Frame { - msec: 1136 - hash: "d72c20a97e678908acc1d6c1f8114d9e" - } - Frame { - msec: 1152 - hash: "22da1e645640a3c31b064ff757113197" - } - Frame { - msec: 1168 - hash: "401f0bf370e2ecea5a84276fb72eb1da" - } - Frame { - msec: 1184 - hash: "c6e00d7b0ac14a5c3860b6a29901c915" - } - Frame { - msec: 1200 - hash: "f1f7dc55d7719fcb6e97157c0ca85fc0" - } - Frame { - msec: 1216 - hash: "6a112e1d79c7128c235d093e4f1f9325" - } - Frame { - msec: 1232 - hash: "14a2caf8cdca8d5147261a315059b69d" - } - Frame { - msec: 1248 - hash: "5645243aa3cfd12b0b32442f063bedb2" - } - Frame { - msec: 1264 - hash: "c7f72534a88e33c72a54cb8580534551" - } - Frame { - msec: 1280 - hash: "6cd5e2e8e0128586a682b3c649ae0631" - } - Frame { - msec: 1296 - hash: "67cefb4526b52d40a31811bc0dfaeb6a" - } - Frame { - msec: 1312 - hash: "fbe2a43a27bf490719c8b9e2b094e34f" - } - Frame { - msec: 1328 - hash: "e028aad6f51a47d8189efcf9c5d277ee" - } - Frame { - msec: 1344 - hash: "2b4cc50c37c07289fa6f9309991d36da" - } - Frame { - msec: 1360 - hash: "b67b2244cd0616d07e100d7b3b00bbe2" - } - Frame { - msec: 1376 - hash: "4e4690cffc98c49e91bdb600f1e94c79" - } - Frame { - msec: 1392 - hash: "e5215c727836a5547a170d42363bc5c8" - } - Frame { - msec: 1408 - hash: "26868e91d1794bb3f42d51f508fef613" - } - Frame { - msec: 1424 - hash: "1e5f431b125a66096ac9a4d5a211a2c4" - } -} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml deleted file mode 100644 index c569c9a..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml +++ /dev/null @@ -1,26 +0,0 @@ -import Qt 4.7 - -Item { - property variant period : 250 - property variant color : "black" - id: root - - Item { - x: root.width/2 - y: root.height/2 - Rectangle { - radius: width/2 - color: root.color - x: -width/2 - y: -height/2 - width: root.width*1.5 - height: root.height*1.5 - } - rotation: NumberAnimation { - from: 0 - to: 360 - repeat: true - duration: root.period - } - } -} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html b/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html deleted file mode 100644 index 6e81689..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html +++ /dev/null @@ -1,9 +0,0 @@ - -Nesting - - - -

Nesting

-This is a test... - -... with a spinning QML egg nested in it. diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml b/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml deleted file mode 100644 index 9e008de..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.7 -import org.webkit 1.0 - -WebView { - width: 300 - height: 200 - url: "nesting.html" - settings.pluginsEnabled: true -} -- cgit v0.12 From 761a32a67bb1d4702269ab998ffcf3772fd64d06 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 13 May 2010 23:08:38 +0200 Subject: Updated WebKit to 57d10d5c05e59bbf7de8189ff47dd18d1be996dc Disable the JIT on Symbian again, as it causes crashes. --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 12 ------------ src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 3 --- src/3rdparty/webkit/VERSION | 2 +- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index d8b4b32..14af7e9 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -57d10d5c05e59bbf7de8189ff47dd18d1be996dc +5cf023650a8da206a8cf3130e9d4820b95e1bc7c diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 97176ef..1610036 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -21,18 +21,6 @@ * wtf/Platform.h: -2010-05-02 Laszlo Gombos - - Reviewed by Eric Seidel. - - [Qt] Enable JIT for QtWebKit on Symbian - https://bugs.webkit.org/show_bug.cgi?id=38339 - - JIT on Symbian has been stable for quite some time, it - is time to turn it on by default. - - * wtf/Platform.h: - 2010-04-28 Simon Hausmann , Kent Hansen Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 8d98765..fac477e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -937,8 +937,6 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_JIT 1 #elif CPU(ARM_TRADITIONAL) && OS(LINUX) #define ENABLE_JIT 1 -#elif CPU(ARM_TRADITIONAL) && OS(SYMBIAN) && COMPILER(RVCT) - #define ENABLE_JIT 1 #endif #endif /* PLATFORM(QT) */ @@ -1008,7 +1006,6 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \ || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \ || (CPU(ARM_TRADITIONAL) && OS(LINUX)) \ - || (CPU(ARM_TRADITIONAL) && OS(SYMBIAN) && COMPILER(RVCT)) \ || (CPU(MIPS) && OS(LINUX)) \ || (CPU(X86) && OS(DARWIN)) \ || (CPU(X86_64) && OS(DARWIN)) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index c8c2aa3..b8bac54 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - dc5821c3df2ef60456d85263160852f5335cf946 + 57d10d5c05e59bbf7de8189ff47dd18d1be996dc -- cgit v0.12 From d7438b4761787ffdb6cee82ce0103d653d4cbd24 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Fri, 14 May 2010 10:13:57 +1000 Subject: Fixed documentation typo. --- doc/src/platforms/platform-notes.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 8f5b6a5..16e0c0f 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -517,7 +517,7 @@ Note that some modules rely on other modules. If your application uses QtXmlPatterns, QtWebkit or QtScript it may still require \c NetworkServices - \o as these modules rely on QtNetwork to go online. + as these modules rely on QtNetwork to go online. For more information see the documentation of the individual Qt classes. If a class does not mention Symbian capabilities, it requires none. -- cgit v0.12 From dcc9a7e72fe4c283df59378d08d75aecfa3b3b05 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Fri, 14 May 2010 10:14:25 +1000 Subject: Added snippet labels to QML Dial example. --- examples/declarative/dial/content/Dial.qml | 6 ++++++ examples/declarative/dial/dial-example.qml | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml index f9ab3e3..6f24801 100644 --- a/examples/declarative/dial/content/Dial.qml +++ b/examples/declarative/dial/content/Dial.qml @@ -8,6 +8,7 @@ Item { Image { source: "background.png" } +//! [needle_shadow] Image { x: 93 y: 35 @@ -17,6 +18,8 @@ Item { angle: needleRotation.angle } } +//! [needle_shadow] +//! [needle] Image { id: needle x: 95; y: 33 @@ -33,5 +36,8 @@ Item { } } } +//! [needle] +//! [overlay] Image { x: 21; y: 18; source: "overlay.png" } +//! [overlay] } diff --git a/examples/declarative/dial/dial-example.qml b/examples/declarative/dial/dial-example.qml index fd899a5..dd51435 100644 --- a/examples/declarative/dial/dial-example.qml +++ b/examples/declarative/dial/dial-example.qml @@ -1,6 +1,7 @@ import Qt 4.7 import "content" +//! [0] Rectangle { color: "#545454" width: 300; height: 300 @@ -14,7 +15,10 @@ Rectangle { Rectangle { id: container - anchors { bottom: parent.bottom; left: parent.left; right: parent.right; leftMargin: 20; rightMargin: 20; bottomMargin: 10 } + anchors { bottom: parent.bottom; left: parent.left + right: parent.right; leftMargin: 20; rightMargin: 20 + bottomMargin: 10 + } height: 16 radius: 8 @@ -37,8 +41,10 @@ Rectangle { MouseArea { anchors.fill: parent - drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 + drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2 + drag.maximumX: container.width - 32 } } } } +//! [0] \ No newline at end of file -- cgit v0.12 From 8f800ea5611be333ae15f932dfea50bc80852c03 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 14 May 2010 10:01:07 +1000 Subject: Fix crash in ParentAnimation. When rolling-back a parent change, the actions are in reverse order. Task-number: QTBUG-10671 --- src/declarative/util/qdeclarativeanimation.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0f7c946..195939f 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2535,14 +2535,15 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, myAction.event = vpc; viaData->pc << vpc; viaData->actions << myAction; + int index = i; + bool invertedIndex = (direction == QDeclarativeAbstractAnimation::Forward) && action.reverseEvent; QDeclarativeAction dummyAction; - QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction; - bool forward = (direction == QDeclarativeAbstractAnimation::Forward); + QDeclarativeAction &xAction = pc->xIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; QDeclarativeItem *target = pc->object(); - QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent(); + QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent(); //### this mirrors the logic in QDeclarativeParentChange. bool ok; @@ -2584,9 +2585,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, qreal w = target->width(); qreal h = target->height(); if (pc->widthIsSet()) - w = actions[++i].toValue.toReal(); + w = actions[invertedIndex ? --index : ++i].toValue.toReal(); if (pc->heightIsSet()) - h = actions[++i].toValue.toReal(); + h = actions[invertedIndex ? --index : ++i].toValue.toReal(); const QPointF &transformOrigin = d->computeTransformOrigin(target->transformOrigin(), w,h); qreal tempxt = transformOrigin.x(); -- cgit v0.12 From 169e7558fd731abdfceed00e5b2ca03c634e8d5d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 14 May 2010 10:06:40 +1000 Subject: Revert "Use raster graphicssystem for qml.app on OS X." This reverts commit d412a77d1e9a1c6810e10dfa4a0a35a81391cf29. --- tools/qml/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 003716e..116ca71 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -184,7 +184,7 @@ int main(int argc, char ** argv) atexit(showWarnings); #endif -#if defined (Q_WS_X11) || defined(Q_WS_MAC) +#if defined (Q_WS_X11) //### default to using raster graphics backend for now bool gsSpecified = false; for (int i = 0; i < argc; ++i) { -- cgit v0.12 From 1e395c0ab9676995419ae8b20e4d95ad3fe11f31 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 30 Apr 2010 15:11:11 +1000 Subject: Symbian build fix to declarative auto and benchmark tests Task-number: QTBUG-9491 Reviewed-by: Martin Jones --- tests/auto/declarative/declarative.pro | 11 +++++--- tests/auto/declarative/examples/examples.pro | 9 ++++++- .../auto/declarative/parserstress/parserstress.pro | 9 ++++++- .../declarative/parserstress/tst_parserstress.cpp | 6 ++++- .../qdeclarativeanchors/qdeclarativeanchors.pro | 9 ++++++- .../qdeclarativeanimatedimage.pro | 9 ++++++- .../qdeclarativeanimations.pro | 9 ++++++- .../qdeclarativebehaviors.pro | 9 ++++++- .../qdeclarativebinding/qdeclarativebinding.pro | 9 ++++++- .../qdeclarativeborderimage.pro | 9 ++++++- .../qdeclarativecomponent.pro | 6 ++++- .../qdeclarativeconnection.pro | 9 ++++++- .../qdeclarativecontext/qdeclarativecontext.pro | 6 ++++- .../qdeclarativedom/qdeclarativedom.pro | 9 ++++++- .../qdeclarativeengine/qdeclarativeengine.pro | 6 ++++- .../qdeclarativeerror/qdeclarativeerror.pro | 6 ++++- .../qdeclarativeflickable.pro | 9 ++++++- .../qdeclarativeflipable/qdeclarativeflipable.pro | 9 ++++++- .../qdeclarativefocusscope.pro | 9 ++++++- .../qdeclarativefontloader.pro | 9 ++++++- .../qdeclarativegridview/qdeclarativegridview.pro | 9 ++++++- .../qdeclarativeimage/qdeclarativeimage.pro | 9 ++++++- .../qdeclarativeimageprovider.pro | 9 ++++++- .../qdeclarativeinfo/qdeclarativeinfo.pro | 9 ++++++- .../qdeclarativeinstruction.pro | 6 ++++- .../qdeclarativeitem/qdeclarativeitem.pro | 9 ++++++- .../qdeclarativelanguage/qdeclarativelanguage.pro | 9 ++++++- .../qdeclarativelayoutitem.pro | 9 ++++++- .../qdeclarativelistmodel.pro | 9 ++++++- .../qdeclarativelistview/qdeclarativelistview.pro | 9 ++++++- .../qdeclarativeloader/qdeclarativeloader.pro | 9 ++++++- .../qdeclarativemetatype/qdeclarativemetatype.pro | 6 ++++- .../qdeclarativemoduleplugin/plugin/plugin.pro | 3 +++ .../tst_qdeclarativemoduleplugin.pro | 9 ++++++- .../qdeclarativemousearea.pro | 9 ++++++- .../qdeclarativeparticles.pro | 9 ++++++- .../qdeclarativepathview/qdeclarativepathview.pro | 9 ++++++- .../qdeclarativepixmapcache.pro | 9 ++++++- .../qdeclarativepositioners.pro | 9 ++++++- .../qdeclarativeproperty/qdeclarativeproperty.pro | 9 ++++++- .../declarative/qdeclarativeqt/qdeclarativeqt.pro | 9 ++++++- .../qdeclarativerepeater/qdeclarativerepeater.pro | 9 ++++++- .../qdeclarativesmoothedanimation.pro | 9 ++++++- .../qdeclarativesmoothedfollow.pro | 9 ++++++- .../qdeclarativespringfollow.pro | 9 ++++++- .../qdeclarativesqldatabase.pro | 9 ++++++- .../qdeclarativestates/qdeclarativestates.pro | 9 ++++++- .../qdeclarativesystempalette.pro | 7 +++++ .../qdeclarativetext/qdeclarativetext.pro | 9 ++++++- .../qdeclarativetextedit/qdeclarativetextedit.pro | 9 ++++++- .../qdeclarativetextinput.pro | 9 ++++++- .../qdeclarativetimer/qdeclarativetimer.pro | 6 ++++- .../qdeclarativevaluetypes.pro | 9 ++++++- .../qdeclarativeview/qdeclarativeview.pro | 9 ++++++- .../qdeclarativeviewer/qdeclarativeviewer.pro | 9 ++++++- .../qdeclarativevisualdatamodel.pro | 10 +++++-- .../qdeclarativewebview/qdeclarativewebview.pro | 9 ++++++- .../qdeclarativeworkerscript.pro | 9 ++++++- .../qdeclarativexmlhttprequest.pro | 10 +++++-- .../qdeclarativexmllistmodel.pro | 9 ++++++- tests/auto/declarative/qmlvisual/qmlvisual.pro | 31 ++++++++++++++++++++-- tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 2 +- .../qpacketprotocol/tst_qpacketprotocol.cpp | 2 +- tests/benchmarks/declarative/binding/binding.pro | 14 +++++----- tests/benchmarks/declarative/creation/creation.pro | 11 ++++---- .../declarative/creation/tst_creation.cpp | 6 ----- tests/benchmarks/declarative/declarative.pro | 5 +++- .../qdeclarativecomponent.pro | 18 +++++-------- .../qdeclarativeimage/qdeclarativeimage.pro | 10 ++++--- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 6 ----- .../qdeclarativemetaproperty.pro | 9 ++++++- tests/benchmarks/declarative/script/script.pro | 9 ++++--- tests/benchmarks/declarative/script/tst_script.cpp | 6 ----- tools/qml/qml.pri | 6 +++++ tools/qml/qml.pro | 2 -- 75 files changed, 529 insertions(+), 120 deletions(-) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 3496906..4bb3518 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,6 +1,12 @@ TEMPLATE = subdirs +!symbian: { SUBDIRS += \ examples \ + qdeclarativemetatype \ + qmetaobjectbuilder +} + +SUBDIRS += \ parserstress \ qdeclarativeanchors \ qdeclarativeanimatedimage \ @@ -34,7 +40,6 @@ SUBDIRS += \ qdeclarativelistreference \ qdeclarativelistview \ qdeclarativeloader \ - qdeclarativemetatype \ qdeclarativemoduleplugin \ qdeclarativemousearea \ qdeclarativeparticles \ @@ -64,8 +69,7 @@ SUBDIRS += \ qdeclarativexmlhttprequest \ qdeclarativexmllistmodel \ qmlvisual \ - qpacketprotocol \ - qmetaobjectbuilder + qpacketprotocol contains(QT_CONFIG, webkit) { SUBDIRS += \ @@ -74,4 +78,3 @@ contains(QT_CONFIG, webkit) { # Tests which should run in Pulse PULSE_TESTS = $$SUBDIRS - diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 4c32524..92a16f1 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -6,7 +6,14 @@ SOURCES += tst_examples.cpp include(../../../../tools/qml/qml.pri) -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index 8830511..a95a855 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = ..\..\qscriptjstestsuite\tests + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index 294f2f7..c86908b 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -86,12 +86,15 @@ QStringList tst_parserstress::findJSFiles(const QDir &d) void tst_parserstress::ecmascript_data() { +#ifdef Q_OS_SYMBIAN + QDir dir("tests"); +#else QDir dir(SRCDIR); dir.cdUp(); dir.cdUp(); dir.cd("qscriptjstestsuite"); dir.cd("tests"); - +#endif QStringList files = findJSFiles(dir); QTest::addColumn("file"); @@ -129,6 +132,7 @@ void tst_parserstress::ecmascript() QByteArray qmlData = qml.toUtf8(); QDeclarativeComponent component(&engine); + component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); QFileInfo info(file); diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index a2403f2..452ad55 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 74f9be0..7213abd 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -4,7 +4,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index ce38eeb..f7ed371 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index c2781b8..7137af1 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index 04dd6f5..04535db 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativebinding.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index e754923..3aa2197 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index e58c798..98c38ad 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -5,7 +5,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index 959354d..bbf8630 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeconnection.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index 5db9a9e..0e1a5b1 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 466c563..9f1e50c 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index e0ea2e5..23afd07 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -5,7 +5,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeengine.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro index 501f32c..fae11f9 100644 --- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeerror.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index 07637c9..7a70109 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflickable.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index 9830b55..9b4fbc9 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflipable.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index 687c80c..c021fcf 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -3,5 +3,12 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 9a8a3ff..dbe0dcb 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index b069260..033e20e 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativegridview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index ff365ee..a8b8eca 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index 22be991..1b828a5 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -9,7 +9,14 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # LIBS += -lgcov # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index bb54d6c..c6719c0 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index 0daa9e5..350f6c6 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative script SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index e834a4e..f494ef1 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index 5771469..2b7eb1c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -11,6 +11,13 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\"\"\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro index eeb784d..79954fe 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro +++ b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro @@ -5,4 +5,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelayoutitem.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 9f1e146..53bb9ec 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -6,7 +6,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistmodel.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index 5d962c0..b406fde 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index 96fea5b..9334928 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -7,7 +7,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeloader.cpp \ ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index cf3fa65..0d32ab8 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro index fc77225..173a302 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro @@ -4,3 +4,6 @@ SOURCES = plugin.cpp QT = core declarative DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro index d895ed0..29a1009 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -2,4 +2,11 @@ load(qttest_p4) SOURCES = tst_qdeclarativemoduleplugin.cpp QT += declarative CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index 48fe025..6f9c98c 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index 8a061c3..31172a9 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeparticles.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 3c327d5..6bef61c 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepathview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 4b247fc..99a94bc 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -9,7 +9,14 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index dbe2cbee..2c5b473 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -4,7 +4,14 @@ SOURCES += tst_qdeclarativepositioners.cpp macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index 6910ccc..f37d952 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 10e10a3..b381a9b 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index abd36e0..51667af 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativerepeater.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index 80b757d..6b98f1e 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedanimation.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro index 7f737c2..eb7d793 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedfollow.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro index 6f400a3..6ed8924 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativespringfollow.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro index 3ff4529..9cdb884 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro +++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro @@ -6,7 +6,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesqldatabase.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index 706d045..6f4ecb3 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestates.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index b2705fa..786bc1b 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -4,5 +4,12 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp +# Define SRCDIR equal to test's source directory +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index e70443e..51c7f43 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -9,7 +9,14 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro index 2228f11..2adb2b8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro +++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro @@ -6,4 +6,11 @@ SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp HEADERS += ../shared/testhttpserver.h # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 957e75c..2953567 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -5,5 +5,12 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetextinput.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index 42604d8..d95165c 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -4,6 +4,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index d9f1c13..02c480c 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -7,7 +7,14 @@ HEADERS += testtypes.h SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro index d6be728..ad54713 100644 --- a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro +++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro @@ -4,4 +4,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeview.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro index dc10f5b..9bb6161 100644 --- a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro +++ b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro @@ -6,6 +6,13 @@ include(../../../../tools/qml/qml.pri) SOURCES += tst_qdeclarativeviewer.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro index d76b582..c87171b 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro @@ -4,8 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativevisualdatamodel.cpp -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 956272f..8caa393 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -6,6 +6,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativewebview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index 2e3da4d..36b3449 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeworkerscript.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index 160300e..b54f670 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -8,9 +8,15 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativexmlhttprequest.cpp \ ../shared/testhttpserver.cpp - # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 8c5052a..1bf1c58 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -8,7 +8,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index a3abbe3..dca9b04 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -4,7 +4,34 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlvisual.cpp -DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" +symbian: { + importFiles.path = + importFiles.sources = animation \ + fillmode \ + focusscope \ + ListView \ + qdeclarativeborderimage \ + qdeclarativeflickable \ + qdeclarativeflipable \ + qdeclarativegridview \ + qdeclarativemousearea \ + qdeclarativeparticles \ + qdeclarativepathview \ + qdeclarativepositioners \ + qdeclarativesmoothedanimation \ + qdeclarativespringfollow \ + qdeclarativetext \ + qdeclarativetextedit \ + qdeclarativetextinput \ + rect \ + repeater \ + selftest_noimages \ + webview + DEPLOYMENT = importFiles + + DEFINES += QT_TEST_SOURCE_DIR=\".\" +} else { + DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" +} CONFIG += parallel_test - diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 0f33a07..4aad29b 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -82,7 +82,7 @@ QString tst_qmlvisual::viewer() #if defined(Q_WS_MAC) qmlruntime = QDir(binaries).absoluteFilePath("qml.app/Contents/MacOS/qml"); -#elif defined(Q_WS_WIN) +#elif defined(Q_WS_WIN) || defined(Q_WS_S60) qmlruntime = QDir(binaries).absoluteFilePath("qml.exe"); #else qmlruntime = QDir(binaries).absoluteFilePath("qml"); diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp index b8e317e..7d34698 100644 --- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp @@ -225,7 +225,7 @@ void tst_QPacketProtocol::read() void tst_QPacketProtocol::device() { QPacketProtocol p(m_client); - QCOMPARE(p.device(), m_client); + QVERIFY(p.device() == m_client); } void tst_QPacketProtocol::tst_QPacket_clear() diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index 5ceaf34..268541f 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -8,11 +8,11 @@ SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" - -symbian* { - data.sources = data/* - data.path = data - DEPLOYMENT = data +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" } - diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index 3e0caf6..08ad772 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -6,10 +6,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp -symbian* { - data.sources = data/* - data.path = data - DEPLOYMENT += addFiles +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" -} \ No newline at end of file +} diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 99324f4..6e9197b 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -50,12 +50,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -// Application private dir is default serach path for files, so SRCDIR can be set to empty -#define SRCDIR "" -#endif - class tst_creation : public QObject { Q_OBJECT diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro index a7d426c..262247a 100644 --- a/tests/benchmarks/declarative/declarative.pro +++ b/tests/benchmarks/declarative/declarative.pro @@ -1,8 +1,11 @@ TEMPLATE = subdirs +!symbian: { + SUBDIRS += painting +} + SUBDIRS += \ binding \ creation \ - painting \ pointers \ qdeclarativecomponent \ qdeclarativeimage \ diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index 30ef235..670e425 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -8,15 +8,11 @@ SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp HEADERS += testtypes.h # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" - -symbian* { - data.sources = data/* - data.path = data - samegame.sources = data/samegame/* - samegame.path = data/samegame - samegame_pics.sources = data/samegame/pics/* - samegame_pics.path = data/samegame/pics - DEPLOYMENT += data samegame samegame_pics +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" } - diff --git a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro index bbe4e8d..fb5779a 100644 --- a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -7,10 +7,12 @@ CONFIG += release SOURCES += tst_qdeclarativeimage.cpp -symbian* { - data.sources = image.png - data.path = . - DEPLOYMENT += data +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = image.png + importFiles.path = + DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } + diff --git a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index e2e8c8a..e979f20 100644 --- a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -44,12 +44,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -// Application private dir is default serach path for files, so SRCDIR can be set to empty -#define SRCDIR "" -#endif - class tst_qmlgraphicsimage : public QObject { Q_OBJECT diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro index 79fdd26..55dfafe 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro @@ -7,4 +7,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativemetaproperty.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 6255acc..91db871 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -7,10 +7,11 @@ CONFIG += release SOURCES += tst_script.cpp -symbian* { - data.sources = data/* - data.path = data - DEPLOYMENT += data +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index 8ea6dcd..6dc7ed6 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -48,12 +48,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -// Application private dir is default serach path for files, so SRCDIR can be set to empty -#define SRCDIR "." -#endif - class tst_script : public QObject { Q_OBJECT diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index d343c76..3c86d31 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -24,6 +24,12 @@ maemo5 { } else { SOURCES += $$PWD/deviceorientation.cpp } + +symbian { + INCLUDEPATH += $$QT_SOURCE_TREE/examples/network/qftp/ + LIBS += -lesock -lcommdb -lconnmon -linsock +} + FORMS = $$PWD/recopts.ui \ $$PWD/proxysettings.ui diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index b33d48b..77a9533 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -32,9 +32,7 @@ wince* { symbian { TARGET.UID3 = 0x20021317 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - INCLUDEPATH += $$QT_SOURCE_TREE/examples/network/qftp/ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - LIBS += -lesock -lcommdb -lconnmon -linsock TARGET.CAPABILITY = NetworkServices ReadUserData } mac { -- cgit v0.12 From 376ca20965e7546f0d25218858583ccde872f2fb Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 14 May 2010 12:16:54 +1000 Subject: Revert "Fix crash in ParentAnimation." This reverts commit 8f800ea5611be333ae15f932dfea50bc80852c03. --- src/declarative/util/qdeclarativeanimation.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 195939f..0f7c946 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2535,15 +2535,14 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, myAction.event = vpc; viaData->pc << vpc; viaData->actions << myAction; - int index = i; - bool invertedIndex = (direction == QDeclarativeAbstractAnimation::Forward) && action.reverseEvent; QDeclarativeAction dummyAction; - QDeclarativeAction &xAction = pc->xIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; - QDeclarativeAction &yAction = pc->yIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; - QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; - QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction; + bool forward = (direction == QDeclarativeAbstractAnimation::Forward); QDeclarativeItem *target = pc->object(); - QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent(); + QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent(); //### this mirrors the logic in QDeclarativeParentChange. bool ok; @@ -2585,9 +2584,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, qreal w = target->width(); qreal h = target->height(); if (pc->widthIsSet()) - w = actions[invertedIndex ? --index : ++i].toValue.toReal(); + w = actions[++i].toValue.toReal(); if (pc->heightIsSet()) - h = actions[invertedIndex ? --index : ++i].toValue.toReal(); + h = actions[++i].toValue.toReal(); const QPointF &transformOrigin = d->computeTransformOrigin(target->transformOrigin(), w,h); qreal tempxt = transformOrigin.x(); -- cgit v0.12 From 08b6114240a6c02dbeb0297d0deeb538ebc3fde9 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 13 May 2010 10:16:48 +1000 Subject: Cherry pick fix for MOBILITY-828 from Qt Mobility. Change e5f8e3069d0de428a751e8a1dd88f3585f2d3f5f from Qt Mobility. --- .../bearer/symbian/qnetworksession_impl.cpp | 369 ++++++++++++--------- src/plugins/bearer/symbian/qnetworksession_impl.h | 15 +- src/plugins/bearer/symbian/symbianengine.cpp | 248 +++++++++----- src/plugins/bearer/symbian/symbianengine.h | 27 +- tests/auto/qnetworksession/lackey/main.cpp | 24 +- .../qnetworksession/test/tst_qnetworksession.cpp | 361 ++++++++++++-------- 6 files changed, 658 insertions(+), 386 deletions(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 1b9c8cc..04853c4 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -53,15 +53,17 @@ QT_BEGIN_NAMESPACE QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) - : CActive(CActive::EPriorityStandard), engine(engine), ipConnectionNotifier(0), - iError(QNetworkSession::UnknownSessionError), - iALREnabled(0), iConnectInBackground(false) + : CActive(CActive::EPriorityStandard), engine(engine), + ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false), + iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0), + iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) { CActiveScheduler::Add(this); #ifdef SNAP_FUNCTIONALITY_AVAILABLE iMobility = NULL; #endif + TRAP_IGNORE(iConnectionMonitor.ConnectL()); } @@ -90,18 +92,72 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() // Close global 'Open C' RConnection setdefaultif(0); - - iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); } +void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState) +{ + if (iHandleStateNotificationsFromManager) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId) + << "configurationStateChanged connMon ID : " << QString::number(connMonId) + << " : to a state: " << newState + << " whereas my current state is: " << state; +#endif + if (connMonId == iDeprecatedConnectionId) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "however status update from manager ignored because it related to already closed connection."; +#endif + return; + } + this->newState(newState, accessPointId); + } +} + +void QNetworkSessionPrivateImpl::configurationRemoved(QNetworkConfigurationPrivatePointer config) +{ + if (!publicConfig.isValid()) + return; + + SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(config); + + symbianConfig->mutex.lock(); + TUint32 configNumericId = symbianConfig->numericId; + symbianConfig->mutex.unlock(); + + symbianConfig = toSymbianConfig(privateConfiguration(publicConfig)); + + symbianConfig->mutex.lock(); + TUint32 publicNumericId = symbianConfig->numericId; + symbianConfig->mutex.unlock(); + + if (configNumericId == publicNumericId) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "configurationRemoved IAP: " << QString::number(publicNumericId) << " : going to State: Invalid"; +#endif + this->newState(QNetworkSession::Invalid, publicNumericId); + } +} + void QNetworkSessionPrivateImpl::syncStateWithInterface() { if (!publicConfig.isValid()) return; - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + if (iFirstSync && publicConfig.isValid()) { + QObject::connect(engine, SIGNAL(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)), + this, SLOT(configurationStateChanged(TUint32, TUint32, QNetworkSession::State))); + // Listen to configuration removals, so that in case the configuration + // this session is based on is removed, session knows to enter Invalid -state. + QObject::connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + } + // Start listening IAP state changes from QNetworkConfigurationManagerPrivate + iHandleStateNotificationsFromManager = true; // Check open connections to see if there is already // an open connection to selected IAP or SNAP @@ -137,11 +193,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() } if (state != QNetworkSession::Connected) { - // There were no open connections to used IAP or SNAP - if (iError == QNetworkSession::InvalidConfigurationError) { - newState(QNetworkSession::Invalid); - } else if ((publicConfig.state() & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { + if ((publicConfig.state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { newState(QNetworkSession::Disconnected); } else { newState(QNetworkSession::NotAvailable); @@ -245,13 +298,18 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const void QNetworkSessionPrivateImpl::open() { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "open() called, session state is: " << state << " and isOpen is: " + << isOpen; +#endif if (isOpen || (state == QNetworkSession::Connecting)) { return; } - - // Cancel notifications from RConnectionMonitor + + // Stop handling IAP state change signals from QNetworkConfigurationManagerPrivate // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring - iConnectionMonitor.CancelNotifications(); + iHandleStateNotificationsFromManager = false; // Configuration may have been invalidated after session creation by platform // (e.g. configuration has been deleted). @@ -259,19 +317,25 @@ void QNetworkSessionPrivateImpl::open() newState(QNetworkSession::Invalid); iError = QNetworkSession::InvalidConfigurationError; emit QNetworkSessionPrivate::error(iError); - syncStateWithInterface(); return; } - // If opening a (un)defined configuration, session emits error and enters - // NotAvailable -state. - if (publicConfig.state() == QNetworkConfiguration::Undefined || - publicConfig.state() == QNetworkConfiguration::Defined) { + // If opening a undefined configuration, session emits error and enters + // NotAvailable -state. Note that we will try ones in 'defined' state to avoid excessive + // need for WLAN scans (via updateConfigurations()), because user may have walked + // into a WLAN range, but periodic background scan has not occurred yet --> + // we don't want to force application to make frequent updateConfigurations() calls + // to be able to try if e.g. home WLAN is available. + if (publicConfig.state() == QNetworkConfiguration::Undefined) { newState(QNetworkSession::NotAvailable); iError = QNetworkSession::InvalidConfigurationError; emit QNetworkSessionPrivate::error(iError); return; } - + // Clear possible previous states + iStoppedByUser = false; + iClosedByUser = false; + iDeprecatedConnectionId = 0; + TInt error = iSocketServ.Connect(); if (error != KErrNone) { // Could not open RSocketServ @@ -446,9 +510,18 @@ TUint QNetworkSessionPrivateImpl::iapClientCount(TUint aIAPId) const void QNetworkSessionPrivateImpl::close(bool allowSignals) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "close() called, session state is: " << state << " and isOpen is : " + << isOpen; +#endif if (!isOpen) { return; } + // Mark this session as closed-by-user so that we are able to report + // distinguish between stop() and close() state transitions + // when reporting. + iClosedByUser = true; SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(activeConfig)); @@ -469,8 +542,10 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) } #endif - if (ipConnectionNotifier) { + if (ipConnectionNotifier && !iHandleStateNotificationsFromManager) { ipConnectionNotifier->StopNotifications(); + // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate + iHandleStateNotificationsFromManager = true; } iConnection.Close(); @@ -488,7 +563,6 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) newState(QNetworkSession::Closing); } - syncStateWithInterface(); if (allowSignals) { if (publicConfig.type() == QNetworkConfiguration::UserChoice) { newState(QNetworkSession::Disconnected); @@ -499,9 +573,19 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) void QNetworkSessionPrivateImpl::stop() { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "stop() called, session state is: " << state << " and isOpen is : " + << isOpen; +#endif if (!isOpen && publicConfig.isValid() && publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "since session is not open, using RConnectionMonitor to stop() the interface"; +#endif + iStoppedByUser = true; // If the publicConfig is type of IAP, enumerate through connections at // connection monitor. If publicConfig is active in that list, stop it. // Otherwise there is nothing to stop. Note: because this QNetworkSession is not open, @@ -532,11 +616,25 @@ void QNetworkSessionPrivateImpl::stop() ETrue); } } + // Enter disconnected state right away since the session is not even open. + // Symbian^3 connection monitor does not emit KLinkLayerClosed when + // connection is stopped via connection monitor. + newState(QNetworkSession::Disconnected); } } else if (isOpen) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "since session is open, using RConnection to stop() the interface"; +#endif // Since we are open, use RConnection to stop the interface isOpen = false; + iStoppedByUser = true; newState(QNetworkSession::Closing); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate + iHandleStateNotificationsFromManager = true; + } iConnection.Stop(RConnection::EStopAuthoritative); isOpen = true; close(false); @@ -654,6 +752,10 @@ void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo* void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "roaming Error() occured"; +#endif if (isOpen) { isOpen = false; activeConfig = QNetworkConfiguration(); @@ -671,6 +773,11 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) // changes immediately to Disconnected. newState(QNetworkSession::Disconnected); emit closed(); + } else if (iStoppedByUser) { + // If the user of this session has called the stop() and + // configuration is based on internet SNAP, this needs to be + // done here because platform might roam. + newState(QNetworkSession::Disconnected); } } #endif @@ -975,7 +1082,12 @@ void QNetworkSessionPrivateImpl::RunL() isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::UnknownSessionError; + if (publicConfig.state() == QNetworkConfiguration::Undefined || + publicConfig.state() == QNetworkConfiguration::Defined) { + iError = QNetworkSession::InvalidConfigurationError; + } else { + iError = QNetworkSession::UnknownSessionError; + } emit QNetworkSessionPrivate::error(iError); Cancel(); if (ipConnectionNotifier) { @@ -991,8 +1103,16 @@ void QNetworkSessionPrivateImpl::DoCancel() iConnection.Close(); } +// Enters newState if feasible according to current state. +// AccessPointId may be given as parameter. If it is zero, state-change is assumed to +// concern this session's configuration. If non-zero, the configuration is looked up +// and checked if it matches the configuration this session is based on. bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint accessPointId) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "NEW STATE, IAP ID : " << QString::number(accessPointId) << " , newState : " << QString::number(newState); +#endif // Make sure that activeConfig is always updated when SNAP is signaled to be // connected. if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && @@ -1027,9 +1147,29 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { return false; } + + // Make sure that Connected state is not reported when Connection is + // already Closing. + // Note: Stopping connection results sometimes KLinkLayerOpen + // to be reported first (just before KLinkLayerClosed). + if (state == QNetworkSession::Closing && newState == QNetworkSession::Connected) { + return false; + } + + // Make sure that some lagging 'closing' state-changes do not overwrite + // if we are already disconnected or closed. + if (state == QNetworkSession::Disconnected && newState == QNetworkSession::Closing) { + return false; + } bool emitSessionClosed = false; - if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + + // If we abruptly go down and user hasn't closed the session, we've been aborted. + // Note that session may be in 'closing' state and not in 'connected' state, because + // depending on platform the platform may report KConfigDaemonStartingDeregistration + // event before KLinkLayerClosed + if ((isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) || + (isOpen && !iClosedByUser && newState == QNetworkSession::Disconnected)) { // Active & Connected state should change directly to Disconnected state // only when something forces connection to close (eg. when another // application or session stops connection or when network drops @@ -1043,14 +1183,17 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate + iHandleStateNotificationsFromManager = true; emitSessionClosed = true; // Emit SessionClosed after state change has been reported } bool retVal = false; if (accessPointId == 0) { state = newState; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed A to: " << state; +#endif emit stateChanged(state); retVal = true; } else { @@ -1063,6 +1206,9 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint configLocker.unlock(); state = newState; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed B to: " << state; +#endif emit stateChanged(state); retVal = true; } @@ -1075,6 +1221,9 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint configLocker.unlock(); state = newState; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed C to: " << state; +#endif emit stateChanged(state); retVal = true; } @@ -1088,20 +1237,13 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint if (symbianConfig->numericId == accessPointId) { if (newState == QNetworkSession::Connected) { - // Make sure that when AccessPoint is reported to be Connected - // also state of the related configuration changes to Active. - symbianConfig->state = QNetworkConfiguration::Active; - configLocker.unlock(); - state = newState; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed D to: " << state; +#endif emit stateChanged(state); retVal = true; } else { - if (newState == QNetworkSession::Disconnected) { - // Make sure that when AccessPoint is reported to be disconnected - // also state of the related configuration changes from Active to Defined. - symbianConfig->state = QNetworkConfiguration::Defined; - } QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); if ((config.state() == QNetworkConfiguration::Defined) || (config.state() == QNetworkConfiguration::Discovered)) { @@ -1109,6 +1251,9 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint configLocker.unlock(); state = newState; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed E to: " << state; +#endif emit stateChanged(state); retVal = true; } @@ -1121,6 +1266,19 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint if (emitSessionClosed) { emit closed(); } + if (state == QNetworkSession::Disconnected) { + // The connection has gone down, and processing of status updates must be + // stopped. Depending on platform, there may come 'connecting/connected' states + // considerably later (almost a second). Connection id is an increasing + // number, so this does not affect next _real_ 'conneting/connected' states. + + SymbianNetworkConfigurationPrivate *symbianConfig = + toSymbianConfig(privateConfiguration(publicConfig)); + + symbianConfig->mutex.lock(); + iDeprecatedConnectionId = symbianConfig->connectionId; + symbianConfig->mutex.unlock(); + } return retVal; } @@ -1129,6 +1287,9 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne TInt aError, TUint accessPointId) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << QString::number(accessPointId) << " , status : " << QString::number(aConnectionStatus); +#endif switch (aConnectionStatus) { // Connection unitialised @@ -1167,6 +1328,7 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne case KCsdGotLoginInfo: break; + case KConfigDaemonStartingRegistration: // Creating connection (e.g. GPRS activation) case KCsdStartingConnect: case KCsdFinishedConnect: @@ -1193,6 +1355,7 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne case KDataTransferTemporarilyBlocked: break; + case KConfigDaemonStartingDeregistration: // Hangup or GRPS deactivation case KConnectionStartingClose: newState(QNetworkSession::Closing,accessPointId); @@ -1200,136 +1363,26 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne // Connection closed case KConnectionClosed: - break; - case KLinkLayerClosed: newState(QNetworkSession::Disconnected,accessPointId); + // Report manager about this to make sure this event + // is received by all interseted parties (mediated by + // manager because it does always receive all events from + // connection monitor). +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "reporting disconnection to manager."; +#endif + if (publicConfig.isValid()) { + engine->configurationStateChangeReport(toSymbianConfig(privateConfiguration(publicConfig))->numericId, QNetworkSession::Disconnected); + } break; - // Unhandled state default: break; } } -void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent) -{ - switch (aEvent.EventType()) - { - case EConnMonConnectionStatusChange: - { - CConnMonConnectionStatusChange* realEvent; - realEvent = (CConnMonConnectionStatusChange*) &aEvent; - - TUint connectionId = realEvent->ConnectionId(); - TInt connectionStatus = realEvent->ConnectionStatus(); - - // Try to Find IAP Id using connection Id - TUint apId = 0; - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(subConfigurations[i])); - - QMutexLocker configLocker(&symbianConfig->mutex); - - if (symbianConfig->connectionId == connectionId) { - apId = symbianConfig->numericId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(publicConfig)); - - symbianConfig->mutex.lock(); - if (symbianConfig->connectionId == connectionId) - apId = symbianConfig->numericId; - symbianConfig->mutex.unlock(); - } - - if (apId > 0) { - handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); - } - } - break; - - case EConnMonCreateConnection: - { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - // Store connection id to related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(subConfigurations[i])); - - QMutexLocker configLocker(&symbianConfig->mutex); - - if (symbianConfig->numericId == apId) { - symbianConfig->connectionId = connectionId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(publicConfig)); - - symbianConfig->mutex.lock(); - if (symbianConfig->numericId == apId) - symbianConfig->connectionId = connectionId; - symbianConfig->mutex.unlock(); - } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - // Remove connection id from related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(subConfigurations[i])); - - QMutexLocker configLocker(&symbianConfig->mutex); - - if (symbianConfig->connectionId == connectionId) { - symbianConfig->connectionId = 0; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(publicConfig)); - - symbianConfig->mutex.lock(); - if (symbianConfig->connectionId == connectionId) - symbianConfig->connectionId = 0; - symbianConfig->mutex.unlock(); - } - } - break; - - default: - // For unrecognized events - break; - } -} - -ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection) +ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection) : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) { CActiveScheduler::Add(this); diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 7116519..9767293 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -75,9 +75,8 @@ class SymbianEngine; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, #ifdef SNAP_FUNCTIONALITY_AVAILABLE - public MMobilityProtocolResp, + public MMobilityProtocolResp #endif - public MConnectionMonitorObserver { Q_OBJECT public: @@ -130,8 +129,9 @@ protected: // From CActive void RunL(); void DoCancel(); -private: // MConnectionMonitorObserver - void EventL(const CConnMonEventBase& aEvent); +private Q_SLOTS: + void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); private: TUint iapClientCount(TUint aIAPId) const; @@ -157,6 +157,13 @@ private: // data mutable RConnection iConnection; mutable RConnectionMonitor iConnectionMonitor; ConnectionProgressNotifier* ipConnectionNotifier; + + bool iHandleStateNotificationsFromManager; + bool iFirstSync; + bool iStoppedByUser; + bool iClosedByUser; + TUint32 iDeprecatedConnectionId; + #ifdef SNAP_FUNCTIONALITY_AVAILABLE CActiveCommsMobilityApiExt* iMobility; #endif diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 8e9675e..cea8b67 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -45,14 +45,14 @@ #include #include #include +#include #include #include #include // For randgen seeding #include // For randgen seeding -// #define QT_BEARERMGMT_CONFIGMGR_DEBUG -#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG #include #endif @@ -73,7 +73,9 @@ QT_BEGIN_NAMESPACE -static const int KValueThatWillBeAddedToSNAPId = 1000; +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + static const int KValueThatWillBeAddedToSNAPId = 1000; +#endif static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() @@ -657,26 +659,34 @@ void SymbianEngine::updateActiveAccessPoints() iConnectionMonitor.GetConnectionCount(connectionCount, status); User::WaitForRequest(status); - // Go through all connections and set state of related IAPs to Active + // Go through all connections and set state of related IAPs to Active. + // Status needs to be checked carefully, because ConnMon lists also e.g. + // WLAN connections that are being currently tried --> we don't want to + // state these as active. TUint connectionId; TUint subConnectionCount; TUint apId; + TInt connectionStatus; if (status.Int() == KErrNone) { for (TUint i = 1; i <= connectionCount; i++) { iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); User::WaitForRequest(status); QString ident = QString::number(qHash(apId)); - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); if (ptr) { - online = true; - inactiveConfigs.removeOne(ident); + iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status); + User::WaitForRequest(status); + if (connectionStatus == KLinkLayerOpen) { + online = true; + inactiveConfigs.removeOne(ident); - toSymbianConfig(ptr)->connectionId = connectionId; + QMutexLocker configLocker(&ptr->mutex); + toSymbianConfig(ptr)->connectionId = connectionId; - // Configuration is Active - changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + // Configuration is Active + changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + } } } } @@ -733,12 +743,12 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn } } - // Make sure that state of rest of the IAPs won't be Discovered or Active + // Make sure that state of rest of the IAPs won't be Active foreach (const QString &iface, unavailableConfigs) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); if (ptr) { // Configuration is Defined - changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered); } } } @@ -894,21 +904,22 @@ void SymbianEngine::RunL() QMutexLocker locker(&mutex); if (iIgnoringUpdates) { -#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG - qDebug("CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently)."); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug("QNCM CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently)."); #endif return; } if (iStatus != KErrCancel) { RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); + switch (event) { case RDbNotifier::EUnlock: /** All read locks have been removed. */ case RDbNotifier::ECommit: /** A transaction has been committed. */ case RDbNotifier::ERollback: /** A transaction has been rolled back */ case RDbNotifier::ERecover: /** The database has been recovered */ -#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG - qDebug("CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); #endif iIgnoringUpdates = true; // Other events than ECommit get lower priority. In practice with those events, @@ -957,73 +968,95 @@ void SymbianEngine::DoCancel() ipCommsDB->CancelRequestNotification(); } - void SymbianEngine::EventL(const CConnMonEventBase& aEvent) { QMutexLocker locker(&mutex); switch (aEvent.EventType()) { - case EConnMonCreateConnection: + case EConnMonConnectionStatusChange: { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint subConnectionCount = 0; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); - - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); - if (ptr) { - toSymbianConfig(ptr)->connectionId = connectionId; - // Configuration is Active - if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) - updateStatesToSnaps(); - - if (!iOnline) { - iOnline = true; - - locker.unlock(); - emit this->onlineStateChanged(iOnline); - locker.relock(); + CConnMonConnectionStatusChange* realEvent; + realEvent = (CConnMonConnectionStatusChange*) &aEvent; + TInt connectionStatus = realEvent->ConnectionStatus(); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM Connection status : " << QString::number(connectionStatus) << " , connection monitor Id : " << realEvent->ConnectionId(); +#endif + if (connectionStatus == KConfigDaemonStartingRegistration) { + TUint connectionId = realEvent->ConnectionId(); + TUint subConnectionCount = 0; + TUint apId; + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + QMutexLocker configLocker(&ptr->mutex); + toSymbianConfig(ptr)->connectionId = connectionId; + emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Connecting); } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - - QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); - if (ptr) { - toSymbianConfig(ptr)->connectionId = 0; - // Configuration is either Defined or Discovered - if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) - updateStatesToSnaps(); - } - - bool online = false; - foreach (const QString &iface, accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); - if (ptr->state == QNetworkConfiguration::Active) { - online = true; - break; + } else if (connectionStatus == KLinkLayerOpen) { + // Connection has been successfully opened + TUint connectionId = realEvent->ConnectionId(); + TUint subConnectionCount = 0; + TUint apId; + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + QMutexLocker configLocker(&ptr->mutex); + toSymbianConfig(ptr)->connectionId = connectionId; + // Configuration is Active + if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) { + updateStatesToSnaps(); + } + emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Connected); + if (!iOnline) { + iOnline = true; + emit this->onlineStateChanged(iOnline); + } } - } - if (iOnline != online) { - iOnline = online; + } else if (connectionStatus == KConfigDaemonStartingDeregistration) { + TUint connectionId = realEvent->ConnectionId(); + QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); + if (ptr) { + QMutexLocker configLocker(&ptr->mutex); + emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Closing); + } + } else if (connectionStatus == KLinkLayerClosed || + connectionStatus == KConnectionClosed) { + // Connection has been closed. Which of the above events is reported, depends on the Symbian + // platform. + TUint connectionId = realEvent->ConnectionId(); + QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); + if (ptr) { + // Configuration is either Defined or Discovered + if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) { + updateStatesToSnaps(); + } - locker.unlock(); - emit this->onlineStateChanged(iOnline); - locker.relock(); + QMutexLocker configLocker(&ptr->mutex); + emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Disconnected); + } + + bool online = false; + foreach (const QString &iface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + QMutexLocker configLocker(&ptr->mutex); + if (ptr->state == QNetworkConfiguration::Active) { + online = true; + break; + } + } + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } } } - break; + break; case EConnMonIapAvailabilityChange: { @@ -1051,21 +1084,78 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } break; + case EConnMonCreateConnection: + { + // This event is caught to keep connection monitor IDs up-to-date. + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint subConnectionCount = 0; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + QMutexLocker configLocker(&ptr->mutex); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM updating connection monitor ID : from, to, whose: " << toSymbianConfig(ptr)->connectionId << connectionId << ptr->name; +#endif + toSymbianConfig(ptr)->connectionId = connectionId; + } + } + break; default: // For unrecognized events break; } } -// Waits for 1..4 seconds. +// Sessions may use this function to report configuration state changes, +// because on some Symbian platforms (especially Symbian^3) all state changes are not +// reported by the RConnectionMonitor, in particular in relation to stop() call, +// whereas they _are_ reported on RConnection progress notifier used by sessions --> centralize +// this data here so that other sessions may benefit from it too (not all sessions necessarily have +// RConnection progress notifiers available but they relay on having e.g. disconnected information from +// manager). Currently only 'Disconnected' state is of interest because it has proven to be troublesome. +void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState) +{ +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM A session reported state change for IAP ID: " << accessPointId << " whose new state is: " << newState; +#endif + switch (newState) { + case QNetworkSession::Disconnected: + { + QString ident = QString::number(qHash(accessPointId)); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + // Configuration is either Defined or Discovered + if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) { + updateStatesToSnaps(); + } + + QMutexLocker configLocker(&ptr->mutex); + emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, + toSymbianConfig(ptr)->connectionId, + QNetworkSession::Disconnected); + } + } + break; + default: + break; + } +} + +// Waits for 2..6 seconds. void SymbianEngine::waitRandomTime() { - iTimeToWait = (qAbs(qrand()) % 5) * 1000; - if (iTimeToWait < 1000) { - iTimeToWait = 1000; + iTimeToWait = (qAbs(qrand()) % 7) * 1000; + if (iTimeToWait < 2000) { + iTimeToWait = 2000; } -#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG - qDebug("QNetworkConfigurationManager waiting random time: %d ms", iTimeToWait); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug("QNCM waiting random time: %d ms", iTimeToWait); #endif QTimer::singleShot(iTimeToWait, iIgnoreEventLoop, SLOT(quit())); iIgnoreEventLoop->exec(); @@ -1076,11 +1166,11 @@ QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aCon QMutexLocker locker(&mutex); QNetworkConfiguration item; - QHash::const_iterator i = accessPointConfigurations.constBegin(); while (i != accessPointConfigurations.constEnd()) { QNetworkConfigurationPrivatePointer ptr = i.value(); + QMutexLocker configLocker(&ptr->mutex); if (toSymbianConfig(ptr)->connectionId == aConnectionId) return ptr; diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index afb37de..7d565db 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -52,6 +52,9 @@ #include #endif +// Uncomment and compile QtBearer to gain detailed state tracing +// #define QT_BEARERMGMT_SYMBIAN_DEBUG + class CCommsDatabase; class QEventLoop; @@ -90,7 +93,18 @@ public: Bearer bearer; + // So called IAP id from the platform. Remains constant as long as the + // platform is aware of the configuration ie. it is stored in the databases + // --> does not depend on whether connections are currently open or not. + // In practice is the same for the lifetime of the QNetworkConfiguration. TUint32 numericId; + // So called connection id, or connection monitor ID. A dynamic ID assigned + // by RConnectionMonitor whenever a new connection is opened. ConnectionID and + // numericId/IAP id have 1-to-1 mapping during the lifetime of the connection at + // connection monitor. Notably however it changes whenever a new connection to + // a given IAP is created. In a sense it is constant during the time the + // configuration remains between states Discovered..Active..Discovered, do not + // however relay on this. TUint connectionId; }; @@ -124,6 +138,9 @@ public: Q_SIGNALS: void onlineStateChanged(bool isOnline); + void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, + QNetworkSession::State newState); + public Q_SLOTS: void updateConfigurations(); @@ -157,12 +174,17 @@ private: void startMonitoringIAPData(TUint32 aIapId); QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId); -protected: // From CActive +protected: + // From CActive void RunL(); void DoCancel(); -private: // MConnectionMonitorObserver +private: + // MConnectionMonitorObserver void EventL(const CConnMonEventBase& aEvent); + // For QNetworkSessionPrivate to indicate about state changes + void configurationStateChangeReport(TUint32 accessPointId, + QNetworkSession::State newState); private: // Data bool iFirstUpdate; @@ -181,6 +203,7 @@ private: // Data friend class QNetworkSessionPrivate; friend class AccessPointsAvailabilityScanner; + friend class QNetworkSessionPrivateImpl; #ifdef SNAP_FUNCTIONALITY_AVAILABLE RCmManager iCmManager; diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 8759b52..ec2fad9 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -47,6 +47,8 @@ #include #include +#include +#include #include QT_USE_NAMESPACE @@ -60,15 +62,14 @@ int main(int argc, char** argv) { QCoreApplication app(argc, argv); - // Cannot read/write to processes on WinCE or Symbian. - // Easiest alternative is to use sockets for IPC. - - QLocalSocket oopSocket; - - oopSocket.connectToServer("tst_qnetworksession"); - oopSocket.waitForConnected(-1); - + // Update configurations so that everything is up to date for this process too. + // Event loop is used to wait for awhile. QNetworkConfigurationManager manager; + manager.updateConfigurations(); + QEventLoop iIgnoreEventLoop; + QTimer::singleShot(3000, &iIgnoreEventLoop, SLOT(quit())); + iIgnoreEventLoop.exec(); + QList discovered = manager.allConfigurations(QNetworkConfiguration::Discovered); @@ -82,6 +83,13 @@ int main(int argc, char** argv) return NO_DISCOVERED_CONFIGURATIONS_ERROR; } + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + QLocalSocket oopSocket; + + oopSocket.connectToServer("tst_qnetworksession"); + oopSocket.waitForConnected(-1); + qDebug() << "Lackey started"; QNetworkSession *session = 0; diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 23cdc6a..8ab9da2 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -100,6 +100,7 @@ private slots: private: QNetworkConfigurationManager manager; + QMap testsToRun; int inProcessSessionManagementCount; @@ -117,6 +118,7 @@ private: bool openSession(QNetworkSession *session); bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration = true); void updateConfigurations(); +void printConfigurations(); QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType); void tst_QNetworkSession::initTestCase() @@ -125,7 +127,19 @@ void tst_QNetworkSession::initTestCase() qRegisterMetaType("QNetworkSession::SessionError"); qRegisterMetaType("QNetworkConfiguration"); qRegisterMetaType("QNetworkConfiguration::Type"); - + + // If you wish to skip tests, set value as false. This is often very convinient because tests are so lengthy. + // Better way still would be to make this readable from a file. + testsToRun["robustnessBombing"] = true; + testsToRun["outOfProcessSession"] = true; + testsToRun["invalidSession"] = true; + testsToRun["repeatedOpenClose"] = true; + testsToRun["roamingErrorCodes"] = true; + testsToRun["sessionStop"] = true; + testsToRun["sessionProperties"] = true; + testsToRun["userChoiceSession"] = true; + testsToRun["sessionOpenCloseStop"] = true; + #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); @@ -238,6 +252,10 @@ void tst_QNetworkSession::cleanupTestCase() // Robustness test for calling interfaces in nonsense order / with nonsense parameters void tst_QNetworkSession::robustnessBombing() { + if (!testsToRun["robustnessBombing"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } + QNetworkConfigurationManager mgr; QNetworkSession testSession(mgr.defaultConfiguration()); // Should not reset even session is not opened @@ -253,7 +271,10 @@ void tst_QNetworkSession::robustnessBombing() void tst_QNetworkSession::invalidSession() -{ +{ + if (!testsToRun["invalidSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } // 1. Verify that session created with invalid configuration remains in invalid state QNetworkSession session(QNetworkConfiguration(), 0); QVERIFY(!session.isOpen()); @@ -270,11 +291,24 @@ void tst_QNetworkSession::invalidSession() QVERIFY(error == QNetworkSession::InvalidConfigurationError); QVERIFY(session.error() == QNetworkSession::InvalidConfigurationError); QVERIFY(session.state() == QNetworkSession::Invalid); - + #ifdef QNETWORKSESSION_MANUAL_TESTS + + QNetworkConfiguration invalidatedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); + if (invalidatedConfig.isValid()) { + // 3. Verify that invalidating a session after its successfully configured works + QNetworkSession invalidatedSession(invalidatedConfig); + qDebug() << "Delete the WLAN IAP from phone now (waiting 60 seconds): " << invalidatedConfig.name(); + QTest::qWait(60000); + QVERIFY(!invalidatedConfig.isValid()); + QVERIFY(invalidatedSession.state() == QNetworkSession::Invalid); + qDebug() << "Add the WLAN IAP back (waiting 60 seconds): " << invalidatedConfig.name(); + QTest::qWait(60000); + } + QNetworkConfiguration definedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); if (definedConfig.isValid()) { - // 3. Verify that opening a session with defined configuration emits error and enters notavailable-state + // 4. Verify that opening a session with defined configuration emits error and enters notavailable-state // TODO these timer waits should be changed to waiting appropriate signals, now these wait excessively qDebug() << "Shutdown WLAN IAP (waiting 60 seconds): " << definedConfig.name(); QTest::qWait(60000); @@ -283,43 +317,27 @@ void tst_QNetworkSession::invalidSession() QNetworkSession definedSession(definedConfig); QSignalSpy errorSpy(&definedSession, SIGNAL(error(QNetworkSession::SessionError))); QNetworkSession::SessionError sessionError; + updateConfigurations(); definedSession.open(); +#ifdef Q_OS_SYMBIAN + // On symbian, the connection opening is tried even with defined state. + qDebug("Waiting for 10 seconds to all signals to propagate."); + QTest::qWait(10000); +#endif + updateConfigurations(); QVERIFY(definedConfig.isValid()); // Session remains valid QVERIFY(definedSession.state() == QNetworkSession::NotAvailable); // State is not available because WLAN is not in coverage QVERIFY(!errorSpy.isEmpty()); // Session tells with error about invalidated configuration sessionError = qvariant_cast (errorSpy.first().at(0)); - qDebug() << "Error code is: " << sessionError; QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError); - qDebug() << "Turn the WLAN IAP back on (waiting 60 seconds): " << definedConfig.name(); QTest::qWait(60000); - updateConfigurations(); - + updateConfigurations(); QVERIFY(definedConfig.state() == QNetworkConfiguration::Discovered); } - - QNetworkConfiguration invalidatedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); - if (invalidatedConfig.isValid()) { - // 4. Verify that invalidating a session after its successfully configured works - QNetworkSession invalidatedSession(invalidatedConfig); - QSignalSpy errorSpy(&invalidatedSession, SIGNAL(error(QNetworkSession::SessionError))); - QNetworkSession::SessionError sessionError; - - qDebug() << "Delete the WLAN IAP from phone now (waiting 60 seconds): " << invalidatedConfig.name(); - QTest::qWait(60000); - - invalidatedSession.open(); - QVERIFY(!invalidatedConfig.isValid()); - QVERIFY(invalidatedSession.state() == QNetworkSession::Invalid); - QVERIFY(!errorSpy.isEmpty()); - - sessionError = qvariant_cast (errorSpy.first().at(0)); - QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError); - qDebug() << "Add the WLAN IAP back (waiting 60 seconds): " << invalidatedConfig.name(); - QTest::qWait(60000); - } + #endif } @@ -337,12 +355,12 @@ void tst_QNetworkSession::sessionProperties_data() void tst_QNetworkSession::sessionProperties() { + if (!testsToRun["sessionProperties"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); - QNetworkSession session(configuration); - QVERIFY(session.configuration() == configuration); - QStringList validBearerNames = QStringList() << QLatin1String("Unknown") << QLatin1String("Ethernet") << QLatin1String("WLAN") @@ -356,9 +374,6 @@ void tst_QNetworkSession::sessionProperties() if (!configuration.isValid()) { QVERIFY(configuration.bearerName().isEmpty()); } else { - qDebug() << "Type:" << configuration.type() - << "Bearer:" << configuration.bearerName(); - switch (configuration.type()) { case QNetworkConfiguration::ServiceNetwork: @@ -374,9 +389,7 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. - qDebug() << "Session state:" << session.state(); #ifndef QT_NO_NETWORKINTERFACE - qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); @@ -420,7 +433,12 @@ void tst_QNetworkSession::repeatedOpenClose_data() { } // Tests repeated-open close. -void tst_QNetworkSession::repeatedOpenClose() { +void tst_QNetworkSession::repeatedOpenClose() +{ + if (!testsToRun["repeatedOpenClose"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } + QFETCH(QString, bearerType); QFETCH(QNetworkConfiguration::Type, configurationType); QFETCH(int, repeatTimes); @@ -436,13 +454,20 @@ void tst_QNetworkSession::repeatedOpenClose() { !closeSession(&permanentSession)) { QSKIP("Unable to open/close session, skipping this round of repeated open-close test.", SkipSingle); } - for (int i = repeatTimes; i > 0; i--) { + for (int i = 0; i < repeatTimes; i++) { + qDebug() << "Opening, loop number " << i; QVERIFY(openSession(&permanentSession)); + qDebug() << "Closing, loop number, then waiting 5 seconds: " << i; QVERIFY(closeSession(&permanentSession)); + QTest::qWait(5000); } } -void tst_QNetworkSession::roamingErrorCodes() { +void tst_QNetworkSession::roamingErrorCodes() +{ + if (!testsToRun["roamingErrorCodes"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #ifndef Q_OS_SYMBIAN QSKIP("Roaming supported on Symbian.", SkipAll); #else @@ -466,41 +491,11 @@ void tst_QNetworkSession::roamingErrorCodes() { adminIapSession.stop(); // requires NetworkControl capabilities QTRY_VERIFY(!errorSpy.isEmpty()); // wait for error signals QNetworkSession::SessionError error = qvariant_cast(errorSpy.first().at(0)); + QTest::qWait(2000); // Wait for a moment to all platform signals to propagate QVERIFY(error == QNetworkSession::SessionAbortedError); QVERIFY(iapSession.state() == QNetworkSession::Disconnected); QVERIFY(adminIapSession.state() == QNetworkSession::Disconnected); #endif // Q_OS_SYMBIAN - -#ifdef QNETWORKSESSION_MANUAL_TESTS - // Check for roaming error. - // Case requires that you have controllable WLAN in Internet SNAP (only). - QNetworkConfiguration snapConfig = suitableConfiguration("bearer_not_relevant_with_snaps", QNetworkConfiguration::ServiceNetwork); - if (!snapConfig.isValid()) { - QSKIP("No SNAP accessible, skipping test.", SkipAll); - } - QNetworkSession snapSession(snapConfig); - QVERIFY(openSession(&snapSession)); - QSignalSpy errorSpySnap(&snapSession, SIGNAL(error(QNetworkSession::SessionError))); - qDebug("Disconnect the WLAN now"); - QTRY_VERIFY(!errorSpySnap.isEmpty()); // wait for error signals - QVERIFY(errorSpySnap.count() == 1); - error = qvariant_cast(errorSpySnap.first().at(0)); - qDebug() << "Error received when turning off wlan on SNAP: " << error; - QVERIFY(error == QNetworkSession::RoamingError); - - qDebug("Connect the WLAN now"); - QTest::qWait(60000); // Wait for WLAN to get up - QNetworkConfiguration wlanIapConfig2 = suitableConfiguration("WLAN", QNetworkConfiguration::InternetAccessPoint); - QNetworkSession iapSession2(wlanIapConfig2); - QVERIFY(openSession(&iapSession2)); - QSignalSpy errorSpy2(&iapSession2, SIGNAL(error(QNetworkSession::SessionError))); - qDebug("Disconnect the WLAN now"); - QTRY_VERIFY(!errorSpy2.isEmpty()); // wait for error signals - QVERIFY(errorSpy2.count() == 1); - error = qvariant_cast(errorSpy2.first().at(0)); - QVERIFY(error == QNetworkSession::SessionAbortedError); - QVERIFY(iapSession2.state() == QNetworkSession::Disconnected); -#endif } @@ -515,6 +510,9 @@ void tst_QNetworkSession::sessionStop_data() { void tst_QNetworkSession::sessionStop() { + if (!testsToRun["sessionStop"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #ifndef Q_OS_SYMBIAN QSKIP("Testcase contains mainly Symbian specific checks, because it is only platform to really support interface (IAP-level) Stop.", SkipAll); #endif @@ -522,6 +520,9 @@ void tst_QNetworkSession::sessionStop() QFETCH(QNetworkConfiguration::Type, configurationType); int configWaitdelayInMs = 2000; + + updateConfigurations(); + printConfigurations(); QNetworkConfiguration config = suitableConfiguration(bearerType, configurationType); if (!config.isValid()) { @@ -539,6 +540,9 @@ void tst_QNetworkSession::sessionStop() QSignalSpy closedSessionStateChangedSpy(&closedSession, SIGNAL(stateChanged(QNetworkSession::State))); QSignalSpy closedErrorSpy(&closedSession, SIGNAL(error(QNetworkSession::SessionError))); + QSignalSpy openedSessionClosedSpy(&openedSession, SIGNAL(closed())); + QSignalSpy openedSessionStateChangedSpy(&openedSession, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy innocentSessionClosedSpy(&innocentSession, SIGNAL(closed())); QSignalSpy innocentSessionStateChangedSpy(&innocentSession, SIGNAL(stateChanged(QNetworkSession::State))); QSignalSpy innocentErrorSpy(&innocentSession, SIGNAL(error(QNetworkSession::SessionError))); @@ -554,10 +558,18 @@ void tst_QNetworkSession::sessionStop() closedSessionClosedSpy.clear(); closedSessionStateChangedSpy.clear(); closedErrorSpy.clear(); + openedSessionStateChangedSpy.clear(); + openedSessionClosedSpy.clear(); + openedSession.stop(); - QVERIFY(openedSession.state() == QNetworkSession::Disconnected); + qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + + // First to closing, then to disconnected + QVERIFY(openedSessionStateChangedSpy.count() == 2); + QVERIFY(!openedSessionClosedSpy.isEmpty()); + QVERIFY(openedSession.state() == QNetworkSession::Disconnected); QVERIFY(config.state() != QNetworkConfiguration::Active); // 2. Verify that stopping a session based on non-connected configuration does nothing @@ -583,18 +595,20 @@ void tst_QNetworkSession::sessionStop() // 3. Check that stopping a opened session affects also other opened session based on the same configuration. if (config.type() == QNetworkConfiguration::InternetAccessPoint) { qDebug("----------3. Check that stopping a opened session affects also other opened session based on the same configuration."); + QVERIFY(openSession(&openedSession)); QVERIFY(openSession(&innocentSession)); - + configChangeSpy.clear(); innocentSessionClosedSpy.clear(); innocentSessionStateChangedSpy.clear(); innocentErrorSpy.clear(); - + openedSession.stop(); qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals - + QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + QVERIFY(!innocentSessionClosedSpy.isEmpty()); QVERIFY(!innocentSessionStateChangedSpy.isEmpty()); QVERIFY(!innocentErrorSpy.isEmpty()); @@ -614,14 +628,19 @@ void tst_QNetworkSession::sessionStop() if (config.type() == QNetworkConfiguration::ServiceNetwork) { qDebug("----------4. Skip for SNAP configuration."); } else if (config.type() == QNetworkConfiguration::InternetAccessPoint) { - qDebug("----------4. Check that stopping a non-opened session stops the other session based on the same configuration"); - QVERIFY(openSession(&innocentSession)); + qDebug("----------4. Check that stopping a non-opened session stops the other session based on the same configuration"); + qDebug("----------4.1 Opening innocent session"); + QVERIFY(openSession(&innocentSession)); qDebug("Waiting for %d ms after open to make sure all platform indications are propagated", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); + qDebug("----------4.2 Calling closedSession.stop()"); closedSession.stop(); qDebug("Waiting for %d ms to get all configurationChange signals from platform..", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + QTest::qWait(configWaitdelayInMs); + QTest::qWait(configWaitdelayInMs); + QVERIFY(!innocentSessionClosedSpy.isEmpty()); QVERIFY(!innocentSessionStateChangedSpy.isEmpty()); QVERIFY(!innocentErrorSpy.isEmpty()); @@ -653,6 +672,9 @@ void tst_QNetworkSession::userChoiceSession_data() void tst_QNetworkSession::userChoiceSession() { + if (!testsToRun["userChoiceSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); QVERIFY(configuration.type() == QNetworkConfiguration::UserChoice); @@ -786,6 +808,9 @@ void tst_QNetworkSession::sessionOpenCloseStop_data() void tst_QNetworkSession::sessionOpenCloseStop() { + if (!testsToRun["sessionOpenCloseStop"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); QFETCH(bool, forceSessionStop); @@ -894,26 +919,30 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session.error() == QNetworkSession::UnknownSessionError); session2.open(); - + QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); + if (errorSpy2.isEmpty()) { + QVERIFY(session2.isOpen()); + QVERIFY(session2.state() == QNetworkSession::Connected); + } QVERIFY(session.isOpen()); - QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); - QVERIFY(session2.state() == QNetworkSession::Connected); #ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif - QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); - QCOMPARE(session.interface().index(), session2.interface().index()); + if (errorSpy2.isEmpty()) { + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } #endif } sessionOpenedSpy2.clear(); - if (forceSessionStop) { + if (forceSessionStop && session2.isOpen()) { // Test forcing the second session to stop the interface. QNetworkSession::State previousState = session.state(); #ifdef Q_CC_NOKIAX86 @@ -922,15 +951,17 @@ void tst_QNetworkSession::sessionOpenCloseStop() #else bool expectStateChange = previousState != QNetworkSession::Disconnected; #endif - session2.stop(); + // QNetworkSession::stop() must result either closed() signal + // or error() signal QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(!session2.isOpen()); if (!errorSpy2.isEmpty()) { - QVERIFY(!errorSpy.isEmpty()); + // QNetworkSession::stop() resulted error() signal for session2 + // => also session should emit error() signal + QTRY_VERIFY(!errorSpy.isEmpty()); // check for SessionAbortedError QNetworkSession::SessionError error = @@ -950,9 +981,12 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(errorSpy.isEmpty()); QVERIFY(errorSpy2.isEmpty()); - + + // Wait for Disconnected state + QTRY_NOOP(session2.state() == QNetworkSession::Disconnected); + if (expectStateChange) - QTRY_VERIFY(stateChangedSpy2.count() >= 2 || !errorSpy2.isEmpty()); + QTRY_VERIFY(stateChangedSpy2.count() >= 1 || !errorSpy2.isEmpty()); if (!errorSpy2.isEmpty()) { QVERIFY(session2.state() == previousState); @@ -996,16 +1030,29 @@ void tst_QNetworkSession::sessionOpenCloseStop() state = qvariant_cast(stateChangedSpy2.at(3).at(0)); QVERIFY(state == QNetworkSession::Disconnected); + + QTRY_VERIFY(session.state() == QNetworkSession::Roaming || + session.state() == QNetworkSession::Connected || + session.state() == QNetworkSession::Disconnected); + QTRY_VERIFY(stateChangedSpy.count() > 0); - state = qvariant_cast(stateChangedSpy.at(0).at(0)); + state = qvariant_cast(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0)); + if (state == QNetworkSession::Roaming) { - QTRY_VERIFY(!errorSpy.isEmpty() || stateChangedSpy.count() > 1); - if (stateChangedSpy.count() > 1 && - qvariant_cast(stateChangedSpy.at(1).at(0)) == - QNetworkSession::Connected) { - roamedSuccessfully = true; + QTRY_VERIFY(session.state() == QNetworkSession::Connected); + QTRY_VERIFY(session2.state() == QNetworkSession::Connected); + roamedSuccessfully = true; + } else if (state == QNetworkSession::Disconnected) { + QTRY_VERIFY(!errorSpy.isEmpty()); + QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); + } else if (state == QNetworkSession::Connected) { + QTRY_VERIFY(errorSpy.isEmpty()); + if (stateChangedSpy.count() > 1) { + state = qvariant_cast(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0)); + QVERIFY(state == QNetworkSession::Roaming); } - } + roamedSuccessfully = true; + } if (roamedSuccessfully) { QString configId = session.sessionProperty("ActiveConfiguration").toString(); @@ -1013,37 +1060,36 @@ void tst_QNetworkSession::sessionOpenCloseStop() QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); - session3.open(); - session3.waitForOpened(); - + session3.waitForOpened(); if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); - session.stop(); - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - QTRY_VERIFY(session3.state() == QNetworkSession::Disconnected); } #ifndef Q_CC_NOKIAX86 if (!roamedSuccessfully) QVERIFY(!errorSpy.isEmpty()); #endif } else { - QCOMPARE(stateChangedSpy2.count(), 2); - - QNetworkSession::State state = - qvariant_cast(stateChangedSpy2.at(0).at(0)); - QVERIFY(state == QNetworkSession::Closing); - - state = qvariant_cast(stateChangedSpy2.at(1).at(0)); - QVERIFY(state == QNetworkSession::Disconnected); + QTest::qWait(2000); // Wait awhile to get all signals from platform + + if (stateChangedSpy2.count() == 2) { + QNetworkSession::State state = + qvariant_cast(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Closing); + state = qvariant_cast(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } else { // Assume .count() == 1 + QCOMPARE(stateChangedSpy2.count(), 1); + QNetworkSession::State state = qvariant_cast(stateChangedSpy2.at(0).at(0)); + // Symbian version dependant. + QVERIFY(state == QNetworkSession::Disconnected); + } } QTRY_VERIFY(!sessionClosedSpy.isEmpty()); - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); } QVERIFY(errorSpy2.isEmpty()); @@ -1062,7 +1108,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!session.isOpen()); #endif QVERIFY(!session2.isOpen()); - } else { + } else if (session2.isOpen()) { // Test closing the second session. { int stateChangedCountBeforeClose = stateChangedSpy2.count(); @@ -1161,11 +1207,15 @@ QDebug operator<<(QDebug debug, const QList &list) // at Discovered -state. void tst_QNetworkSession::outOfProcessSession() { - qDebug() << "START"; - + if (!testsToRun["outOfProcessSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #if defined(Q_OS_SYMBIAN) && defined(__WINS__) QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); #endif + updateConfigurations(); + QTest::qWait(2000); + QNetworkConfigurationManager manager; // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This // is actually the essence of this testcase - to check that platform mediates/reflects changes @@ -1182,16 +1232,15 @@ void tst_QNetworkSession::outOfProcessSession() QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); - qDebug() << "starting lackey"; QProcess lackey; lackey.start("lackey/lackey"); qDebug() << lackey.error() << lackey.errorString(); QVERIFY(lackey.waitForStarted()); - qDebug() << "waiting for connection"; + QVERIFY(oopServer.waitForNewConnection(-1)); QLocalSocket *oopSocket = oopServer.nextPendingConnection(); - qDebug() << "got connection"; + do { QByteArray output; @@ -1258,7 +1307,6 @@ void tst_QNetworkSession::outOfProcessSession() default: QSKIP("Lackey failed", SkipAll); } - qDebug("STOP"); } // A convinience / helper function for testcases. Return the first matching configuration. @@ -1269,6 +1317,7 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur // Refresh configurations and derive configurations matching given parameters. QNetworkConfigurationManager mgr; QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted())); + mgr.updateConfigurations(); QTRY_NOOP(updateSpy.count() == 1); if (updateSpy.count() != 1) { @@ -1277,8 +1326,7 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur } QList discoveredConfigs = mgr.allConfigurations(QNetworkConfiguration::Discovered); foreach(QNetworkConfiguration config, discoveredConfigs) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - // qDebug() << "Dumping config because is active: " << config.name(); + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { discoveredConfigs.removeOne(config); } else if (config.type() != configType) { // qDebug() << "Dumping config because type (IAP/SNAP) mismatches: " << config.name(); @@ -1315,9 +1363,23 @@ void updateConfigurations() QTRY_NOOP(updateSpy.count() == 1); } +// A convinience-function: updates and prints all available confiurations and their states +void printConfigurations() +{ + QNetworkConfigurationManager manager; + QList allConfigs = + manager.allConfigurations(); + qDebug("tst_QNetworkSession::printConfigurations QNetworkConfigurationManager gives following configurations: "); + foreach(QNetworkConfiguration config, allConfigs) { + qDebug() << "Name of the configuration: " << config.name(); + qDebug() << "State of the configuration: " << config.state(); + } +} + // A convinience function for test-cases: opens the given configuration and return // true if it was done gracefully. bool openSession(QNetworkSession *session) { + bool result = true; QNetworkConfigurationManager mgr; QSignalSpy openedSpy(session, SIGNAL(opened())); QSignalSpy stateChangeSpy(session, SIGNAL(stateChanged(QNetworkSession::State))); @@ -1327,43 +1389,57 @@ bool openSession(QNetworkSession *session) { // active by some other session QNetworkConfiguration::StateFlags configInitState = session->configuration().state(); QNetworkSession::State sessionInitState = session->state(); + qDebug() << "tst_QNetworkSession::openSession() name of the configuration to be opened: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::openSession() state of the configuration to be opened: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::openSession() state of the session to be opened: " << session->state(); if (session->isOpen() || !session->sessionProperty("ActiveConfiguration").toString().isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: session was already open / active."); - return false; + result = false; } else { session->open(); session->waitForOpened(120000); // Bringing interfaces up and down may take time at platform } + QTest::qWait(5000); // Wait a moment to ensure all signals are propagated // Check that connection opening went by the book. Add checks here if more strictness needed. if (!session->isOpen()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::open() failed."); - return false; + result = false; } if (openedSpy.count() != 1) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::opened() - signal not received."); - return false; + result = false; } if (!errorSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::error() - signal was detected."); - return false; + result = false; } if (sessionInitState != QNetworkSession::Connected && stateChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::stateChanged() - signals not detected."); - return false; + result = false; } if (configInitState != QNetworkConfiguration::Active && configChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkConfigurationManager::configurationChanged() - signals not detected."); - return false; + result = false; } if (session->configuration().state() != QNetworkConfiguration::Active) { qDebug("tst_QNetworkSession::openSession() failure: session's configuration is not in 'Active' -state."); - return false; + qDebug() << "tst_QNetworkSession::openSession() state is: " << session->configuration().state(); + result = false; + } + if (result == false) { + qDebug() << "tst_QNetworkSession::openSession() opening session failed."; + } else { + qDebug() << "tst_QNetworkSession::openSession() opening session succeeded."; } - return true; + qDebug() << "tst_QNetworkSession::openSession() name of the configuration is: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::openSession() configuration state is: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::openSession() session state is: " << session->state(); + + return result; } // Helper function for closing opened session. Performs checks that @@ -1376,6 +1452,11 @@ bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { qDebug("tst_QNetworkSession::closeSession() failure: NULL session given"); return false; } + + qDebug() << "tst_QNetworkSession::closeSession() name of the configuration to be closed: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::closeSession() state of the configuration to be closed: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::closeSession() state of the session to be closed: " << session->state(); + if (session->state() != QNetworkSession::Connected || !session->isOpen()) { qDebug("tst_QNetworkSession::closeSession() failure: session is not opened."); @@ -1387,38 +1468,48 @@ bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { QSignalSpy sessionErrorSpy(session, SIGNAL(error(QNetworkSession::SessionError))); QSignalSpy configChangeSpy(&mgr, SIGNAL(configurationChanged(QNetworkConfiguration))); + bool result = true; session->close(); + QTest::qWait(5000); // Wait a moment so that all signals are propagated if (!sessionErrorSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::error() received."); - return false; + result = false; } if (sessionClosedSpy.count() != 1) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::closed() signal not received."); - return false; + result = false; } if (lastSessionOnConfiguration && sessionStateChangedSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::stateChanged() signals not received."); - return false; + result = false; } if (lastSessionOnConfiguration && session->state() != QNetworkSession::Disconnected) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession is not in Disconnected -state"); - return false; + result = false; } QTRY_NOOP(!configChangeSpy.isEmpty()); if (lastSessionOnConfiguration && configChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkConfigurationManager::configurationChanged() - signal not detected."); - return false; + result = false; } if (lastSessionOnConfiguration && session->configuration().state() == QNetworkConfiguration::Active) { qDebug("tst_QNetworkSession::closeSession() failure: session's configuration is still in active state."); - return false; + result = false; } - return true; + if (result == false) { + qDebug() << "tst_QNetworkSession::closeSession() closing session failed."; + } else { + qDebug() << "tst_QNetworkSession::closeSession() closing session succeeded."; + } + qDebug() << "tst_QNetworkSession::closeSession() name of the configuration is: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::closeSession() configuration state is: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::closeSession() session state is: " << session->state(); + return result; } void tst_QNetworkSession::sessionAutoClose_data() -- cgit v0.12 From e6efa3ea81dff9eb0ade1c2ba868c272ccfcc958 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 13 May 2010 10:49:52 +1000 Subject: Bearer management changes from Qt Mobility. 9286bfcc43d38e0cb3bfd1d3f99ac7ab5d88b7e3 --- examples/network/bearermonitor/bearermonitor.cpp | 3 +++ examples/network/bearermonitor/sessionwidget.cpp | 12 ++++++++++-- examples/network/bearermonitor/sessionwidget.h | 5 ++++- examples/network/bearermonitor/sessionwidget.ui | 2 +- .../auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp | 7 +++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 4a6c6ff..0d98eff 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -255,6 +255,7 @@ void BearerMonitor::onlineStateChanged(bool isOnline) void BearerMonitor::registerNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -276,6 +277,7 @@ void BearerMonitor::registerNetwork() void BearerMonitor::unregisterNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -384,6 +386,7 @@ void BearerMonitor::createSessionFor(QTreeWidgetItem *item) void BearerMonitor::createNewSession() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; createSessionFor(item); } diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 443f4b2..3a8e5ea 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -59,7 +59,7 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren connect(session, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateSession())); connect(session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(updateSession())); + this, SLOT(updateSessionError(QNetworkSession::SessionError))); updateSession(); @@ -105,7 +105,6 @@ void SessionWidget::deleteSession() void SessionWidget::updateSession() { updateSessionState(session->state()); - updateSessionError(session->error()); if (session->state() == QNetworkSession::Connected) statsTimer = startTimer(1000); @@ -128,12 +127,14 @@ void SessionWidget::updateSession() void SessionWidget::openSession() { + clearError(); session->open(); updateSession(); } void SessionWidget::openSyncSession() { + clearError(); session->open(); session->waitForOpened(); updateSession(); @@ -141,12 +142,14 @@ void SessionWidget::openSyncSession() void SessionWidget::closeSession() { + clearError(); session->close(); updateSession(); } void SessionWidget::stopSession() { + clearError(); session->stop(); updateSession(); } @@ -195,3 +198,8 @@ void SessionWidget::updateSessionError(QNetworkSession::SessionError error) errorString->setText(session->errorString()); } +void SessionWidget::clearError() +{ + lastError->clear(); + errorString->clear(); +} diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 5e9d62c..b299b47 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -63,7 +63,7 @@ public: private: void updateSessionState(QNetworkSession::State state); - void updateSessionError(QNetworkSession::SessionError error); + void clearError(); private Q_SLOTS: void openSession(); @@ -71,9 +71,12 @@ private Q_SLOTS: void closeSession(); void stopSession(); void updateSession(); + void updateSessionError(QNetworkSession::SessionError error); #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) void deleteSession(); #endif + + private: QNetworkSession *session; int statsTimer; diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index 45135f5..56a2d0e 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -195,7 +195,7 @@ - Error String + Error String: diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index ce3acb7..a3cccb2 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -45,6 +45,13 @@ #include #include +/* + Although this unit test doesn't use QNetworkAccessManager + this include is used to ensure that bearer continues to compile against + Qt 4.7+ which has a QNetworkConfiguration enabled QNetworkAccessManager +*/ +#include + #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) #include #include -- cgit v0.12 From e75161c4d54406d137f34b9f54fed853c16a6269 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 13 May 2010 10:51:13 +1000 Subject: Cherry pick fix for MOBILITY-828 from Qt Mobility. Change 29776be110cdc121eb5a22446be6adae8ff6f4d8 from Qt Mobility. --- .../bearer/symbian/qnetworksession_impl.cpp | 4 +-- .../qnetworksession/test/tst_qnetworksession.cpp | 30 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 04853c4..f09c73a 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) - : CActive(CActive::EPriorityStandard), engine(engine), + : CActive(CActive::EPriorityUserInput), engine(engine), ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0), iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) @@ -1383,7 +1383,7 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne } ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) + : CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection) { CActiveScheduler::Add(this); } diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 8ab9da2..934a50e 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -263,10 +263,6 @@ void tst_QNetworkSession::robustnessBombing() testSession.accept(); testSession.ignore(); testSession.reject(); - quint64 temp; - temp = testSession.bytesWritten(); - temp = testSession.bytesReceived(); - temp = testSession.activeTime(); } @@ -704,7 +700,20 @@ void tst_QNetworkSession::userChoiceSession() session.open(); +#if defined(Q_OS_SYMBIAN) + // Opening & closing multiple connections in a row sometimes + // results hanging of connection opening on Symbian devices + // => If first open fails, wait a moment and try again. + if (!session.waitForOpened()) { + qDebug("**** Session open Timeout - Wait 5 seconds and try once again ****"); + session.close(); + QTest::qWait(5000); // Wait a while before trying to open session again + session.open(); + session.waitForOpened(); + } +#else session.waitForOpened(); +#endif if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -843,7 +852,20 @@ void tst_QNetworkSession::sessionOpenCloseStop() session.open(); +#if defined(Q_OS_SYMBIAN) + // Opening & closing multiple connections in a row sometimes + // results hanging of connection opening on Symbian devices + // => If first open fails, wait a moment and try again. + if (!session.waitForOpened()) { + qDebug("**** Session open Timeout - Wait 5 seconds and try once again ****"); + session.close(); + QTest::qWait(5000); // Wait a while before trying to open session again + session.open(); + session.waitForOpened(); + } +#else session.waitForOpened(); +#endif if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); -- cgit v0.12 From 608d39c9ffee622114d9bc178d5e8ad3d1eadfb5 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 13 May 2010 10:54:01 +1000 Subject: Cherry pick fix for MOBILITY-962 from Qt Mobility. 6ea1caf2babc68d366fb6d3dc215c1bb18a76368 --- tests/manual/bearerex/bearerex.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index 19246a2..bf60dd1 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -300,8 +300,12 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, SessionTab::~SessionTab() { + // Need to be nulled, because modal dialogs may return after destruction of this object and + // use already released resources. delete m_NetworkSession; + m_NetworkSession = NULL; delete m_http; + m_http = NULL; } void SessionTab::on_createQHttpButton_clicked() @@ -551,10 +555,16 @@ void SessionTab::done(bool error) msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes.")); } msgBox.exec(); - - sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ - QString(" / ")+ - QString::number(m_NetworkSession->bytesReceived())); + // Check if the networksession still exists - it may have gone after returning from + // the modal dialog (in the case that app has been closed, and deleting QHttp will + // trigger the done() invokation). + if (m_NetworkSession) { + sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ + QString(" / ")+ + QString::number(m_NetworkSession->bytesReceived())); + } else { + sentRecDataLineEdit->setText("Data amounts not available."); + } } // End of file -- cgit v0.12 From 75c4dea93ad415dd9c79cb57ec5598e38789b28d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 13 May 2010 10:55:06 +1000 Subject: Cherry pick fix for MOBILITY-932 from Qt Mobility. 807e9868152bb06d37895a5e3d1a3e49908a6036 --- .../bearer/symbian/qnetworksession_impl.cpp | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index f09c73a..ce2203d 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -523,13 +523,6 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) // when reporting. iClosedByUser = true; - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(activeConfig)); - - symbianConfig->mutex.lock(); - TUint activeIap = symbianConfig->numericId; - symbianConfig->mutex.unlock(); - isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); @@ -554,19 +547,12 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) // Close global 'Open C' RConnection setdefaultif(0); -#ifdef Q_CC_NOKIAX86 - if ((allowSignals && iapClientCount(activeIap) <= 0) || -#else - if ((allowSignals && iapClientCount(activeIap) <= 1) || -#endif - (publicConfig.type() == QNetworkConfiguration::UserChoice)) { + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { newState(QNetworkSession::Closing); + newState(QNetworkSession::Disconnected); } if (allowSignals) { - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - newState(QNetworkSession::Disconnected); - } emit closed(); } } @@ -599,7 +585,7 @@ void QNetworkSessionPrivateImpl::stop() } TUint numSubConnections; // Not used but needed by GetConnectionInfo i/f TUint connectionId; - for (TInt i = 1; i <= count; ++i) { + for (TUint i = 1; i <= count; ++i) { // Get (connection monitor's assigned) connection ID TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); if (ret == KErrNone) { @@ -1236,7 +1222,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint QMutexLocker configLocker(&symbianConfig->mutex); if (symbianConfig->numericId == accessPointId) { - if (newState == QNetworkSession::Connected) { + if (newState != QNetworkSession::Disconnected) { state = newState; #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed D to: " << state; @@ -1256,6 +1242,16 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint #endif emit stateChanged(state); retVal = true; + } else if (config.state() == QNetworkConfiguration::Active) { + // Connection to used IAP was closed, but there is another + // IAP that's active in used SNAP + // => Change state back to Connected + state = QNetworkSession::Connected; + emit stateChanged(state); + retVal = true; +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed F to: " << state; +#endif } } } -- cgit v0.12 From 5cd963d2628ed7c01d331cdad03b4d77161c8b93 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 14 May 2010 13:15:08 +1000 Subject: Fix crash in ParentAnimation. copyOriginals plays with the order of the revertList, which messes up the assumptions of ParentAnimation. The full fix will require some rearchitecting of how the states and transitions handle "related" actions, but for now this fixes the crash. Reverting to the base state has also been fixed. Task-number: QTBUG-10671, QTBUG-10676 --- src/declarative/util/qdeclarativeanimation.cpp | 14 +++++++------- src/declarative/util/qdeclarativepropertychanges.cpp | 4 ++-- src/declarative/util/qdeclarativestate.cpp | 3 ++- src/declarative/util/qdeclarativestate_p.h | 1 + src/declarative/util/qdeclarativestateoperations.cpp | 4 ++-- src/declarative/util/qdeclarativestateoperations_p.h | 3 ++- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0f7c946..67440b6 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2536,13 +2536,13 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, viaData->pc << vpc; viaData->actions << myAction; QDeclarativeAction dummyAction; - QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; bool forward = (direction == QDeclarativeAbstractAnimation::Forward); QDeclarativeItem *target = pc->object(); - QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent(); + QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent(); //### this mirrors the logic in QDeclarativeParentChange. bool ok; @@ -2583,9 +2583,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) { qreal w = target->width(); qreal h = target->height(); - if (pc->widthIsSet()) + if (pc->widthIsSet() && i < actions.size() - 1) w = actions[++i].toValue.toReal(); - if (pc->heightIsSet()) + if (pc->heightIsSet() && i < actions.size() - 1) h = actions[++i].toValue.toReal(); const QPointF &transformOrigin = d->computeTransformOrigin(target->transformOrigin(), w,h); diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index a22c756..12fef36 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -179,7 +179,7 @@ public: reverseExpression = rewindExpression; } - virtual void copyOriginals(QDeclarativeActionEvent *other) + /*virtual void copyOriginals(QDeclarativeActionEvent *other) { QDeclarativeReplaceSignalHandler *rsh = static_cast(other); saveCurrentValues(); @@ -190,7 +190,7 @@ public: ownedExpression = rsh->ownedExpression; rsh->ownedExpression = 0; } - } + }*/ virtual void rewind() { ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index ea209aa..b5f7900 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -390,12 +390,13 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit if (action.event->override(event)) { found = true; - if (action.event != d->revertList.at(jj).event) { + if (action.event != d->revertList.at(jj).event && action.event->needsCopy()) { action.event->copyOriginals(d->revertList.at(jj).event); QDeclarativeSimpleAction r(action); additionalReverts << r; d->revertList.removeAt(jj); + --jj; } else if (action.event->isRewindable()) //###why needed? action.event->saveCurrentValues(); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index 0ba67b0..25715c6 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -96,6 +96,7 @@ public: virtual bool isReversable(); virtual void reverse(Reason reason = ActualChange); virtual void saveOriginals() {} + virtual bool needsCopy() { return false; } virtual void copyOriginals(QDeclarativeActionEvent *) {} virtual bool isRewindable() { return isReversable(); } diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index a93a25d..a6fcaf3 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -408,7 +408,7 @@ void QDeclarativeParentChange::saveOriginals() d->origStackBefore = d->rewindStackBefore; } -void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other) +/*void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other) { Q_D(QDeclarativeParentChange); QDeclarativeParentChange *pc = static_cast(other); @@ -417,7 +417,7 @@ void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other) d->origStackBefore = pc->d_func()->rewindStackBefore; saveCurrentValues(); -} +}*/ void QDeclarativeParentChange::execute(Reason) { diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h index e22c1e2..21a86f5 100644 --- a/src/declarative/util/qdeclarativestateoperations_p.h +++ b/src/declarative/util/qdeclarativestateoperations_p.h @@ -107,7 +107,7 @@ public: virtual ActionList actions(); virtual void saveOriginals(); - virtual void copyOriginals(QDeclarativeActionEvent*); + //virtual void copyOriginals(QDeclarativeActionEvent*); virtual void execute(Reason reason = ActualChange); virtual bool isReversable(); virtual void reverse(Reason reason = ActualChange); @@ -277,6 +277,7 @@ public: virtual bool override(QDeclarativeActionEvent*other); virtual bool changesBindings(); virtual void saveOriginals(); + virtual bool needsCopy() { return true; } virtual void copyOriginals(QDeclarativeActionEvent*); virtual void clearBindings(); virtual void rewind(); -- cgit v0.12 From 645b9ee9dd6e0576542cc61872ecedb408ca8a89 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 May 2010 13:45:08 +1000 Subject: Add Qt.include() method for scoped inclusion of JavaScript files --- src/declarative/qml/qdeclarativeinclude.cpp | 255 +++++++++++++++++++++ src/declarative/qml/qdeclarativeinclude_p.h | 112 +++++++++ .../qdeclarativeecmascript/data/blank.js | 0 .../qdeclarativeecmascript/data/exception.js | 1 + .../qdeclarativeecmascript/data/include.js | 8 + .../qdeclarativeecmascript/data/include.qml | 23 ++ .../data/include_callback.js | 11 + .../data/include_callback.qml | 15 ++ .../qdeclarativeecmascript/data/include_remote.js | 26 +++ .../qdeclarativeecmascript/data/include_remote.qml | 21 ++ .../data/include_remote_missing.js | 13 ++ .../data/include_remote_missing.qml | 12 + .../qdeclarativeecmascript/data/include_shared.js | 12 + .../qdeclarativeecmascript/data/include_shared.qml | 22 ++ .../qdeclarativeecmascript/data/js/include2.js | 4 + .../qdeclarativeecmascript/data/js/include3.js | 3 + .../qdeclarativeecmascript/data/remote_file.js | 2 + 17 files changed, 540 insertions(+) create mode 100644 src/declarative/qml/qdeclarativeinclude.cpp create mode 100644 src/declarative/qml/qdeclarativeinclude_p.h create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/blank.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/exception.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp new file mode 100644 index 0000000..97af5b5 --- /dev/null +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -0,0 +1,255 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 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 "qdeclarativeinclude_p.h" + +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +QDeclarativeInclude::QDeclarativeInclude(const QUrl &url, + QDeclarativeEngine *engine, + QScriptContext *ctxt) +: QObject(engine), m_engine(engine), m_network(0), m_reply(0), m_url(url), m_redirectCount(0) +{ + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + m_context = ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3)); + + m_scope[0] = QScriptDeclarativeClass::scopeChainValue(ctxt, -4); + m_scope[1] = QScriptDeclarativeClass::scopeChainValue(ctxt, -5); + + m_scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); + m_network = QDeclarativeScriptEngine::get(m_scriptEngine)->networkAccessManager(); + + m_result = resultValue(m_scriptEngine); + + QNetworkRequest request; + request.setUrl(url); + + m_reply = m_network->get(request); + QObject::connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); +} + +QDeclarativeInclude::~QDeclarativeInclude() +{ + if (m_reply) + delete m_reply; +} + +QScriptValue QDeclarativeInclude::resultValue(QScriptEngine *engine, Status status) +{ + QScriptValue result = engine->newObject(); + result.setProperty(QLatin1String("OK"), QScriptValue(engine, Ok)); + result.setProperty(QLatin1String("LOADING"), QScriptValue(engine, Loading)); + result.setProperty(QLatin1String("NETWORK_ERROR"), QScriptValue(engine, NetworkError)); + result.setProperty(QLatin1String("EXCEPTION"), QScriptValue(engine, Exception)); + + result.setProperty(QLatin1String("status"), QScriptValue(engine, status)); + return result; +} + +QScriptValue QDeclarativeInclude::result() const +{ + return m_result; +} + +void QDeclarativeInclude::setCallback(const QScriptValue &c) +{ + m_callback = c; +} + +QScriptValue QDeclarativeInclude::callback() const +{ + return m_callback; +} + +#define INCLUDE_MAXIMUM_REDIRECT_RECURSION 15 +void QDeclarativeInclude::finished() +{ + m_redirectCount++; + + if (m_redirectCount < INCLUDE_MAXIMUM_REDIRECT_RECURSION) { + QVariant redirect = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirect.isValid()) { + m_url = m_url.resolved(redirect.toUrl()); + delete m_reply; + + QNetworkRequest request; + request.setUrl(m_url); + + m_reply = m_network->get(request); + QObject::connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); + return; + } + } + + if (m_reply->error() == QNetworkReply::NoError) { + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(m_engine); + + QByteArray data = m_reply->readAll(); + + QString code = QString::fromUtf8(data); + + QString urlString = m_url.toString(); + QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(m_scriptEngine); + scriptContext->pushScope(ep->contextClass->newUrlContext(m_context, 0, urlString)); + scriptContext->pushScope(m_scope[0]); + + scriptContext->pushScope(m_scope[1]); + scriptContext->setActivationObject(m_scope[1]); + + m_scriptEngine->evaluate(code, urlString, 1); + + m_scriptEngine->popContext(); + + if (m_scriptEngine->hasUncaughtException()) { + m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Exception)); + m_result.setProperty(QLatin1String("exception"), m_scriptEngine->uncaughtException()); + } else { + m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Ok)); + } + } else { + m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, NetworkError)); + } + + callback(m_scriptEngine, m_callback, m_result); + + delete this; +} + +void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback, QScriptValue &status) +{ + if (callback.isValid()) { + QScriptValue args = engine->newArray(1); + args.setProperty(0, status); + callback.call(QScriptValue(), args); + } +} + +static QString toLocalFileOrQrc(const QUrl& url) +{ + if (url.scheme() == QLatin1String("qrc")) { + if (url.authority().isEmpty()) + return QLatin1Char(':') + url.path(); + return QString(); + } + return url.toLocalFile(); +} + +QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine) +{ + if (ctxt->argumentCount() == 0) + return engine->undefinedValue(); + + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + + QUrl contextUrl = ep->contextClass->urlFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3)); + if (contextUrl.isEmpty()) + return ctxt->throwError(QLatin1String("Qt.include(): Can only be called from JavaScript files")); + + QString urlString = ctxt->argument(0).toString(); + QUrl url(ctxt->argument(0).toString()); + if (url.isRelative()) { + url = QUrl(contextUrl).resolved(url); + urlString = url.toString(); + } + + QString localFile = toLocalFileOrQrc(url); + + QScriptValue func = ctxt->argument(1); + if (!func.isFunction()) + func = QScriptValue(); + + QScriptValue result; + if (localFile.isEmpty()) { + QDeclarativeInclude *i = + new QDeclarativeInclude(url, QDeclarativeEnginePrivate::getEngine(engine), ctxt); + + if (func.isValid()) + i->setCallback(func); + + result = i->result(); + } else { + + QFile f(localFile); + if (f.open(QIODevice::ReadOnly)) { + QByteArray data = f.readAll(); + QString code = QString::fromUtf8(data); + + QDeclarativeContextData *context = + ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3)); + + QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(engine); + scriptContext->pushScope(ep->contextClass->newUrlContext(context, 0, urlString)); + scriptContext->pushScope(ep->globalClass->globalObject()); + QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -5); + scriptContext->pushScope(scope); + scriptContext->setActivationObject(scope); + + engine->evaluate(code, urlString, 1); + + engine->popContext(); + + if (engine->hasUncaughtException()) { + result = resultValue(engine, Exception); + result.setProperty(QLatin1String("exception"), engine->uncaughtException()); + } else { + result = resultValue(engine, Ok); + } + callback(engine, func, result); + } else { + result = resultValue(engine, NetworkError); + callback(engine, func, result); + } + } + + return result; +} + + + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeinclude_p.h b/src/declarative/qml/qdeclarativeinclude_p.h new file mode 100644 index 0000000..28c49ea --- /dev/null +++ b/src/declarative/qml/qdeclarativeinclude_p.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 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 QDECLARATIVEINCLUDE_P_H +#define QDECLARATIVEINCLUDE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeEngine; +class QScriptContext; +class QScriptEngine; +class QNetworkAccessManager; +class QNetworkReply; +class QDeclarativeInclude : public QObject +{ + Q_OBJECT +public: + enum Status { + Ok = 0, + Loading = 1, + NetworkError = 2, + Exception = 3 + }; + + QDeclarativeInclude(const QUrl &, QDeclarativeEngine *, QScriptContext *ctxt); + ~QDeclarativeInclude(); + + void setCallback(const QScriptValue &); + QScriptValue callback() const; + + QScriptValue result() const; + + static QScriptValue resultValue(QScriptEngine *, Status status = Loading); + static void callback(QScriptEngine *, QScriptValue &callback, QScriptValue &status); + static QScriptValue include(QScriptContext *ctxt, QScriptEngine *engine); + +public slots: + void finished(); + +private: + QDeclarativeEngine *m_engine; + QScriptEngine *m_scriptEngine; + QNetworkAccessManager *m_network; + QNetworkReply *m_reply; + + QUrl m_url; + int m_redirectCount; + QScriptValue m_callback; + QScriptValue m_result; + QDeclarativeGuardedContextData m_context; + QScriptValue m_scope[2]; +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVEINCLUDE_P_H + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/blank.js b/tests/auto/declarative/qdeclarativeecmascript/data/blank.js new file mode 100644 index 0000000..e69de29 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/exception.js b/tests/auto/declarative/qdeclarativeecmascript/data/exception.js new file mode 100644 index 0000000..160bbfa --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exception.js @@ -0,0 +1 @@ +throw("Whoops!"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.js b/tests/auto/declarative/qdeclarativeecmascript/data/include.js new file mode 100644 index 0000000..232fd80 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.js @@ -0,0 +1,8 @@ +var test1 = true +var test2 = false +var test3 = false + +function go() { + Qt.include("js/include2.js"); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml new file mode 100644 index 0000000..18543b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml @@ -0,0 +1,23 @@ +import Qt 4.7 +import "include.js" as IncludeTest + +QtObject { + property int test0: 0 + property bool test1: false + property bool test2: false + property bool test2_1: false + property bool test3: false + property bool test3_1: false + + property int testValue: 99 + + Component.onCompleted: { + IncludeTest.go(); + test0 = IncludeTest.value + test1 = IncludeTest.test1 + test2 = IncludeTest.test2 + test2_1 = IncludeTest.test2_1 + test3 = IncludeTest.test3 + test3_1 = IncludeTest.test3_1 + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js new file mode 100644 index 0000000..ea19eba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js @@ -0,0 +1,11 @@ +function go() { + var a = Qt.include("missing.js", function(o) { test2 = o.status == o.NETWORK_ERROR }); + test1 = a.status == a.NETWORK_ERROR + + var b = Qt.include("blank.js", function(o) { test4 = o.status == o.OK }); + test3 = b.status == b.OK + + var c = Qt.include("exception.js", function(o) { test6 = o.status == o.EXCEPTION }); + test5 = c.status == c.EXCEPTION +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml new file mode 100644 index 0000000..a39e821 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml @@ -0,0 +1,15 @@ +import Qt 4.7 +import "include_callback.js" as IncludeTest + +QtObject { + property bool test1: false + property bool test2: false + property bool test3: false + property bool test4: false + property bool test5: false + property bool test6: false + + Component.onCompleted: { + IncludeTest.go(); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js new file mode 100644 index 0000000..e6a4676 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js @@ -0,0 +1,26 @@ +var myvar = 10; + +function go() +{ + var a = Qt.include("http://127.0.0.1:8111/remote_file.js", + function(o) { + test2 = o.status == o.OK + test3 = a.status == a.OK + test4 = myvar == 13 + + done = true; + }); + test1 = a.status == a.LOADING + + + var b = Qt.include("http://127.0.0.1:8111/exception.js", + function(o) { + test7 = o.status == o.EXCEPTION + test8 = b.status == a.EXCEPTION + test9 = b.exception.toString() == "Whoops!"; + test10 = o.exception.toString() == "Whoops!"; + + done2 = true; + }); + test6 = b.status == b.LOADING +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml new file mode 100644 index 0000000..06bd174 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml @@ -0,0 +1,21 @@ +import Qt 4.7 +import "include_remote.js" as IncludeTest + +QtObject { + property bool done: false + property bool done2: false + + property bool test1: false + property bool test2: false + property bool test3: false + property bool test4: false + property bool test5: false + + property bool test6: false + property bool test7: false + property bool test8: false + property bool test9: false + property bool test10: false + + Component.onCompleted: IncludeTest.go(); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js new file mode 100644 index 0000000..cc90860 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js @@ -0,0 +1,13 @@ +function go() +{ + var a = Qt.include("http://127.0.0.1:8111/missing.js", + function(o) { + test2 = o.status == o.NETWORK_ERROR + test3 = a.status == a.NETWORK_ERROR + + done = true; + }); + + test1 = a.status == a.LOADING +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml new file mode 100644 index 0000000..8e486b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +import "include_remote_missing.js" as IncludeTest + +QtObject { + property bool done: false + + property bool test1: false + property bool test2: false + property bool test3: false + + Component.onCompleted: IncludeTest.go(); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js new file mode 100644 index 0000000..a49c07b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js @@ -0,0 +1,12 @@ +.pragma library + +var test1 = true +var test2 = false +var test3 = false + +var testValue = 99; + +function go() { + Qt.include("js/include2.js"); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml new file mode 100644 index 0000000..e957018 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml @@ -0,0 +1,22 @@ +import Qt 4.7 +import "include_shared.js" as IncludeTest + +QtObject { + property int test0: 0 + property bool test1: false + property bool test2: false + property bool test2_1: false + property bool test3: false + property bool test3_1: false + + Component.onCompleted: { + IncludeTest.go(); + test0 = IncludeTest.value + test1 = IncludeTest.test1 + test2 = IncludeTest.test2 + test2_1 = IncludeTest.test2_1 + test3 = IncludeTest.test3 + test3_1 = IncludeTest.test3_1 + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js b/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js new file mode 100644 index 0000000..2a0c039 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js @@ -0,0 +1,4 @@ +test2 = true +var test2_1 = true + +Qt.include("include3.js"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js b/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js new file mode 100644 index 0000000..84b2770 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js @@ -0,0 +1,3 @@ +test3 = true +var test3_1 = true +var value = testValue diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js b/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js new file mode 100644 index 0000000..1b123ae --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js @@ -0,0 +1,2 @@ +myvar = 13; +test5 = true; -- cgit v0.12 From 0d608587f35f7659376a728cf8ee6b4b71ec9d5a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 14 May 2010 13:56:45 +1000 Subject: Reduce the chance of AnchorAnimation animating geometry changes it isn't responsible for. --- src/declarative/util/qdeclarativestateoperations.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index a6fcaf3..0326f6d 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -1241,24 +1241,28 @@ QList QDeclarativeAnchorChanges::additionalActions() Q_D(QDeclarativeAnchorChanges); QList extra; + QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->usedAnchors | d->anchorSet->d_func()->resetAnchors; + bool hChange = combined & QDeclarativeAnchors::Horizontal_Mask; + bool vChange = combined & QDeclarativeAnchors::Vertical_Mask; + if (d->target) { QDeclarativeAction a; - if (d->fromX != d->toX) { + if (hChange && d->fromX != d->toX) { a.property = QDeclarativeProperty(d->target, QLatin1String("x")); a.toValue = d->toX; extra << a; } - if (d->fromY != d->toY) { + if (vChange && d->fromY != d->toY) { a.property = QDeclarativeProperty(d->target, QLatin1String("y")); a.toValue = d->toY; extra << a; } - if (d->fromWidth != d->toWidth) { + if (hChange && d->fromWidth != d->toWidth) { a.property = QDeclarativeProperty(d->target, QLatin1String("width")); a.toValue = d->toWidth; extra << a; } - if (d->fromHeight != d->toHeight) { + if (vChange && d->fromHeight != d->toHeight) { a.property = QDeclarativeProperty(d->target, QLatin1String("height")); a.toValue = d->toHeight; extra << a; -- cgit v0.12 From 17a5c63a499b10036dc14135457ec22c89270f9a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 May 2010 14:00:21 +1000 Subject: Missing files from 645b9ee9dd6e0576542cc61872ecedb408ca8a89 Grrr --- src/declarative/qml/qdeclarativecontext.cpp | 4 +- .../qml/qdeclarativecontextscriptclass.cpp | 46 ++++++++- .../qml/qdeclarativecontextscriptclass_p.h | 4 + src/declarative/qml/qdeclarativeengine.cpp | 2 + .../qml/qdeclarativeglobalscriptclass_p.h | 1 + src/declarative/qml/qdeclarativeinclude.cpp | 10 +- src/declarative/qml/qdeclarativeinclude_p.h | 3 +- src/declarative/qml/qml.pri | 2 + .../qdeclarativeecmascript.pro | 11 +- .../tst_qdeclarativeecmascript.cpp | 111 +++++++++++++++++++++ 10 files changed, 182 insertions(+), 12 deletions(-) diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index b61b8cb..6a13f15 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -659,7 +659,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object if (iter == enginePriv->m_sharedScriptImports.end()) { QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); - scriptContext->pushScope(enginePriv->contextClass->newContext(0, 0)); + scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url)); scriptContext->pushScope(enginePriv->globalClass->globalObject()); QScriptValue scope = scriptEngine->newObject(); @@ -685,7 +685,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); - scriptContext->pushScope(enginePriv->contextClass->newContext(this, 0)); + scriptContext->pushScope(enginePriv->contextClass->newUrlContext(this, 0, url)); scriptContext->pushScope(enginePriv->globalClass->globalObject()); QScriptValue scope = scriptEngine->newObject(); diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 1336a1a..1ebedbb 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -51,11 +51,13 @@ QT_BEGIN_NAMESPACE struct ContextData : public QScriptDeclarativeClass::Object { ContextData() : overrideObject(0), isSharedContext(true) {} - ContextData(QDeclarativeContextData *c, QObject *o) : context(c), scopeObject(o), overrideObject(0), isSharedContext(false) {} + ContextData(QDeclarativeContextData *c, QObject *o) + : context(c), scopeObject(o), overrideObject(0), isSharedContext(false), isUrlContext(false) {} QDeclarativeGuardedContextData context; QDeclarativeGuard scopeObject; QObject *overrideObject; - bool isSharedContext; + bool isSharedContext:1; + bool isUrlContext:1; QDeclarativeContextData *getContext(QDeclarativeEngine *engine) { if (isSharedContext) { @@ -74,6 +76,18 @@ struct ContextData : public QScriptDeclarativeClass::Object { } }; +struct UrlContextData : public ContextData { + UrlContextData(QDeclarativeContextData *c, QObject *o, const QString &u) + : ContextData(c, o), url(u) { + isUrlContext = true; + } + UrlContextData(const QString &u) + : ContextData(0, 0), url(u) { + isUrlContext = true; + } + QString url; +}; + /* The QDeclarativeContextScriptClass handles property access for a QDeclarativeContext via QtScript. @@ -95,6 +109,21 @@ QScriptValue QDeclarativeContextScriptClass::newContext(QDeclarativeContextData return newObject(scriptEngine, this, new ContextData(context, scopeObject)); } +QScriptValue QDeclarativeContextScriptClass::newUrlContext(QDeclarativeContextData *context, QObject *scopeObject, + const QString &url) +{ + QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); + + return newObject(scriptEngine, this, new UrlContextData(context, scopeObject, url)); +} + +QScriptValue QDeclarativeContextScriptClass::newUrlContext(const QString &url) +{ + QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); + + return newObject(scriptEngine, this, new UrlContextData(url)); +} + QScriptValue QDeclarativeContextScriptClass::newSharedContext() { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -111,6 +140,19 @@ QDeclarativeContextData *QDeclarativeContextScriptClass::contextFromValue(const return data->getContext(engine); } +QUrl QDeclarativeContextScriptClass::urlFromValue(const QScriptValue &v) +{ + if (scriptClass(v) != this) + return QUrl(); + + ContextData *data = (ContextData *)object(v); + if (data->isUrlContext) { + return QUrl(static_cast(data)->url); + } else { + return QUrl(); + } +} + QObject *QDeclarativeContextScriptClass::setOverrideObject(QScriptValue &v, QObject *override) { if (scriptClass(v) != this) diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h index 1936d38..1215b00 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h +++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h @@ -68,9 +68,13 @@ public: ~QDeclarativeContextScriptClass(); QScriptValue newContext(QDeclarativeContextData *, QObject * = 0); + QScriptValue newUrlContext(QDeclarativeContextData *, QObject *, const QString &); + QScriptValue newUrlContext(const QString &); QScriptValue newSharedContext(); QDeclarativeContextData *contextFromValue(const QScriptValue &); + QUrl urlFromValue(const QScriptValue &); + QObject *setOverrideObject(QScriptValue &, QObject *); protected: diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 94e6771..5cb59da 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -67,6 +67,7 @@ #include "qdeclarativeextensioninterface.h" #include "private/qdeclarativelist_p.h" #include "private/qdeclarativetypenamecache_p.h" +#include "private/qdeclarativeinclude_p.h" #include #include @@ -204,6 +205,7 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr // XXX used to add Qt.Sound class. //types + qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::include, 2)); qtObject.setProperty(QLatin1String("isQtObject"), newFunction(QDeclarativeEnginePrivate::isQtObject, 1)); qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4)); qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4)); diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h index 1b34aee..7690edd 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h @@ -76,6 +76,7 @@ public: void explicitSetProperty(const QString &, const QScriptValue &); const QScriptValue &globalObject() const { return m_globalObject; } + const QSet &illegalNames() const { return m_illegalNames; } private: diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 97af5b5..b886935 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -76,8 +76,7 @@ QDeclarativeInclude::QDeclarativeInclude(const QUrl &url, QDeclarativeInclude::~QDeclarativeInclude() { - if (m_reply) - delete m_reply; + delete m_reply; } QScriptValue QDeclarativeInclude::resultValue(QScriptEngine *engine, Status status) @@ -116,7 +115,7 @@ void QDeclarativeInclude::finished() QVariant redirect = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (redirect.isValid()) { m_url = m_url.resolved(redirect.toUrl()); - delete m_reply; + delete m_reply; QNetworkRequest request; request.setUrl(m_url); @@ -149,6 +148,7 @@ void QDeclarativeInclude::finished() if (m_scriptEngine->hasUncaughtException()) { m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Exception)); m_result.setProperty(QLatin1String("exception"), m_scriptEngine->uncaughtException()); + m_scriptEngine->clearExceptions(); } else { m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Ok)); } @@ -158,7 +158,8 @@ void QDeclarativeInclude::finished() callback(m_scriptEngine, m_callback, m_result); - delete this; + disconnect(); + deleteLater(); } void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback, QScriptValue &status) @@ -237,6 +238,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e if (engine->hasUncaughtException()) { result = resultValue(engine, Exception); result.setProperty(QLatin1String("exception"), engine->uncaughtException()); + engine->clearExceptions(); } else { result = resultValue(engine, Ok); } diff --git a/src/declarative/qml/qdeclarativeinclude_p.h b/src/declarative/qml/qdeclarativeinclude_p.h index 28c49ea..9678e42 100644 --- a/src/declarative/qml/qdeclarativeinclude_p.h +++ b/src/declarative/qml/qdeclarativeinclude_p.h @@ -58,6 +58,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -96,7 +97,7 @@ private: QDeclarativeEngine *m_engine; QScriptEngine *m_scriptEngine; QNetworkAccessManager *m_network; - QNetworkReply *m_reply; + QDeclarativeGuard m_reply; QUrl m_url; int m_redirectCount; diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index dab9767..12f9794 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -9,6 +9,7 @@ SOURCES += \ $$PWD/qdeclarativeproperty.cpp \ $$PWD/qdeclarativecomponent.cpp \ $$PWD/qdeclarativecontext.cpp \ + $$PWD/qdeclarativeinclude.cpp \ $$PWD/qdeclarativecustomparser.cpp \ $$PWD/qdeclarativepropertyvaluesource.cpp \ $$PWD/qdeclarativepropertyvalueinterceptor.cpp \ @@ -92,6 +93,7 @@ HEADERS += \ $$PWD/qdeclarativeinfo.h \ $$PWD/qdeclarativeproperty_p.h \ $$PWD/qdeclarativecontext_p.h \ + $$PWD/qdeclarativeinclude_p.h \ $$PWD/qdeclarativecompositetypedata_p.h \ $$PWD/qdeclarativecompositetypemanager_p.h \ $$PWD/qdeclarativelist.h \ diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index eabed26..c907be5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -1,13 +1,18 @@ load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative script +contains(QT_CONFIG,declarative): QT += declarative script network macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeecmascript.cpp \ - testtypes.cpp -HEADERS += testtypes.h + testtypes.cpp \ + ../shared/testhttpserver.cpp +HEADERS += testtypes.h \ + ../shared/testhttpserver.h +INCLUDEPATH += ../shared # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov +DEFINES += SRCDIR=\\\"$$PWD\\\" + CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 8c9290f..b8faa7c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -51,6 +51,7 @@ #include #include #include "testtypes.h" +#include "testhttpserver.h" /* This test covers evaluation of ECMAScript expressions and bindings from within @@ -149,6 +150,8 @@ private slots: void eval(); void function(); + void include(); + void callQtInvokables(); private: QDeclarativeEngine engine; @@ -2361,6 +2364,114 @@ void tst_qdeclarativeecmascript::function() delete o; } +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 6; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + +// Test the "Qt.include" method +void tst_qdeclarativeecmascript::include() +{ + // Non-library relative include + { + QDeclarativeComponent component(&engine, TEST_FILE("include.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test0").toInt(), 99); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test2_1").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test3_1").toBool(), true); + + delete o; + } + + // Library relative include + { + QDeclarativeComponent component(&engine, TEST_FILE("include_shared.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test0").toInt(), 99); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test2_1").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test3_1").toBool(), true); + + delete o; + } + + // Callback + { + QDeclarativeComponent component(&engine, TEST_FILE("include_callback.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toBool(), true); + + delete o; + } + + // Remote - success + { + TestHTTPServer server(8111); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeComponent component(&engine, TEST_FILE("include_remote.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + TRY_WAIT(o->property("done").toBool() == true); + TRY_WAIT(o->property("done2").toBool() == true); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + + QCOMPARE(o->property("test6").toBool(), true); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toBool(), true); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + + delete o; + } + + // Remote - error + { + TestHTTPServer server(8111); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeComponent component(&engine, TEST_FILE("include_remote_missing.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + TRY_WAIT(o->property("done").toBool() == true); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + + delete o; + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 2f6eb60bf4012f9a185d7cd5d4c50762c3abc7f7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 May 2010 15:33:48 +1000 Subject: Only add "include" property in non-workerscript threads --- src/declarative/qml/qdeclarativeengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 5cb59da..8d3ca59 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -205,7 +205,8 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr // XXX used to add Qt.Sound class. //types - qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::include, 2)); + if (mainthread) + qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::include, 2)); qtObject.setProperty(QLatin1String("isQtObject"), newFunction(QDeclarativeEnginePrivate::isQtObject, 1)); qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4)); qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4)); -- cgit v0.12 From 3f775da6fec8b5cfb5e538100b7889401d14c410 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 14 May 2010 08:04:54 +0200 Subject: Add missing file! Amendment to 812f78e55aa3db4d51ec8617320358d80c4a71d5. --- examples/graphicsview/padnavigator/form.ui | 208 +++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 examples/graphicsview/padnavigator/form.ui diff --git a/examples/graphicsview/padnavigator/form.ui b/examples/graphicsview/padnavigator/form.ui new file mode 100644 index 0000000..fc7d123 --- /dev/null +++ b/examples/graphicsview/padnavigator/form.ui @@ -0,0 +1,208 @@ + + Form + + + + 0 + 0 + 378 + 385 + + + + BackSide + + + + + + Settings + + + true + + + true + + + + + + Title: + + + + + + + Pad Navigator Example + + + + + + + Modified: + + + + + + + Extent + + + + + + + + + 42 + + + Qt::Horizontal + + + + + + + 42 + + + + + + + + + + + + + + + Other input + + + true + + + true + + + + + + + Widgets On Graphics View + + + + + QGraphicsProxyWidget + + + + QGraphicsWidget + + + + QObject + + + + + QGraphicsItem + + + + + QGraphicsLayoutItem + + + + + + + QGraphicsGridLayout + + + + QGraphicsLayout + + + + QGraphicsLayoutItem + + + + + + + QGraphicsLinearLayout + + + + QGraphicsLayout + + + + QGraphicsLayoutItem + + + + + + + + + + + + + groupBox + hostName + dateTimeEdit + horizontalSlider + spinBox + groupBox_2 + treeWidget + + + + + horizontalSlider + valueChanged(int) + spinBox + setValue(int) + + + 184 + 125 + + + 275 + 127 + + + + + spinBox + valueChanged(int) + horizontalSlider + setValue(int) + + + 272 + 114 + + + 190 + 126 + + + + + -- cgit v0.12 From d9ab23c190de774ea093652060981e14ac5aeaf8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 May 2010 17:15:08 +1000 Subject: Qt.include() support in worker scripts --- src/declarative/qml/qdeclarativeengine.cpp | 3 ++ src/declarative/qml/qdeclarativeinclude.cpp | 59 ++++++++++++++++++++++++ src/declarative/qml/qdeclarativeinclude_p.h | 2 + src/declarative/qml/qdeclarativeworkerscript.cpp | 6 ++- 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8d3ca59..2c89abd 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -207,6 +207,9 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr //types if (mainthread) qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::include, 2)); + else + qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::worker_include, 2)); + qtObject.setProperty(QLatin1String("isQtObject"), newFunction(QDeclarativeEnginePrivate::isQtObject, 1)); qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4)); qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4)); diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index b886935..97220f1 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -252,6 +252,65 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e return result; } +QScriptValue QDeclarativeInclude::worker_include(QScriptContext *ctxt, QScriptEngine *engine) +{ + if (ctxt->argumentCount() == 0) + return engine->undefinedValue(); + + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + + QString urlString = ctxt->argument(0).toString(); + QUrl url(ctxt->argument(0).toString()); + if (url.isRelative()) { + QString contextUrl = QScriptDeclarativeClass::scopeChainValue(ctxt, -3).data().toString(); + Q_ASSERT(!contextUrl.isEmpty()); + + url = QUrl(contextUrl).resolved(url); + urlString = url.toString(); + } + + QString localFile = toLocalFileOrQrc(url); + + QScriptValue func = ctxt->argument(1); + if (!func.isFunction()) + func = QScriptValue(); + + QScriptValue result; + if (!localFile.isEmpty()) { + + QFile f(localFile); + if (f.open(QIODevice::ReadOnly)) { + QByteArray data = f.readAll(); + QString code = QString::fromUtf8(data); + QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(engine); + QScriptValue urlContext = engine->newObject(); + urlContext.setData(QScriptValue(engine, urlString)); + scriptContext->pushScope(urlContext); + + QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -4); + scriptContext->pushScope(scope); + scriptContext->setActivationObject(scope); + + engine->evaluate(code, urlString, 1); + + engine->popContext(); + + if (engine->hasUncaughtException()) { + result = resultValue(engine, Exception); + result.setProperty(QLatin1String("exception"), engine->uncaughtException()); + engine->clearExceptions(); + } else { + result = resultValue(engine, Ok); + } + callback(engine, func, result); + } else { + result = resultValue(engine, NetworkError); + callback(engine, func, result); + } + } + + return result; +} QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeinclude_p.h b/src/declarative/qml/qdeclarativeinclude_p.h index 9678e42..3124374 100644 --- a/src/declarative/qml/qdeclarativeinclude_p.h +++ b/src/declarative/qml/qdeclarativeinclude_p.h @@ -88,7 +88,9 @@ public: static QScriptValue resultValue(QScriptEngine *, Status status = Loading); static void callback(QScriptEngine *, QScriptValue &callback, QScriptValue &status); + static QScriptValue include(QScriptContext *ctxt, QScriptEngine *engine); + static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine); public slots: void finished(); diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index c55998f..4b687a9 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -289,7 +289,11 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) QScriptValue activation = getWorker(id); - QScriptContext *ctxt = workerEngine->pushContext(); + QScriptContext *ctxt = QScriptDeclarativeClass::pushCleanContext(workerEngine); + QScriptValue urlContext = workerEngine->newObject(); + urlContext.setData(QScriptValue(workerEngine, fileName)); + ctxt->pushScope(urlContext); + ctxt->pushScope(activation); ctxt->setActivationObject(activation); workerEngine->baseUrl = url; -- cgit v0.12 From ef0a942bc57485ddaad413cd27c0283a1c90149f Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 14 May 2010 10:38:52 +0200 Subject: Updated changelog. --- dist/changes-4.7.0 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 6bf7ea5..919c25a 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -76,6 +76,18 @@ QtGui * Fixed rendering bugs when scrolling graphics items with drop shadows. + - QGraphicsItem + * [QTBUG-8112] itemChange() is now called when transformation + properties change (setRotation, setScale, setTransformOriginPoint). + + - QGraphicsTextItem + * [QTBUG-7333] Fixed keyboard shortcuts not being triggered when the + the item has focus and something else has the same shortcut sequence. + + - QGraphicsView + * [QTBUG-7438] Fixed viewport cursor getting reset when releasing + the mouse. + - QImage * [QTBUG-9640] Prevented unneccessary copy in QImage::setAlphaChannel(). -- cgit v0.12 From aeff7ca3bdc7d4c2518f6f27f69332935ff8b104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 14 May 2010 10:42:31 +0200 Subject: Some 4.7 changes. --- dist/changes-4.7.0 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 919c25a..47992f9 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -33,7 +33,6 @@ New features - QNetworkSession, QNetworkConfiguration, QNetworkConfigurationManager * New bearer management classes added. - Third party components ---------------------- @@ -89,11 +88,17 @@ QtGui the mouse. - QImage - * [QTBUG-9640] Prevented unneccessary copy in - QImage::setAlphaChannel(). - * Added QImage::bitPlaneCount(). (QTBUG-7982) + * [QTBUG-9640] Prevented unneccessary copy in QImage::setAlphaChannel(). + * [QTBUG-7982] Added QImage::bitPlaneCount(). + + - QPicture + * [QTBUG-4974] Printing QPictures containing text to a high resolution + QPrinter would in many cases cause incorrect character spacing. - QPainter + * Added QPainter::drawPixmapFragments(), which makes it possible to draw + pixmaps, or sub-rectangles of pixmaps, at various positions with + different scale, opacity and rotation. * [QTBUG-10018] Fixed image drawing inconsistencies when drawing 1x1 source rects with rotating / shear / perspective transforms. * Optimized various blending and rendering operations for ARM -- cgit v0.12 From 96bf7b880976f225ca390aab1cb1492e8d79ea4c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 14 May 2010 11:25:51 +0200 Subject: Updated WebKit to 5cf023650a8da206a8cf3130e9d4820b95e1bc7c Integrated changes: * Doc day API doc overhaul || || [Qt] GraphicsLayer: depth-test causes flicker in certain situations || || || [Qt] emit initialLayoutCompleted signal from FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout || || || [Qt] Detect debug mode consistently || || || [Qt] Update the Symbian version for the user agent || || || [Qt] Improve QtLauncher user agent dialog resize || || || Ignore invalid values for various CanvasRenderingContext2D properties || || || [Qt] tst_QWebPage::inputMethods failing on Maemo5 || || || [Qt] REGRESSION(r58497) tst_QGraphicsWebView::crashOnViewlessWebPages() is failing || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/ChangeLog | 9 + src/3rdparty/webkit/JavaScriptCore/ChangeLog | 12 ++ .../webkit/JavaScriptCore/JavaScriptCore.pri | 2 +- .../webkit/JavaScriptCore/JavaScriptCore.pro | 2 +- .../webkit/JavaScriptCore/qt/api/QtScript.pro | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 43 +++++ src/3rdparty/webkit/WebCore/WebCore.pro | 2 +- .../html/canvas/CanvasRenderingContext2D.cpp | 10 +- .../platform/graphics/qt/GraphicsLayerQt.cpp | 8 - src/3rdparty/webkit/WebKit.pri | 2 +- src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp | 10 +- src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 20 ++- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 10 +- .../webkit/WebKit/qt/Api/qwebhistoryinterface.cpp | 23 ++- .../webkit/WebKit/qt/Api/qwebinspector.cpp | 45 ++--- .../webkit/WebKit/qt/Api/qwebkitversion.cpp | 66 +++++++- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 184 +++++++++++++++++---- .../webkit/WebKit/qt/Api/qwebpluginfactory.cpp | 36 +++- .../webkit/WebKit/qt/Api/qwebsecurityorigin.cpp | 24 ++- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 128 +++++++------- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 99 +++++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 6 +- src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc | 109 ++++++------ .../qtwebkit_qwebinspector_snippet.cpp | 2 - .../qt/docs/webkitsnippets/webelement/main.cpp | 56 +++++++ .../qgraphicswebview/tst_qgraphicswebview.cpp | 8 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 23 ++- 30 files changed, 718 insertions(+), 229 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 14af7e9..9d754a4 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -5cf023650a8da206a8cf3130e9d4820b95e1bc7c +3d774b9df1f963452b1cfe34f9fafad0d399372a diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 70eff7d..a0cf2d0 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,12 @@ +2010-05-12 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Detect debug mode consistently + https://bugs.webkit.org/show_bug.cgi?id=38863 + + * WebKit.pri: + 2010-04-09 Simon Hausmann Unreviewed crash fix. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 1610036..a3e6586 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,15 @@ +2010-05-12 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Detect debug mode consistently + https://bugs.webkit.org/show_bug.cgi?id=38863 + + * JavaScriptCore.pri: + * JavaScriptCore.pro: + * jsc.pro: + * qt/api/QtScript.pro: + 2010-05-10 Laszlo Gombos Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index b7f6665..b3f74a9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -1,6 +1,6 @@ # JavaScriptCore - Qt4 build info VPATH += $$PWD -CONFIG(debug, debug|release) { +!CONFIG(release, debug|release) { # Output in JavaScriptCore/ JAVASCRIPTCORE_DESTDIR = debug # Use a config-specific target to prevent parallel builds file clashes on Mac diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index 8e086b3..22fcc91 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -21,7 +21,7 @@ CONFIG(QTDIR_build) { # This line was extracted from qbase.pri instead of including the whole file win32|mac:!macx-xcode:CONFIG += debug_and_release } else { - CONFIG(debug, debug|release) { + !CONFIG(release, debug|release) { OBJECTS_DIR = obj/debug } else { # Release OBJECTS_DIR = obj/release diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro b/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro index 88629c7..3c2691e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro +++ b/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro @@ -7,7 +7,7 @@ INCLUDEPATH += $$PWD CONFIG += building-libs isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../../generated -CONFIG(debug, debug|release) { +!CONFIG(release, debug|release) { OBJECTS_DIR = obj/debug } else { # Release OBJECTS_DIR = obj/release diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b8bac54..a440c03 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 57d10d5c05e59bbf7de8189ff47dd18d1be996dc + 5cf023650a8da206a8cf3130e9d4820b95e1bc7c diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 76b4eff..93d00e4 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,46 @@ +2010-05-12 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Detect debug mode consistently + https://bugs.webkit.org/show_bug.cgi?id=38863 + + No new tests as there is no new functionality. + + * WebCore.pro: + +2010-05-14 Andreas Kling + + Reviewed by Darin Adler. + + Ignore invalid values for various CanvasRenderingContext2D properties + (lineWidth, miterLimit, shadowOffsetX, shadowOffsetY and shadowBlur) + + https://bugs.webkit.org/show_bug.cgi?id=38841 + + Test: fast/canvas/canvas-invalid-values.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setLineWidth): + (WebCore::CanvasRenderingContext2D::setMiterLimit): + (WebCore::CanvasRenderingContext2D::setShadowOffsetX): + (WebCore::CanvasRenderingContext2D::setShadowOffsetY): + (WebCore::CanvasRenderingContext2D::setShadowBlur): + +2010-05-12 Noam Rosenthal + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsLayer: depth-test causes flicker in certain situations + + This patch removes the simplistic 2D depth test as it leads to flickering side effects. + https://bugs.webkit.org/show_bug.cgi?id=38370 + + Tested by http://webkit.org/blog-files/3d-transforms/morphing-cubes.html + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::updateTransform): + 2010-04-29 James Robinson Reviewed by Simon Fraser. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 254d17b..689c5ff 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -59,7 +59,7 @@ CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = generated isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../JavaScriptCore/generated - CONFIG(debug, debug|release) { + !CONFIG(release, debug|release) { OBJECTS_DIR = obj/debug } else { # Release OBJECTS_DIR = obj/release diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 8add19c..823ab59 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -209,7 +209,7 @@ float CanvasRenderingContext2D::lineWidth() const void CanvasRenderingContext2D::setLineWidth(float width) { - if (!(width > 0)) + if (!(isfinite(width) && width > 0)) return; state().m_lineWidth = width; GraphicsContext* c = drawingContext(); @@ -259,7 +259,7 @@ float CanvasRenderingContext2D::miterLimit() const void CanvasRenderingContext2D::setMiterLimit(float limit) { - if (!(limit > 0)) + if (!(isfinite(limit) && limit > 0)) return; state().m_miterLimit = limit; GraphicsContext* c = drawingContext(); @@ -275,6 +275,8 @@ float CanvasRenderingContext2D::shadowOffsetX() const void CanvasRenderingContext2D::setShadowOffsetX(float x) { + if (!isfinite(x)) + return; state().m_shadowOffset.setWidth(x); applyShadow(); } @@ -286,6 +288,8 @@ float CanvasRenderingContext2D::shadowOffsetY() const void CanvasRenderingContext2D::setShadowOffsetY(float y) { + if (!isfinite(y)) + return; state().m_shadowOffset.setHeight(y); applyShadow(); } @@ -297,6 +301,8 @@ float CanvasRenderingContext2D::shadowBlur() const void CanvasRenderingContext2D::setShadowBlur(float blur) { + if (!(isfinite(blur) && blur >= 0)) + return; state().m_shadowBlur = blur; applyShadow(); } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp index 1c4c275..d9394e1 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp @@ -357,14 +357,6 @@ void GraphicsLayerQtImpl::updateTransform() return; } - // Simplistic depth test - we stack the item behind its parent if its computed z is lower than the parent's computed z at the item's center point. - if (parent) { - const QPointF centerPointMappedToRoot = rootLayer()->mapFromItem(this, m_size.width() / 2, m_size.height() / 2); - setFlag(ItemStacksBehindParent, - m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z() < - parent->m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z()); - } - // The item is front-facing or backface-visibility is on. setVisible(true); diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index e737039..a3ccd9d 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -22,7 +22,7 @@ building-libs { QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH } else { win32-*|wince* { - CONFIG(debug, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d + !CONFIG(release, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}$${QT_MAJOR_VERSION} win32-g++: LIBS += -l$$QTWEBKITLIBNAME else: LIBS += $${QTWEBKITLIBNAME}.lib diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp index 4e8fd30..ba039c7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp @@ -39,8 +39,10 @@ using namespace WebCore; access on a local computer through JavaScript. QWebDatabase is the C++ interface to these databases. - To get access to all databases defined by a security origin, use QWebSecurityOrigin::databases(). - Each database has an internal name(), as well as a user-friendly name, provided by displayName(). + Databases are grouped together in security origins. To get access to all databases defined by + a security origin, use QWebSecurityOrigin::databases(). Each database has an internal name(), + as well as a user-friendly name, provided by displayName(). These names are specified when + creating the database in the JavaScript code. WebKit uses SQLite to create and access the local SQL databases. The location of the database file in the local file system is returned by fileName(). You can access the database directly @@ -49,7 +51,7 @@ using namespace WebCore; For each database the web site can define an expectedSize(). The current size of the database in bytes is returned by size(). - For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML 5 Draft Standard}. + For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML5 Web SQL Database Draft Standard}. \sa QWebSecurityOrigin */ @@ -80,7 +82,7 @@ QString QWebDatabase::name() const } /*! - Returns the name of the database as seen by the user. + Returns the name of the database in a format that is suitable for display to the user. */ QString QWebDatabase::displayName() const { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 955206d..69146a2 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -84,13 +84,27 @@ public: \snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement + Individual elements can be inspected or changed using methods such as attribute() + or setAttribute(). For examle, to capture the user's input in a text field for later + use (auto-completion), a browser could do something like this: + + \snippet webkitsnippets/webelement/main.cpp autocomplete1 + + When the same page is later revisited, the browser can fill in the text field automatically + by modifying the value attribute of the input element: + + \snippet webkitsnippets/webelement/main.cpp autocomplete2 + + Another use case is to emulate a click event on an element. The following + code snippet demonstrates how to call the JavaScript DOM method click() of + a submit button: + + \snippet webkitsnippets/webelement/main.cpp Calling a DOM element method + The underlying content of QWebElement is explicitly shared. Creating a copy of a QWebElement does not create a copy of the content. Instead, both instances point to the same element. - The element's attributes can be read using attribute() and modified with - setAttribute(). - The contents of child elements can be converted to plain text with toPlainText(); to XHTML using toInnerXml(). To include the element's tag in the output, use toOuterXml(). diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 394ea17..44cc3b5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -552,8 +552,10 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame: can connect to the web page's \l{QWebPage::}{frameCreated()} signal to be notified when a new frame is created. - The hitTestContent() function can be used to programmatically examine the - contents of a frame. + There are multiple ways to programmatically examine the contents of a frame. + The hitTestContent() function can be used to find elements by coordinate. + For access to the underlying DOM tree, there is documentElement(), + findAllElements() and findFirstElement(). A QWebFrame can be printed onto a QPrinter using the print() function. This function is marked as a slot and can be conveniently connected to @@ -781,6 +783,10 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url) \property QWebFrame::url \brief the url of the frame currently viewed + Setting this property clears the view and loads the URL. + + By default, this property contains an empty, invalid URL. + \sa urlChanged() */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp index 80567d1..61cf5af 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp @@ -41,7 +41,7 @@ static void gCleanupInterface() /*! Sets a new default interface, \a defaultInterface, that will be used by all of WebKit - for managing history. + to keep track of visited links. If an interface without a parent has already been set, the old interface will be deleted. When the application exists QWebHistoryInterface will automatically delete the @@ -68,8 +68,9 @@ void QWebHistoryInterface::setDefaultInterface(QWebHistoryInterface* defaultInte } /*! - Returns the default interface that will be used by WebKit. If no - default interface has been set, QtWebkit will not track history. + Returns the default interface that will be used by WebKit. If no default interface has been set, + Webkit will not keep track of visited links and a null pointer will be returned. + \sa setDefaultInterface */ QWebHistoryInterface* QWebHistoryInterface::defaultInterface() { @@ -84,11 +85,15 @@ QWebHistoryInterface* QWebHistoryInterface::defaultInterface() \inmodule QtWebKit The QWebHistoryInterface is an interface that can be used to - implement link history. It contains two pure virtual methods that - are called by the WebKit engine. addHistoryEntry() is used to add - pages that have been visited to the interface, while - historyContains() is used to query whether this page has been - visited by the user. + keep track of visited links. It contains two pure virtual methods that + are called by the WebKit engine: addHistoryEntry() is used to add + urls that have been visited to the interface, while + historyContains() is used to query whether the given url has been + visited by the user. By default the QWebHistoryInterface is not set, so WebKit does not keep + track of visited links. + + \note The history tracked by QWebHistoryInterface is not specific to an instance of QWebPage + but applies to all pages. */ /*! @@ -100,7 +105,7 @@ QWebHistoryInterface::QWebHistoryInterface(QObject* parent) } /*! - Destructor. If this is currently the default interface it will be unset. + Destroys the interface. If this is currently the default interface it will be unset. */ QWebHistoryInterface::~QWebHistoryInterface() { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index c0e5277..802ea98 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -31,17 +31,23 @@ /*! \class QWebInspector \since 4.6 + \inmodule QtWebKit \brief The QWebInspector class allows the placement and control of a QWebPage's inspector. - The inspector allows you to see a page current hierarchy and loading - statistics. + The inspector can display a page's hierarchy, its loading statistics and + the current state of its individual elements. It is mostly used by web + developers. - The QWebPage to be inspected is determined with the setPage() method. + The QWebPage to be inspected must be specified using the setPage() method. A typical use of QWebInspector follows: \snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0 + A QWebInspector can be made visible either programmatically using + setVisible(), or by the user through the attached QWebPage's context + menu. + \note A QWebInspector will display a blank widget if either: \list \o page() is null @@ -61,17 +67,16 @@ \section1 Inspector configuration persistence The inspector allows the user to configure some options through its - interface (e.g. the resource tracking "Always enable" option). - These settings are persisted automatically by QtWebKit using QSettings. - - However since the QSettings object is instantiated using the empty - constructor, QCoreApplication::setOrganizationName() and - QCoreApplication::setApplicationName() must be called within your - application to enable the persistence of these options. + user interface (e.g. the resource tracking "Always enable" option). + These settings will be persisted automatically by QtWebKit only if + your application previously called QCoreApplication::setOrganizationName() + and QCoreApplication::setApplicationName(). + See QSettings's default constructor documentation for an explanation + of why this is necessary. */ /*! - Constructs an empty QWebInspector with parent \a parent. + Constructs an unbound QWebInspector with \a parent as its parent. */ QWebInspector::QWebInspector(QWidget* parent) : QWidget(parent) @@ -89,16 +94,16 @@ QWebInspector::~QWebInspector() } /*! - Sets the QWebPage to be inspected. - - There can only be one QWebInspector associated with a QWebPage - and vices versa. + Bind this inspector to the QWebPage to be inspected. - Calling with \a page as null will break the current association, if any. - - If \a page is already associated to another QWebInspector, the association - will be replaced and the previous QWebInspector will have no page - associated. + \bold {Notes:} + \list + \o There can only be one QWebInspector associated with a QWebPage + and vice versa. + \o Calling this method with a null \a page will break the current association, if any. + \o If \a page is already associated to another QWebInspector, the association + will be replaced and the previous QWebInspector will become unbound + \endlist \sa page() */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp index 062839f..181913b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp @@ -22,11 +22,21 @@ #include /*! - + \relates QWebPage + \since 4.6 Returns the version number of WebKit at run-time as a string (for - example, "531.3"). This is the version of WebKit the application - was compiled against. + example, "531.3"). + + This version is commonly used in WebKit based browsers as part + of the user agent string. Web servers and JavaScript might use + it to identify the presence of certain WebKit engine features + and behaviour. + The evolution of this version is bound to the releases of Apple's + Safari browser. For a version specific to the QtWebKit library, + see QTWEBKIT_VERSION + + \sa QWebPage::userAgentForUrl() */ QString qWebKitVersion() { @@ -34,11 +44,13 @@ QString qWebKitVersion() } /*! - + \relates QWebPage + \since 4.6 Returns the 'major' version number of WebKit at run-time as an integer (for example, 531). This is the version of WebKit the application was compiled against. + \sa qWebKitVersion() */ int qWebKitMajorVersion() { @@ -46,13 +58,57 @@ int qWebKitMajorVersion() } /*! - + \relates QWebPage + \since 4.6 Returns the 'minor' version number of WebKit at run-time as an integer (for example, 3). This is the version of WebKit the application was compiled against. + \sa qWebKitVersion() */ int qWebKitMinorVersion() { return WEBKIT_MINOR_VERSION; } + +/*! + \macro QTWEBKIT_VERSION + \relates QWebPage + + This macro expands a numeric value of the form 0xMMNNPP (MM = + major, NN = minor, PP = patch) that specifies QtWebKit's version + number. For example, if you compile your application against QtWebKit + 2.1.2, the QTWEBKIT_VERSION macro will expand to 0x020102. + + You can use QTWEBKIT_VERSION to use the latest QtWebKit API where + available. + + \sa QT_VERSION +*/ + +/*! + \macro QTWEBKIT_VERSION_STR + \relates QWebPage + + This macro expands to a string that specifies QtWebKit's version number + (for example, "2.1.2"). This is the version against which the + application is compiled. + + \sa QTWEBKIT_VERSION +*/ + +/*! + \macro QTWEBKIT_VERSION_CHECK + \relates QWebPage + + 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, for example + in a preprocessor statement: + + \code + #if QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 1, 0) + // code to use API new in QtWebKit 2.1.0 + #endif + \endcode +*/ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index e9ebce5..c5f508f 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -1627,7 +1627,7 @@ InspectorController* QWebPagePrivate::inspectorController() /*! \enum QWebPage::FindFlag - This enum describes the options available to QWebPage's findText() function. The options + This enum describes the options available to the findText() function. The options can be OR-ed together from the following list: \value FindBackward Searches backwards instead of forwards. @@ -1648,6 +1648,8 @@ InspectorController* QWebPagePrivate::inspectorController() \value DelegateExternalLinks When activating links that point to documents not stored on the local filesystem or an equivalent - such as the Qt resource system - then linkClicked() is emitted. \value DelegateAllLinks Whenever a link is activated the linkClicked() signal is emitted. + + \sa QWebPage::linkDelegationPolicy */ /*! @@ -1662,6 +1664,8 @@ InspectorController* QWebPagePrivate::inspectorController() \value NavigationTypeReload The user activated the reload action. \value NavigationTypeFormResubmitted An HTML form was submitted a second time. \value NavigationTypeOther A navigation to another document using a method not listed above. + + \sa acceptNavigationRequest() */ /*! @@ -1671,7 +1675,7 @@ InspectorController* QWebPagePrivate::inspectorController() Actions only have an effect when they are applicable. The availability of actions can be be determined by checking \l{QAction::}{isEnabled()} on the - action returned by \l{QWebPage::}{action()}. + action returned by action(). One method of enabling the text editing, cursor movement, and text selection actions is by setting \l contentEditable to true. @@ -1753,6 +1757,8 @@ InspectorController* QWebPagePrivate::inspectorController() /*! \enum QWebPage::WebWindowType + This enum describes the types of window that can be created by the createWindow() function. + \value WebBrowserWindow The window is a regular web browser window. \value WebModalDialog The window acts as modal dialog. */ @@ -1769,11 +1775,13 @@ InspectorController* QWebPagePrivate::inspectorController() to provide functionality like QWebView in a widget-less environment. QWebPage's API is very similar to QWebView, as you are still provided with - common functions like action() (known as \l{QWebView::}{pageAction()} in - QWebView), triggerAction(), findText() and settings(). More QWebView-like - functions can be found in the main frame of QWebPage, obtained via - QWebPage::mainFrame(). For example, the load(), setUrl() and setHtml() - unctions for QWebPage can be accessed using QWebFrame. + common functions like action() (known as + \l{QWebView::pageAction()}{pageAction}() in QWebView), triggerAction(), + findText() and settings(). More QWebView-like functions can be found in the + main frame of QWebPage, obtained via the mainFrame() function. For example, + the \l{QWebFrame::load()}{load}(), \l{QWebFrame::setUrl()}{setUrl}() and + \l{QWebFrame::setHtml()}{setHtml}() functions for QWebPage can be accessed + using QWebFrame. The loadStarted() signal is emitted when the page begins to load.The loadProgress() signal, on the other hand, is emitted whenever an element @@ -1877,7 +1885,8 @@ QWebFrame *QWebPage::currentFrame() const /*! \since 4.6 - Returns the frame at the given point \a pos. + Returns the frame at the given point \a pos, or 0 if there is no frame at + that position. \sa mainFrame(), currentFrame() */ @@ -1996,7 +2005,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) result should be written to \a result and true should be returned. If the prompt was not cancelled by the user, the implementation should return true and the result string must not be null. - The default implementation uses QInputDialog::getText. + The default implementation uses QInputDialog::getText(). */ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result) { @@ -2210,6 +2219,8 @@ QSize QWebPage::viewportSize() const By default, for a newly-created Web page, this property contains a size with zero width and height. + + \sa QWebFrame::render(), preferredContentsSize */ void QWebPage::setViewportSize(const QSize &size) const { @@ -2238,11 +2249,12 @@ QSize QWebPage::preferredContentsSize() const /*! \property QWebPage::preferredContentsSize \since 4.6 - \brief the size of the fixed layout + \brief the preferred size of the contents - The size affects the layout of the page in the viewport. If set to a fixed size of - 1024x768 for example then webkit will layout the page as if the viewport were that size - rather than something different. + If this property is set to a valid size, it is used to lay out the page. + If it is not set (the default), the viewport size is used instead. + + \sa viewportSize */ void QWebPage::setPreferredContentsSize(const QSize &size) const { @@ -2590,9 +2602,11 @@ QAction *QWebPage::action(WebAction action) const /*! \property QWebPage::modified - \brief whether the page contains unsubmitted form data + \brief whether the page contains unsubmitted form data, or the contents have been changed. By default, this property is false. + + \sa contentsChanged(), contentEditable, undoStack() */ bool QWebPage::isModified() const { @@ -2608,6 +2622,8 @@ bool QWebPage::isModified() const #ifndef QT_NO_UNDOSTACK /*! Returns a pointer to the undo stack used for editable content. + + \sa modified */ QUndoStack *QWebPage::undoStack() const { @@ -2730,7 +2746,7 @@ bool QWebPage::event(QEvent *ev) } /*! - Similar to QWidget::focusNextPrevChild it focuses the next focusable web element + Similar to QWidget::focusNextPrevChild() it focuses the next focusable web element if \a next is true; otherwise the previous element is focused. Returns true if it can find a new focusable element, or false if it can't. @@ -2757,6 +2773,8 @@ bool QWebPage::focusNextPrevChild(bool next) If this property is enabled the contents of the page can be edited by the user through a visible cursor. If disabled (the default) only HTML elements in the web page with their \c{contenteditable} attribute set are editable. + + \sa modified, contentsChanged(), WebAction */ void QWebPage::setContentEditable(bool editable) { @@ -2926,17 +2944,21 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) as a result of the user clicking on a "file upload" button in a HTML form where multiple file selection is allowed. - \omitvalue ErrorPageExtension (introduced in Qt 4.6) + \value ErrorPageExtension Whether the web page can provide an error page when loading fails. + (introduced in Qt 4.6) + + \sa ChooseMultipleFilesExtensionOption, ChooseMultipleFilesExtensionReturn, ErrorPageExtensionOption, ErrorPageExtensionReturn */ /*! \enum QWebPage::ErrorDomain \since 4.6 - \internal - \value QtNetwork - \value Http - \value WebKit + This enum describes the domain of an ErrorPageExtensionOption object (i.e. the layer in which the error occurred). + + \value QtNetwork The error occurred in the QtNetwork layer; the error code is of type QNetworkReply::NetworkError. + \value Http The error occurred in the HTTP layer; the error code is a HTTP status code (see QNetworkRequest::HttpStatusCodeAttribute). + \value WebKit The error is an internal WebKit error. */ /*! @@ -2946,7 +2968,18 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \inmodule QtWebKit - \sa QWebPage::extension() + \sa QWebPage::extension() QWebPage::ExtensionReturn +*/ + + +/*! + \class QWebPage::ExtensionReturn + \since 4.4 + \brief The ExtensionReturn class provides an output result from a QWebPage's extension. + + \inmodule QtWebKit + + \sa QWebPage::extension() QWebPage::ExtensionOption */ /*! @@ -2957,12 +2990,38 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \inmodule QtWebKit - The ErrorPageExtensionOption class holds the \a url for which an error occoured as well as + The ErrorPageExtensionOption class holds the \a url for which an error occurred as well as the associated \a frame. The error itself is reported by an error \a domain, the \a error code as well as \a errorString. - \sa QWebPage::ErrorPageExtensionReturn + \sa QWebPage::extension() QWebPage::ErrorPageExtensionReturn +*/ + +/*! + \variable QWebPage::ErrorPageExtensionOption::url + \brief the url for which an error occurred +*/ + +/*! + \variable QWebPage::ErrorPageExtensionOption::frame + \brief the frame associated with the error +*/ + +/*! + \variable QWebPage::ErrorPageExtensionOption::domain + \brief the domain that reported the error +*/ + +/*! + \variable QWebPage::ErrorPageExtensionOption::error + \brief the error code. Interpretation of the value depends on the \a domain + \sa QWebPage::ErrorDomain +*/ + +/*! + \variable QWebPage::ErrorPageExtensionOption::errorString + \brief a string that describes the error */ /*! @@ -2983,7 +3042,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) External objects such as stylesheets or images referenced in the HTML are located relative to \a baseUrl. - \sa QWebPage::ErrorPageExtensionOption, QString::toUtf8() + \sa QWebPage::extension() QWebPage::ErrorPageExtensionOption, QString::toUtf8() */ /*! @@ -2992,6 +3051,29 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) Constructs a new error page object. */ + +/*! + \variable QWebPage::ErrorPageExtensionReturn::contentType + \brief the error page's content type +*/ + +/*! + \variable QWebPage::ErrorPageExtensionReturn::encoding + \brief the error page encoding +*/ + +/*! + \variable QWebPage::ErrorPageExtensionReturn::baseUrl + \brief the base url + + External objects such as stylesheets or images referenced in the HTML are located relative to this url. +*/ + +/*! + \variable QWebPage::ErrorPageExtensionReturn::content + \brief the HTML content of the error page +*/ + /*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 @@ -3003,7 +3085,22 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) The ChooseMultipleFilesExtensionOption class holds the frame originating the request and the suggested filenames which might be provided. - \sa QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn + \sa QWebPage::extension() QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn +*/ + +/*! + \variable QWebPage::ChooseMultipleFilesExtensionOption::parentFrame + \brief The frame in which the request originated +*/ + +/*! + \variable QWebPage::ChooseMultipleFilesExtensionOption::suggestedFileNames + \brief The suggested filenames +*/ + +/*! + \variable QWebPage::ChooseMultipleFilesExtensionReturn::fileNames + \brief The selected filenames */ /*! @@ -3017,14 +3114,17 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) The ChooseMultipleFilesExtensionReturn class holds the filenames selected by the user when the extension is invoked. - \sa QWebPage::ChooseMultipleFilesExtensionOption + \sa QWebPage::extension() QWebPage::ChooseMultipleFilesExtensionOption */ /*! This virtual function can be reimplemented in a QWebPage subclass to provide support for extensions. The \a option argument is provided as input to the extension; the output results can be stored in \a output. - The behavior of this function is determined by \a extension. + The behavior of this function is determined by \a extension. The \a option + and \a output values are typically casted to the corresponding types (for + example, ChooseMultipleFilesExtensionOption and + ChooseMultipleFilesExtensionReturn for ChooseMultipleFilesExtension). You can call supportsExtension() to check if an extension is supported by the page. @@ -3116,6 +3216,8 @@ QWebSettings *QWebPage::settings() const A suggested filename may be provided in \a suggestedFile. The frame originating the request is provided as \a parentFrame. + + \sa ChooseMultipleFilesExtension */ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFile) { @@ -3369,6 +3471,15 @@ QString QWebPage::userAgentForUrl(const QUrl&) const case QSysInfo::SV_9_4: firstPartTemp += QString::fromLatin1("/9.4"); break; + case QSysInfo::SV_SF_2: + firstPartTemp += QString::fromLatin1("^2"); + break; + case QSysInfo::SV_SF_3: + firstPartTemp += QString::fromLatin1("^3"); + break; + case QSysInfo::SV_SF_4: + firstPartTemp += QString::fromLatin1("^4"); + break; default: firstPartTemp += QString::fromLatin1("/Unknown"); } @@ -3479,7 +3590,7 @@ quint64 QWebPage::totalBytes() const /*! Returns the number of bytes that were received from the network to render the current page. - \sa totalBytes() + \sa totalBytes(), loadProgress() */ quint64 QWebPage::bytesReceived() const { @@ -3511,7 +3622,7 @@ quint64 QWebPage::bytesReceived() const This signal is emitted when a load of the page is finished. \a ok will indicate whether the load was successful or any error occurred. - \sa loadStarted() + \sa loadStarted(), ErrorPageExtension */ /*! @@ -3538,12 +3649,15 @@ quint64 QWebPage::bytesReceived() const \fn void QWebPage::frameCreated(QWebFrame *frame) This signal is emitted whenever the page creates a new \a frame. + + \sa currentFrame() */ /*! \fn void QWebPage::selectionChanged() - This signal is emitted whenever the selection changes. + This signal is emitted whenever the selection changes, either interactively + or programmatically (e.g. by calling triggerAction() with a selection action). \sa selectedText() */ @@ -3555,7 +3669,7 @@ quint64 QWebPage::bytesReceived() const This signal is emitted whenever the text in form elements changes as well as other editable content. - \sa contentEditable, QWebFrame::toHtml(), QWebFrame::toPlainText() + \sa contentEditable, modified, QWebFrame::toHtml(), QWebFrame::toPlainText() */ /*! @@ -3631,9 +3745,9 @@ quint64 QWebPage::bytesReceived() const \fn void QWebPage::microFocusChanged() This signal is emitted when for example the position of the cursor in an editable form - element changes. It is used inform input methods about the new on-screen position where - the user is able to enter text. This signal is usually connected to QWidget's updateMicroFocus() - slot. + element changes. It is used to inform input methods about the new on-screen position where + the user is able to enter text. This signal is usually connected to the + QWidget::updateMicroFocus() slot. */ /*! @@ -3674,6 +3788,8 @@ quint64 QWebPage::bytesReceived() const This signal is emitted whenever the web site shown in \a frame is asking to store data to the database \a databaseName and the quota allocated to that web site is exceeded. + + \sa QWebDatabase */ /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp index 8ff13b1..f715430 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp @@ -23,25 +23,40 @@ /*! \class QWebPluginFactory \since 4.4 - \brief The QWebPluginFactory class creates plugins to be embedded into web - pages. + \brief The QWebPluginFactory class is used to embed custom data types in web pages. \inmodule QtWebKit - QWebPluginFactory is a factory for creating plugins for QWebPage. A plugin - factory can be installed on a QWebPage using QWebPage::setPluginFactory(). + The HTML \c{} tag is used to embed arbitrary content into a web page, + for example: + + \code + + \endcode + + QtWebkit will natively handle the most basic data types like \c{text/html} and + \c{image/jpeg}, but for any advanced or custom data types you will need to + provide a handler yourself. + + QWebPluginFactory is a factory for creating plugins for QWebPage, where each + plugin provides support for one or more data types. A plugin factory can be + installed on a QWebPage using QWebPage::setPluginFactory(). \note The plugin factory is only used if plugins are enabled through QWebSettings. - You can provide a QWebPluginFactory by implementing the plugins() and the - create() method. For plugins() it is necessary to describe the plugins the + You provide a QWebPluginFactory by implementing the plugins() and the + create() methods. For plugins() it is necessary to describe the plugins the factory can create, including a description and the supported MIME types. The MIME types each plugin can handle should match the ones specified in - in the HTML \c{} tag. + in the HTML \c{} tag of your content. The create() method is called if the requested MIME type is supported. The implementation has to return a new instance of the plugin requested for the given MIME type and the specified URL. + + The plugins themselves are subclasses of QObject, but currently only plugins + based on either QWidget or QGraphicsWidget are supported. + */ @@ -183,6 +198,7 @@ void QWebPluginFactory::refreshPlugins() /*! \enum QWebPluginFactory::Extension + \internal This enum describes the types of extensions that the plugin factory can support. Before using these extensions, you should verify that the extension is supported by calling supportsExtension(). @@ -192,6 +208,7 @@ void QWebPluginFactory::refreshPlugins() /*! \class QWebPluginFactory::ExtensionOption + \internal \since 4.4 \brief The ExtensionOption class provides an extended input argument to QWebPluginFactory's extension support. @@ -202,6 +219,7 @@ void QWebPluginFactory::refreshPlugins() /*! \class QWebPluginFactory::ExtensionReturn + \internal \since 4.4 \brief The ExtensionOption class provides an extended output argument to QWebPluginFactory's extension support. @@ -214,6 +232,8 @@ void QWebPluginFactory::refreshPlugins() This virtual function can be reimplemented in a QWebPluginFactory subclass to provide support for extensions. The \a option argument is provided as input to the extension; the output results can be stored in \a output. + \internal + The behaviour of this function is determined by \a extension. You can call supportsExtension() to check if an extension is supported by the factory. @@ -233,6 +253,8 @@ bool QWebPluginFactory::extension(Extension extension, const ExtensionOption *op /*! This virtual function returns true if the plugin factory supports \a extension; otherwise false is returned. + \internal + \sa extension() */ bool QWebPluginFactory::supportsExtension(Extension extension) const diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp index 6c26bd7..7179eaa 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -63,6 +63,16 @@ void QWEBKIT_EXPORT qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidd \c{http://www.malicious.com/evil.html} from accessing \c{http://www.example.com/}'s resources, because they are of a different security origin. + By default local schemes like \c{file://} and \c{qrc://} are concidered to be in the same + security origin, and can access each other's resources. You can add additional local schemes + by using QWebSecurityOrigin::addLocalScheme(), or override the default same-origin behavior + by setting QWebSettings::LocalContentCanAccessFileUrls to \c{false}. + + \note Local resources are by default restricted from accessing remote content, which + means your \c{file://} will not be able to access \c{http://domain.com/foo.html}. You + can relax this restriction by setting QWebSettings::LocalContentCanAccessRemoteUrls to + \c{true}. + Call QWebFrame::securityOrigin() to get the QWebSecurityOrigin for a frame in a web page, and use host(), scheme() and port() to identify the security origin. @@ -219,7 +229,11 @@ QList QWebSecurityOrigin::databases() const \since 4.6 Adds the given \a scheme to the list of schemes that are considered equivalent - to the \c file: scheme. They are not subject to cross domain restrictions. + to the \c file: scheme. + + Cross domain restrictions depend on the two web settings QWebSettings::LocalContentCanAccessFileUrls + and QWebSettings::LocalContentCanAccessFileUrls. By default all local schemes are concidered to be + in the same security origin, and local schemes can not access remote content. */ void QWebSecurityOrigin::addLocalScheme(const QString& scheme) { @@ -231,6 +245,9 @@ void QWebSecurityOrigin::addLocalScheme(const QString& scheme) Removes the given \a scheme from the list of local schemes. + \note You can not remove the \c{file://} scheme from the list + of local schemes. + \sa addLocalScheme() */ void QWebSecurityOrigin::removeLocalScheme(const QString& scheme) @@ -240,7 +257,10 @@ void QWebSecurityOrigin::removeLocalScheme(const QString& scheme) /*! \since 4.6 - Returns a list of all the schemes that were set by the application as local schemes, + Returns a list of all the schemes concidered to be local. + + By default this is \c{file://} and \c{qrc://}. + \sa addLocalScheme(), removeLocalScheme() */ QStringList QWebSecurityOrigin::localSchemes() diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index ae7f6a8..115f9fc 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -289,8 +289,8 @@ QWebSettings* QWebSettings::globalSettings() function. The \l{QWebSettings::WebAttribute}{WebAttribute} enum further describes each attribute. - QWebSettings also configures global properties such as the Web page memory - cache and the Web page icon database, local database storage and offline + QWebSettings also configures global properties such as the web page memory + cache, icon database, local database storage and offline applications storage. \section1 Enabling Plugins @@ -299,8 +299,8 @@ QWebSettings* QWebSettings::globalSettings() \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications, this attribute is enabled for all pages by setting it on the \l{globalSettings()}{global settings object}. QtWebKit will always ignore this setting - \when processing Qt plugins. The decision to allow a Qt plugin is made by the client - \in its reimplementation of QWebPage::createPlugin. + when processing Qt plugins. The decision to allow a Qt plugin is made by the client + in its reimplementation of QWebPage::createPlugin(). \section1 Web Application Support @@ -339,7 +339,7 @@ QWebSettings* QWebSettings::globalSettings() \value MinimumFontSize The hard minimum font size. \value MinimumLogicalFontSize The minimum logical font size that is applied - after zooming with QWebFrame's textSizeMultiplier(). + when zooming out with QWebFrame::setTextSizeMultiplier(). \value DefaultFontSize The default font size for regular text. \value DefaultFixedFontSize The default font size for fixed-pitch text. */ @@ -361,66 +361,74 @@ QWebSettings* QWebSettings::globalSettings() This enum describes various attributes that are configurable through QWebSettings. \value AutoLoadImages Specifies whether images are automatically loaded in - web pages. + web pages. This is enabled by default. \value DnsPrefetchEnabled Specifies whether QtWebkit will try to pre-fetch DNS entries to - speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later. + speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later. This is disabled by default. \value JavascriptEnabled Enables or disables the running of JavaScript - programs. + programs. This is enabled by default \value JavaEnabled Enables or disables Java applets. Currently Java applets are not supported. - \value PluginsEnabled Enables or disables plugins in Web pages. Qt plugins - with a mimetype such as "application/x-qt-plugin" are not affected by this setting. + \value PluginsEnabled Enables or disables plugins in Web pages (e.g. using NPAPI). Qt plugins + with a mimetype such as "application/x-qt-plugin" are not affected by this setting. This is disabled by default. \value PrivateBrowsingEnabled Private browsing prevents WebKit from - recording visited pages in the history and storing web page icons. + recording visited pages in the history and storing web page icons. This is disabled by default. \value JavascriptCanOpenWindows Specifies whether JavaScript programs - can open new windows. + can open new windows. This is disabled by default. \value JavascriptCanAccessClipboard Specifies whether JavaScript programs - can read or write to the clipboard. + can read or write to the clipboard. This is disabled by default. \value DeveloperExtrasEnabled Enables extra tools for Web developers. Currently this enables the "Inspect" element in the context menu as - well as the use of QWebInspector which controls the WebKit WebInspector - for web site debugging. + well as the use of QWebInspector which controls the web inspector + for web site debugging. This is disabled by default. \value SpatialNavigationEnabled Enables or disables the Spatial Navigation feature, which consists in the ability to navigate between focusable elements in a Web page, such as hyperlinks and form controls, by using - Left, Right, Up and Down arrow keys. For example, if an user presses the + Left, Right, Up and Down arrow keys. For example, if a user presses the Right key, heuristics determine whether there is an element he might be - trying to reach towards the right, and if there are multiple elements, - which element he probably wants. + trying to reach towards the right and which element he probably wants. + This is disabled by default. \value LinksIncludedInFocusChain Specifies whether hyperlinks should be - included in the keyboard focus chain. - \value ZoomTextOnly Specifies whether the zoom factor on a frame applies to - only the text or all content. + included in the keyboard focus chain. This is enabled by default. + \value ZoomTextOnly Specifies whether the zoom factor on a frame applies + only to the text or to all content. This is disabled by default. \value PrintElementBackgrounds Specifies whether the background color and images - are also drawn when the page is printed. + are also drawn when the page is printed. This is enabled by default. \value OfflineStorageDatabaseEnabled Specifies whether support for the HTML 5 - offline storage feature is enabled or not. Disabled by default. + offline storage feature is enabled or not. This is disabled by default. \value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5 - web application cache feature is enabled or not. Disabled by default. + web application cache feature is enabled or not. This is disabled by default. \value LocalStorageEnabled Specifies whether support for the HTML 5 - local storage feature is enabled or not. Disabled by default. + local storage feature is enabled or not. This is disabled by default. \value LocalStorageDatabaseEnabled \e{This enum value is deprecated.} Use QWebSettings::LocalStorageEnabled instead. - \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls. - \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls. - \value XSSAuditorEnabled Specifies whether load requests should be monitored for cross-site scripting attempts. + \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are + allowed to access remote urls. This is disabled by default. For more information + about security origins and local vs. remote content see QWebSecurityOrigin. + \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are + allowed to access other local urls. This is enabled by default. For more information + about security origins and local vs. remote content see QWebSecurityOrigin. + \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site + scripting attempts. Suspicious scripts will be blocked and reported in the inspector's + JavaScript console. Enabling this feature might have an impact on performance + and it is disabled by default. \value AcceleratedCompositingEnabled This feature, when used in conjunction with QGraphicsWebView, accelerates animations of web content. CSS animations of the transform and opacity properties will be rendered by composing the cached content of the animated elements. - This feature is enabled by default + This is enabled by default. \value TiledBackingStoreEnabled This setting enables the tiled backing store feature for a QGraphicsWebView. With the tiled backing store enabled, the web page contents in and around the current visible area is speculatively cached to bitmap tiles. The tiles are automatically kept in sync with the web page as it changes. Enabling tiling can significantly speed up painting heavy operations like scrolling. Enabling the feature increases memory consumption. It does not work well with contents using CSS fixed positioning (see also \l{QGraphicsWebView::}{resizesToContents} property). - \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily freeze the contents of the backing store. + \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily + freeze the contents of the backing store. This is disabled by default. \value FrameFlatteningEnabled With this setting each subframe is expanded to its contents. On touch devices, it is desired to not have any scrollable sub parts of the page as it results in a confusing user experience, with scrolling sometimes scrolling sub parts and at other times scrolling the page itself. For this reason iframes and framesets are barely usable on touch devices. This will flatten all the frames to become one scrollable page. - Disabled by default. + This is disabled by default. */ /*! @@ -525,7 +533,8 @@ void QWebSettings::resetFontSize(FontSize type) with UTF-8 and Base64 encoded data, such as: "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==" - NOTE: In case the base 64 data is not valid the style will not be applied. + + \note If the base64 data is not valid, the style will not be applied. \sa userStyleSheetUrl() */ @@ -576,9 +585,11 @@ QString QWebSettings::defaultTextEncoding() const Sets the path of the icon database to \a path. The icon database is used to store "favicons" associated with web sites. - \a path must point to an existing directory where the icons are stored. + \a path must point to an existing directory. Setting an empty path disables the icon database. + + \sa iconDatabasePath(), clearIconDatabase() */ void QWebSettings::setIconDatabasePath(const QString& path) { @@ -621,7 +632,7 @@ void QWebSettings::clearIconDatabase() /*! Returns the web site's icon for \a url. - If the web site does not specify an icon, or the icon is not in the + If the web site does not specify an icon \bold OR if the icon is not in the database, a null QIcon is returned. \note The returned icon's size is arbitrary. @@ -658,7 +669,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase() Sets \a graphic to be drawn when QtWebKit needs to draw an image of the given \a type. - For example, when an image cannot be loaded the pixmap specified by + For example, when an image cannot be loaded, the pixmap specified by \l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead. \sa webGraphic() @@ -676,9 +687,6 @@ void QWebSettings::setWebGraphic(WebGraphic type, const QPixmap& graphic) Returns a previously set pixmap used to draw replacement graphics of the specified \a type. - For example, when an image cannot be loaded the pixmap specified by - \l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead. - \sa setWebGraphic() */ QPixmap QWebSettings::webGraphic(WebGraphic type) @@ -719,8 +727,7 @@ void QWebSettings::clearMemoryCaches() Sets the maximum number of pages to hold in the memory page cache to \a pages. The Page Cache allows for a nicer user experience when navigating forth or back - to pages in the forward/back history, by pausing and resuming up to \a pages - per page group. + to pages in the forward/back history, by pausing and resuming up to \a pages. For more information about the feature, please refer to: @@ -792,8 +799,8 @@ QString QWebSettings::fontFamily(FontFamily which) const } /*! - Resets the actual font family to the default font family, specified by - \a which. + Resets the actual font family specified by \a which to the one set + in the global QWebSettings instance. This function has no effect on the global QWebSettings instance. */ @@ -835,7 +842,9 @@ bool QWebSettings::testAttribute(WebAttribute attr) const /*! \fn void QWebSettings::resetAttribute(WebAttribute attribute) - Resets the setting of \a attribute. + Resets the setting of \a attribute to the value specified in the + global QWebSettings instance. + This function has no effect on the global QWebSettings instance. \sa globalSettings() @@ -851,12 +860,15 @@ void QWebSettings::resetAttribute(WebAttribute attr) /*! \since 4.5 - Sets the path for HTML5 offline storage to \a path. + Sets \a path as the save location for HTML5 client-side database storage data. - \a path must point to an existing directory where the databases are stored. + \a path must point to an existing directory. Setting an empty path disables the feature. + Support for client-side databases can enabled by setting the + \l{QWebSettings::OfflineStorageDatabaseEnabled}{OfflineStorageDatabaseEnabled} attribute. + \sa offlineStoragePath() */ void QWebSettings::setOfflineStoragePath(const QString& path) @@ -869,7 +881,7 @@ void QWebSettings::setOfflineStoragePath(const QString& path) /*! \since 4.5 - Returns the path of the HTML5 offline storage or an empty string if the + Returns the path of the HTML5 client-side database storage or an empty string if the feature is disabled. \sa setOfflineStoragePath() @@ -906,22 +918,24 @@ qint64 QWebSettings::offlineStorageDefaultQuota() /*! \since 4.6 - \relates QWebSettings Sets the path for HTML5 offline web application cache storage to \a path. An application cache acts like an HTTP cache in some sense. For documents - that use the application cache via JavaScript, the loader mechinery will + that use the application cache via JavaScript, the loader engine will first ask the application cache for the contents, before hitting the network. The feature is described in details at: http://dev.w3.org/html5/spec/Overview.html#appcache - \a path must point to an existing directory where the cache is stored. + \a path must point to an existing directory. Setting an empty path disables the feature. + Support for offline web application cache storage can enabled by setting the + \l{QWebSettings::OfflineWebApplicationCacheEnabled}{OfflineWebApplicationCacheEnabled} attribute. + \sa offlineWebApplicationCachePath() */ void QWebSettings::setOfflineWebApplicationCachePath(const QString& path) @@ -933,7 +947,6 @@ void QWebSettings::setOfflineWebApplicationCachePath(const QString& path) /*! \since 4.6 - \relates QWebSettings Returns the path of the HTML5 offline web application cache storage or an empty string if the feature is disabled. @@ -980,7 +993,6 @@ qint64 QWebSettings::offlineWebApplicationCacheQuota() /*! \since 4.6 - \relates QWebSettings Sets the path for HTML5 local storage to \a path. @@ -1025,7 +1037,6 @@ QUrl QWebSettings::inspectorUrl() const /*! \since 4.6 - \relates QWebSettings Returns the path for HTML5 local storage. @@ -1038,13 +1049,14 @@ QString QWebSettings::localStoragePath() const /*! \since 4.6 - \relates QWebSettings - Enables WebKit persistent data and sets the path to \a path. - If the \a path is empty the path for persistent data is set to the - user-specific data location specified by - \l{QDesktopServices::DataLocation}{DataLocation}. - + Enables WebKit data persistence and sets the path to \a path. + If \a path is empty, the user-specific data location specified by + \l{QDesktopServices::DataLocation}{DataLocation} will be used instead. + + This method will simultaneously set and enable the iconDatabasePath(), + localStoragePath(), offlineStoragePath() and offlineWebApplicationCachePath(). + \sa localStoragePath() */ void QWebSettings::enablePersistentStorage(const QString& path) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index d2e536e..3592e2c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -63,7 +63,7 @@ public: OfflineStorageDatabaseEnabled, OfflineWebApplicationCacheEnabled, LocalStorageEnabled, -#ifdef QT_DEPRECATED +#if defined(QT_DEPRECATED) || defined(qdoc) LocalStorageDatabaseEnabled = LocalStorageEnabled, #endif LocalContentCanAccessRemoteUrls, diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 6ddaa2b..efc8f27 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,102 @@ +2010-05-14 Kent Hansen , Jocelyn Turcotte , Tor Arne Vestbø , Henry Haverinen , Jedrzej Nowacki , Andreas Kling + + Reviewed by Simon Hausmann. + + [Qt] Merge overhaul of the QtWebKit API documentation + + Numerous improvements in wording, qdoc warning fixes and + clarifications, done in a team work effort. + + No functional changes. + + * Api/qwebdatabase.cpp: + * Api/qwebelement.cpp: + * Api/qwebframe.cpp: + * Api/qwebhistoryinterface.cpp: + * Api/qwebinspector.cpp: + * Api/qwebkitversion.cpp: + * Api/qwebpage.cpp: + * Api/qwebpluginfactory.cpp: + * Api/qwebsecurityorigin.cpp: + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * docs/qtwebkit.qdoc: + * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: + (wrapInFunction): + * docs/webkitsnippets/webelement/main.cpp: + (findButtonAndClick): + (autocomplete1): + (autocomplete2): + (main): + +2010-05-14 Martin Smith + + Reviewed by Simon Hausmann. + + Documentation: Fix overview grouping. + + * docs/qtwebkit.qdoc: + +2010-05-14 Benjamin Poulain + + Reviewed by Laszlo Gombos. + + [QT] Update the Symbian version for the user agent + https://bugs.webkit.org/show_bug.cgi?id=38389 + + Update the user agent for Symbian^2 to Symbian^4 + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2010-05-11 Antonio Gomes + + Reviewed by Kenneth Christiansen. + + [Qt] emit initialLayoutCompleted signal from FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout + https://bugs.webkit.org/show_bug.cgi?id=38921 + + Emit initialLayoutCompleted signal from FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout + instead of FrameLoaderClientQt::dispatchDidFirstLayout , because the former ensures that a + visual content layed out on the frame. + + It matches to QWebFrame::initialLayoutCompleted signal documentation at: + + "... This is the first time you will see contents displayed on the frame ..." + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidFirstLayout): + (WebCore::FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout): + +2010-05-11 Kenneth Rohde Christiansen + + Reviewed by Laszlo Gombos. + + [Qt] REGRESSION(r58497) tst_QGraphicsWebView::crashOnViewlessWebPages() is failing + https://bugs.webkit.org/show_bug.cgi?id=38655 + + Fix double free by moving the connect till after the resize. + + The bug is causes by the fact that a resize of an empty page causes a + layout, thus deleting the qgraphicswebview before setHtml is called, + which then deletes it again, causing a double free. + + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::crashOnViewlessWebPages): + +2010-05-11 Diego Gonzalez + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] tst_QWebPage::inputMethods failing on Maemo5 + https://bugs.webkit.org/show_bug.cgi?id=38685 + + Check if the SIP (Software Input Panel) is triggered, which normally + happens on mobile platforms, when a user input form receives a mouse click. + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + 2010-05-09 Noam Rosenthal Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 4ad008b..686bfcc 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -414,13 +414,13 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() void FrameLoaderClientQt::dispatchDidFirstLayout() { - if (m_webFrame) - emit m_webFrame->initialLayoutCompleted(); + notImplemented(); } void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout() { - notImplemented(); + if (m_webFrame) + emit m_webFrame->initialLayoutCompleted(); } void FrameLoaderClientQt::dispatchShow() diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 96eb16e..c6dd550 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -7,63 +7,9 @@ \ingroup modules \ingroup technology-apis - \brief The QtWebKit module provides a web browser engine and + \brief The QtWebKit module provides a web browser engine as well as classes to render and interact with web content. - To include the definitions of the module's classes, use the - following directive: - - \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1 - - To link against the module, add this line to your \l qmake \c - .pro file: - - \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0 - - \section1 License Information - - This is a snapshot of the Qt port of WebKit. The exact version information - can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt. - - Qt Commercial Edition licensees that wish to distribute applications that - use the QtWebKit module need to be aware of their obligations under the - GNU Library General Public License (LGPL). - - Developers using the Open Source Edition can choose to redistribute - the module under the appropriate version of the GNU LGPL. - - \legalese - WebKit is licensed under the GNU Library General Public License. - Individual contributor names and copyright dates can be found - inline in the code. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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. - \endlegalese -*/ - -/*! - \page webintegration.html - \title Integrating Web Content with QtWebKit - \since 4.4 - - \ingroup frameworks-technologies - - \keyword Browser - \keyword Web Browser - QtWebKit provides a Web browser engine that makes it easy to embed content from the World Wide Web into your Qt application. At the same time Web content can be enhanced with native controls. @@ -85,6 +31,20 @@ QtWebKit is based on the Open Source WebKit engine. More information about WebKit itself can be found on the \l{WebKit Open Source Project} Web site. + \section1 Including In Your Project + + To include the definitions of the module's classes, use the + following directive: + + \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1 + + To link against the module, add this line to your \l qmake \c + .pro file: + + \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0 + + \section1 Notes + \note Building the QtWebKit module with debugging symbols is problematic on many platforms due to the size of the WebKit engine. We recommend building the module only in release mode for embedded platforms. @@ -99,10 +59,6 @@ Embedded Linux systems. See the \l{Qt for Embedded Linux Requirements} document for more information. - Topics: - - \tableofcontents - \section1 Architecture The easiest way to render content is through the QWebView class. As a @@ -195,4 +151,39 @@ \o The system \c{/Library/Internet Plug-Ins} directory \endlist \endtable + + + \section1 License Information + + This is a snapshot of the Qt port of WebKit. The exact version information + can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt. + + Qt Commercial Edition licensees that wish to distribute applications that + use the QtWebKit module need to be aware of their obligations under the + GNU Library General Public License (LGPL). + + Developers using the Open Source Edition can choose to redistribute + the module under the appropriate version of the GNU LGPL. + + \legalese + WebKit is licensed under the GNU Library General Public License. + Individual contributor names and copyright dates can be found + inline in the code. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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. + \endlegalese */ + diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp index a6b6620..07f1d45 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp @@ -9,8 +9,6 @@ void wrapInFunction() QWebInspector *inspector = new QWebInspector; inspector->setPage(page); - - connect(page, SIGNAL(webInspectorTriggered(QWebElement)), inspector, SLOT(show())); //! [0] } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp index 822b61c..b1781a6 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp @@ -36,6 +36,59 @@ static void traverse() //! [Traversing with QWebElement] } +static void findButtonAndClick() +{ + + frame->setHtml("
" + "" + "" + "
"); + +//! [Calling a DOM element method] + + QWebElement document = frame->documentElement(); + /* Assume that the document has the following structure: + +
+ + +
+ + */ + + QWebElement button = document.findFirst("input[type=submit]"); + button.evaluateJavaScript("click()"); + +//! [Calling a DOM element method] + + } + +static void autocomplete1() +{ + QWebElement document = frame->documentElement(); + +//! [autocomplete1] + QWebElement firstTextInput = document.findFirst("input[type=text]"); + QString storedText = firstTextInput.attribute("value"); +//! [autocomplete1] + +} + + +static void autocomplete2() +{ + + QWebElement document = frame->documentElement(); + QString storedText = "text"; + +//! [autocomplete2] + QWebElement firstTextInput = document.findFirst("input[type=text]"); + textInput.setAttribute("value", storedText); +//! [autocomplete2] + +} + + static void findAll() { //! [FindAll] @@ -65,5 +118,8 @@ int main(int argc, char *argv[]) frame = view->page()->mainFrame(); traverse(); findAll(); + findButtonAndClick(); + autocomplete1(); + autocomplete2(); return 0; } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index 14f5820..ebe847d 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -84,16 +84,19 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() WebPage* page = new WebPage; webView->setPage(page); page->webView = webView; - connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting())); - scene.addItem(webView); view.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); view.resize(600, 480); webView->resize(view.geometry().size()); + QCoreApplication::processEvents(); view.show(); + // Resizing the page will resize and layout the empty "about:blank" + // page, so we first connect the signal afterward. + connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting())); + page->mainFrame()->setHtml(QString("data:text/html," "" "" @@ -101,6 +104,7 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() "")); QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); + delete page; } void tst_QGraphicsWebView::microFocusCoordinates() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 834a394..12fb9b3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1367,7 +1368,27 @@ void tst_QWebPage::inputMethods() page->event(&evrel); #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); + // This part of the test checks if the SIP (Software Input Panel) is triggered, + // which normally happens on mobile platforms, when a user input form receives + // a mouse click. + int inputPanel = 0; + if (viewType == "QWebView") { + if (QWebView* wv = qobject_cast(view)) + inputPanel = wv->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel); + } else if (viewType == "QGraphicsWebView") { + if (QGraphicsWebView* wv = qobject_cast(view)) + inputPanel = wv->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel); + } + + // For non-mobile platforms RequestSoftwareInputPanel event is not called + // because there is no SIP (Software Input Panel) triggered. In the case of a + // mobile platform, an input panel, e.g. virtual keyboard, is usually invoked + // and the RequestSoftwareInputPanel event is called. For these two situations + // this part of the test can verified as the checks below. + if (inputPanel) + QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); + else + QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); #endif viewEventSpy.clear(); -- cgit v0.12 From c25737a44fb22668c67568eefb61c72457166dfe Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 14 May 2010 11:29:35 +0200 Subject: Fix compilation of QtDeclarative module (gcc) Broke with commit 645b9ee9dd6 --- src/declarative/qml/qdeclarativeinclude.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 97220f1..619264a 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -41,7 +41,7 @@ #include "qdeclarativeinclude_p.h" -#include +#include #include #include #include -- cgit v0.12 From 37c817ac5d19fe70e1457dddc8ba62ad6702cfdb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 14 May 2010 11:32:01 +0200 Subject: doc: Added some \briefs to how-to docs. --- doc/src/frameworks-technologies/dbus-adaptors.qdoc | 1 + doc/src/howtos/HWacceleration.qdoc | 15 +++++++++------ doc/src/howtos/accelerators.qdoc | 1 + doc/src/howtos/appicon.qdoc | 1 + doc/src/howtos/guibooks.qdoc | 1 + doc/src/howtos/qtdesigner.qdoc | 1 + doc/src/howtos/restoring-geometry.qdoc | 2 +- doc/src/howtos/session.qdoc | 2 +- doc/src/howtos/sharedlibrary.qdoc | 2 +- doc/src/howtos/timers.qdoc | 2 +- doc/src/sql-programming/qsqldatatype-table.qdoc | 19 ++++++++++--------- 11 files changed, 28 insertions(+), 19 deletions(-) diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc index 11c5998..25c6a43 100644 --- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc +++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc @@ -43,6 +43,7 @@ \page usingadaptors.html \title Using QtDBus Adaptors \ingroup technology-apis + \brief How to create and use DBus adaptors in Qt. \ingroup best-practices diff --git a/doc/src/howtos/HWacceleration.qdoc b/doc/src/howtos/HWacceleration.qdoc index fbc657c..c7b1a72 100644 --- a/doc/src/howtos/HWacceleration.qdoc +++ b/doc/src/howtos/HWacceleration.qdoc @@ -41,17 +41,20 @@ /*! \page HWAcc_rendering.html - \title Using hardware acceleration on embedded platforms. + \title Hardware Acceleration & Embedded Platforms. + \brief How to use hardware acceleration for fast rendering. \ingroup best-practices \section1 Abstract + This document describes how to use hardware acceleration for fast - rendering on embedded platforms supported by Qt. In short, it explains - how the graphics pipeline works. Since there might be differences to - how the APIs are being used on different embedded platforms, a table - links to documentation dedicated to platform specific documentation - for each supported hardware acceleration API. + rendering on embedded platforms supported by Qt. In short, it + explains how the graphics pipeline works. Since there might be + differences to how the APIs are being used on different embedded + platforms, a table links to documentation dedicated to platform + specific documentation for each supported hardware acceleration + API. \input platforms/emb-hardwareacceleration.qdocinc diff --git a/doc/src/howtos/accelerators.qdoc b/doc/src/howtos/accelerators.qdoc index 65f1def..b6ef5c2 100644 --- a/doc/src/howtos/accelerators.qdoc +++ b/doc/src/howtos/accelerators.qdoc @@ -42,6 +42,7 @@ /*! \page accelerators.html \title Standard Accelerator Keys + \brief Recommended accelerator keys. \ingroup best-practices diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc index dd39509..9377961 100644 --- a/doc/src/howtos/appicon.qdoc +++ b/doc/src/howtos/appicon.qdoc @@ -42,6 +42,7 @@ /*! \page appicon.html \title Setting the Application Icon + \brief How to set your application's icon. \ingroup best-practices diff --git a/doc/src/howtos/guibooks.qdoc b/doc/src/howtos/guibooks.qdoc index 1a70670..bccfbe6 100644 --- a/doc/src/howtos/guibooks.qdoc +++ b/doc/src/howtos/guibooks.qdoc @@ -43,6 +43,7 @@ \page guibooks.html \title Books about GUI Design \ingroup best-practices + \brief Some recommended books about GUI design. This is not a comprehensive list -- there are many other books worth buying. Here we mention just a few user interface books that don't diff --git a/doc/src/howtos/qtdesigner.qdoc b/doc/src/howtos/qtdesigner.qdoc index 2dd7fcf..92041f0 100644 --- a/doc/src/howtos/qtdesigner.qdoc +++ b/doc/src/howtos/qtdesigner.qdoc @@ -42,6 +42,7 @@ /*! \page qtdesigner-components.html \title Creating and Using Components for Qt Designer + \brief How to create and use custom widget plugins. \ingroup best-practices \tableofcontents diff --git a/doc/src/howtos/restoring-geometry.qdoc b/doc/src/howtos/restoring-geometry.qdoc index 36c5e4f..e72b993 100644 --- a/doc/src/howtos/restoring-geometry.qdoc +++ b/doc/src/howtos/restoring-geometry.qdoc @@ -42,7 +42,7 @@ /*! \page restoring-geometry.html \title Restoring a Window's Geometry - + \brief How to save & restore window geometry. \ingroup best-practices This document describes how to save and restore a \l{Window diff --git a/doc/src/howtos/session.qdoc b/doc/src/howtos/session.qdoc index e2e87a8..f53af04 100644 --- a/doc/src/howtos/session.qdoc +++ b/doc/src/howtos/session.qdoc @@ -42,7 +42,7 @@ /*! \page session.html \title Session Management - + \brief How to do session management with Qt. \ingroup best-practices A \e session is a group of running applications, each of which has a diff --git a/doc/src/howtos/sharedlibrary.qdoc b/doc/src/howtos/sharedlibrary.qdoc index 70fc4db..ed803ed 100644 --- a/doc/src/howtos/sharedlibrary.qdoc +++ b/doc/src/howtos/sharedlibrary.qdoc @@ -42,7 +42,7 @@ /*! \page sharedlibrary.html \title Creating Shared Libraries - + \brief How to create shared libraries. \ingroup best-practices The following sections list certain things that should be taken into diff --git a/doc/src/howtos/timers.qdoc b/doc/src/howtos/timers.qdoc index cfc2fb4..b001916 100644 --- a/doc/src/howtos/timers.qdoc +++ b/doc/src/howtos/timers.qdoc @@ -42,7 +42,7 @@ /*! \page timers.html \title Timers - \brief How to use timers in your application. + \brief How to use Qt timers in your application. \ingroup best-practices diff --git a/doc/src/sql-programming/qsqldatatype-table.qdoc b/doc/src/sql-programming/qsqldatatype-table.qdoc index fc961f5..398e659 100644 --- a/doc/src/sql-programming/qsqldatatype-table.qdoc +++ b/doc/src/sql-programming/qsqldatatype-table.qdoc @@ -41,19 +41,20 @@ /*! \page sql-types.html - \title Recommended Use of Data Types in Databases + \title Data Types for Qt-supported Database Systems + \brief Recommended data types for database systems \ingroup best-practices - \section1 Recommended Use of Types in Qt Supported Databases + \section1 Data Types for Qt Supported Database Systems - This table shows the recommended data types used when extracting data - from the databases supported in Qt. It is important to note that the - types used in Qt are not necessarily valid as input to the specific - database. One example could be that a double would work perfectly as - input for floating point records in a database, but not necessarily - as a storage format for output from the database since it would be stored - with 64-bit precision in C++. + This table shows the recommended data types for extracting data from + the databases supported in Qt. Note that types used in Qt are not + necessarily valid as input types to a specific database + system. e.g., A double might work perfectly as input for floating + point records in a particular database, but not necessarily as a + storage format for output from that database, because it would be + stored with 64-bit precision in C++. \tableofcontents -- cgit v0.12 From 23f1fa2e47f3bd4cea92510d70c2e9d0fbbcfc92 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 14 May 2010 10:36:27 +0200 Subject: [Regression] Build failure on Mac Carbon Including objc/runtime.h when using Carbon produced problems so I protected that include via ifdef. Task-number: QTBUG-10519 Reviewed-by: Jason Mcdonald --- src/gui/kernel/qt_mac_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h index 3341ce1..ca9541a 100644 --- a/src/gui/kernel/qt_mac_p.h +++ b/src/gui/kernel/qt_mac_p.h @@ -57,7 +57,9 @@ #ifdef __OBJC__ #include +#ifdef QT_MAC_USE_COCOA #include +#endif // QT_MAC_USE_COCOA #endif #include -- cgit v0.12 From e0c4899b46a68b37ce743c5a1ffd17596cbaa44c Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 14 May 2010 11:41:05 +0200 Subject: Mac: restoreGeometry() The problem here is the fact that when zooming (maximizing) a window, we should update the starting position since the window is now starting at 0,0. However when restoring the window should be placed in the original position. The bug here occurs because we kept the original position and the new size. So the window was drawn were it was using the new size. This patch introduces a boolean flag that keeps track of the maximized state. We are interested in knowing if the window was maximized but not restored, so when saving the geometry we have a way to know that we need to "move" the window to 0,0. Task-number: QTBUG-10504 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 21 ++++++++++++++++++--- src/gui/kernel/qwidget.cpp | 22 ++++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 8 ++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 24498f8..2b9cf85 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -202,6 +202,11 @@ static void cleanupCocoaWindowDelegate() QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state & ~Qt::WindowMaximized)); qt_sendSpontaneousEvent(qwidget, &e); + } else { + widgetData->window_state = widgetData->window_state & ~Qt::WindowMaximized; + QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state + | Qt::WindowMaximized)); + qt_sendSpontaneousEvent(qwidget, &e); } NSRect rect = [[window contentView] frame]; const QSize newSize(rect.size.width, rect.size.height); @@ -305,9 +310,19 @@ static void cleanupCocoaWindowDelegate() Q_UNUSED(newFrame); // saving the current window geometry before the window is maximized QWidget *qwidget = m_windowHash->value(window); - if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) { - QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget); - widgetPrivate->topData()->normalGeometry = qwidget->geometry(); + QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget); + if (qwidget->isWindow()) { + if(qwidget->windowState() & Qt::WindowMaximized) { + // Restoring + widgetPrivate->topData()->wasMaximized = false; + } else { + // Maximizing + widgetPrivate->topData()->normalGeometry = qwidget->geometry(); + // If the window was maximized we need to update the coordinates since now it will start at 0,0. + // We do this in a special field that is only used when not restoring but manually resizing the window. + // Since the coordinates are fixed we just set a boolean flag. + widgetPrivate->topData()->wasMaximized = true; + } } return YES; } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e39526e..420eda6 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1581,6 +1581,11 @@ void QWidgetPrivate::createTLExtra() x->inTopLevelResize = false; x->inRepaint = false; x->embedded = 0; +#ifdef Q_WS_MAC +#ifdef QT_MAC_USE_COCOA + x->wasMaximized = false; +#endif // QT_MAC_USE_COCOA +#endif // Q_WS_MAC createTLSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; @@ -6749,6 +6754,18 @@ void QWidget::setGeometry(const QRect &r) */ QByteArray QWidget::saveGeometry() const { +#ifdef QT_MAC_USE_COCOA + // We check if the window was maximized during this invocation. If so, we need to record the + // starting position as 0,0. + Q_D(const QWidget); + QRect newFramePosition = frameGeometry(); + QRect newNormalPosition = normalGeometry(); + if(d->topData()->wasMaximized) { + // Change the starting position + newFramePosition.moveTo(0, 0); + newNormalPosition.moveTo(0, 0); + } +#endif // QT_MAC_USE_COCOA QByteArray array; QDataStream stream(&array, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_0); @@ -6758,8 +6775,13 @@ QByteArray QWidget::saveGeometry() const stream << magicNumber << majorVersion << minorVersion +#ifdef QT_MAC_USE_COCOA + << newFramePosition + << newNormalPosition +#else << frameGeometry() << normalGeometry() +#endif // QT_MAC_USE_COCOA << qint32(QApplication::desktop()->screenNumber(this)) << quint8(windowState() & Qt::WindowMaximized) << quint8(windowState() & Qt::WindowFullScreen); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index cad60b5..3f494d8 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -170,6 +170,14 @@ struct QTLWExtra { WindowGroupRef group; IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys. quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys() +#ifdef QT_MAC_USE_COCOA + // This value is just to make sure we maximize and restore to the right location, yet we allow apps to be maximized and + // manually resized. + // The name is misleading, since this is set when maximizing the window. It is a hint to saveGeometry(..) to record the + // starting position as 0,0 instead of the normal starting position. + bool wasMaximized; +#endif // QT_MAC_USE_COCOA + #elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS #ifndef QT_NO_QWS_MANAGER QWSManager *qwsManager; -- cgit v0.12 From 02bc8c45f2cae1b6cd417631be8e98bc79c9c42d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 14 May 2010 14:47:42 +0200 Subject: doc: Another upgrade of the top page and overviews. More to come. --- doc/src/development/developing-on-mac.qdoc | 5 +- doc/src/frameworks-technologies/accessible.qdoc | 3 + doc/src/frameworks-technologies/dbus-adaptors.qdoc | 2 +- doc/src/frameworks-technologies/phonon.qdoc | 2 + doc/src/getting-started/known-issues.qdoc | 10 +- doc/src/overviews.qdoc | 19 +- doc/src/sql-programming/qsqldatatype-table.qdoc | 2 +- doc/src/sql-programming/sql-driver.qdoc | 2 +- doc/src/sql-programming/sql-programming.qdoc | 6 + doc/src/widgets-and-layouts/styles.qdoc | 12 +- doc/src/widgets-and-layouts/widgets.qdoc | 202 ++++++++++----------- doc/src/windows-and-dialogs/mainwindow.qdoc | 14 +- 12 files changed, 141 insertions(+), 138 deletions(-) diff --git a/doc/src/development/developing-on-mac.qdoc b/doc/src/development/developing-on-mac.qdoc index 785858f..0c0af79 100644 --- a/doc/src/development/developing-on-mac.qdoc +++ b/doc/src/development/developing-on-mac.qdoc @@ -41,9 +41,8 @@ /*! \page developing-on-mac.html - \title Developing Qt Applications on Mac OS X - \brief A overview of items to be aware of when developing Qt applications - on Mac OS X + \title Developing Qt Applications for Mac OS X + \brief Information for developing Qt applications for Mac OS X \ingroup platform-specific \tableofcontents diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc index 35f1c75..0aff214 100644 --- a/doc/src/frameworks-technologies/accessible.qdoc +++ b/doc/src/frameworks-technologies/accessible.qdoc @@ -47,7 +47,10 @@ /*! \page accessible.html \title Accessibility + \brief How to make your applications accessible to those with disabilities. + \ingroup technology-apis + \ingroup best-practices \tableofcontents diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc index 25c6a43..3dd0e4d 100644 --- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc +++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc @@ -42,9 +42,9 @@ /*! \page usingadaptors.html \title Using QtDBus Adaptors - \ingroup technology-apis \brief How to create and use DBus adaptors in Qt. + \ingroup technology-apis \ingroup best-practices Adaptors are special classes that are attached to any QObject-derived class diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc index 61d7926..61b906e 100644 --- a/doc/src/frameworks-technologies/phonon.qdoc +++ b/doc/src/frameworks-technologies/phonon.qdoc @@ -42,7 +42,9 @@ /*! \page phonon-overview.html \title Phonon multimedia framework + \brief Using the Phonon multimedia framework in Qt. \ingroup technology-apis + \ingroup best-practices \tableofcontents diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index b73e15d..cedebf9 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -41,15 +41,15 @@ /*! \page known-issues.html - \title Known Issues in %VERSION% + \title Known Issues in this Qt Version \ingroup platform-specific - \brief A summary of known issues in Qt %VERSION% at the time of release. + \brief A summary of known issues in this Qt version at the time of release. - An up-to-date list of known issues with Qt %VERSION% can be found via the + An up-to-date list of known issues can be found at \l{http://bugreports.qt.nokia.com/}{Qt Bug Tracker}. - For a list list of known bugs in Qt %VERSION%, see the \l{Task Tracker} - on the Qt website. + For a list list of known bugs, see the \l{Task Tracker} at the Qt + website. An overview of known issues may also be found at: \l{http://qt.gitorious.org/qt/pages/QtKnownIssues} diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 0b82388..c3c59af 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -117,13 +117,28 @@ */ /*! + \group qt-sql + \title Using SQL in Qt + \brief Qt API's for using SQL. + \ingroup technology-apis + \ingroup best-practices + + These pages document Qt's API's for using SQL database systems + in Qt applications. + + \generatelist{related} +*/ + +/*! \group best-practices \title How-To's and Best Practices \brief How-To Guides and Best Practices - These documents provide guidelines and best practices explaining - how to use Qt to solve specific technical problems. + These documents provide guidelines and best practices for using Qt + to solve specific technical problems. They are listed + alphabetically by the first word in the title, so scan the entire + list to find what you want. \generatelist{related} */ diff --git a/doc/src/sql-programming/qsqldatatype-table.qdoc b/doc/src/sql-programming/qsqldatatype-table.qdoc index 398e659..fb5fb49 100644 --- a/doc/src/sql-programming/qsqldatatype-table.qdoc +++ b/doc/src/sql-programming/qsqldatatype-table.qdoc @@ -44,7 +44,7 @@ \title Data Types for Qt-supported Database Systems \brief Recommended data types for database systems - \ingroup best-practices + \ingroup qt-sql \section1 Data Types for Qt Supported Database Systems diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 6bccd83..f0e4e52 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -44,7 +44,7 @@ \title SQL Database Drivers \brief How to configure and install QtSql drivers for supported databases. - \ingroup best-practices + \ingroup qt-sql The QtSql module uses driver \l{How to Create Qt Plugins}{plugins} to communicate with the different database diff --git a/doc/src/sql-programming/sql-programming.qdoc b/doc/src/sql-programming/sql-programming.qdoc index f1f3e5e..b34810c 100644 --- a/doc/src/sql-programming/sql-programming.qdoc +++ b/doc/src/sql-programming/sql-programming.qdoc @@ -49,6 +49,7 @@ /*! \page sql-programming.html \title SQL Programming + \ingroup qt-sql \nextpage Connecting to Databases \brief Database integration for Qt applications. @@ -118,6 +119,7 @@ /*! \page sql-connecting.html \title Connecting to Databases + \ingroup qt-sql \contentspage SQL Programming \previouspage SQL Programming @@ -187,6 +189,7 @@ /*! \page sql-sqlstatements.html \title Executing SQL Statements + \ingroup qt-sql \previouspage Connecting to Databases \contentspage SQL Programming @@ -337,6 +340,7 @@ /*! \page sql-model.html \title Using the SQL Model Classes + \ingroup qt-sql \previouspage Executing SQL Statements \contentspage SQL Programming @@ -483,6 +487,7 @@ /*! \page sql-presenting.html \title Presenting Data in a Table View + \ingroup qt-sql \previouspage Using the SQL Model Classes \contentspage SQL Programming @@ -587,6 +592,7 @@ /*! \page sql-forms.html \title Creating Data-Aware Forms + \ingroup qt-sql \previouspage Presenting Data in a Table View \contentspage SQL Programming diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index b4bec8c..31dfe40 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -47,15 +47,9 @@ /*! \page style-reference.html - \title Implementing Styles and Style Aware Widgets + \title Styles and Style Aware Widgets \ingroup qt-gui-concepts - \brief An overview of styles and the styling of widgets. - - \ingroup frameworks-technologies - - \previouspage Widget Classes - \contentspage Widgets and Layouts - \nextpage {Qt Style Sheets}{Style sheets} + \brief Styles and the styling of widgets. Styles (classes that inherit QStyle) draw on behalf of widgets and encapsulate the look and feel of a GUI. The QStyle class is @@ -91,8 +85,6 @@ current style. This document shows how widgets draw themselves and which possibilities the style gives them. - \tableofcontents - \section1 Classes for Widget Styling These classes are used to customize an application's appearance and diff --git a/doc/src/widgets-and-layouts/widgets.qdoc b/doc/src/widgets-and-layouts/widgets.qdoc index ac0bf77..9fe2d69 100644 --- a/doc/src/widgets-and-layouts/widgets.qdoc +++ b/doc/src/widgets-and-layouts/widgets.qdoc @@ -40,131 +40,121 @@ ****************************************************************************/ /*! - \page widgets-and-layouts.html - \title Widgets and Layouts - \ingroup qt-gui-concepts - - \ingroup frameworks-technologies - - \nextpage Widget Classes - - The primary elements for designing user interfaces in Qt are widgets and layouts. - - \section1 Widgets - - \l{Widget Classes}{Widgets} can display data and status information, receive - user input, and provide a container for other widgets that should be grouped - together. A widget that is not embedded in a parent widget is called a - \l{Application Windows and Dialogs}{window}. - - \image parent-child-widgets.png A parent widget containing various child widgets. - - The QWidget class provides the basic capability to render to the screen, and to - handle user input events. All UI elements that Qt provides are either subclasses - of QWidget, or are used in connection with a QWidget subclass. Creating custom - widgets is done by subclassing QWidget or a suitable subclass and reimplementing - the virtual event handlers. - - \section1 Layouts - - \l{Layout Management}{Layouts} are an elegant and flexible way to automatically - arrange child widgets within their container. Each widget reports its size requirements - to the layout through the \l{QWidget::}{sizeHint} and \l{QWidget::}{sizePolicy} - properties, and the layout distributes the available space accordingly. - - \table - \row - \o \image qgridlayout-with-5-children.png - \o \image qformlayout-with-6-children.png - \endtable - - \l{Qt Designer Manual}{\QD} is a powerful tool for interactively creating and - arranging widgets in layouts. - - \section1 Widget Styles - - \l{Implementing Styles and Style Aware Widgets}{Styles} draw on behalf of widgets - and encapsulate the look and feel of a GUI. Qt's built-in widgets use the QStyle - class to perform nearly all of their drawing, ensuring that they look exactly like - the equivalent native widgets. + \page widgets-and-layouts.html + \title Widgets and Layouts + \ingroup qt-gui-concepts + \brief The primary elements for designing user interfaces in Qt. + + \section1 Widgets + + Widgets are the primary elements for creating user interfaces in Qt. + \l{Widget Classes}{Widgets} can display data and status information, + receive user input, and provide a container for other widgets that + should be grouped together. A widget that is not embedded in a + parent widget is called a \l{Application Windows and + Dialogs}{window}. + + \image parent-child-widgets.png A parent widget containing various child widgets. + + The QWidget class provides the basic capability to render to the + screen, and to handle user input events. All UI elements that Qt + provides are either subclasses of QWidget, or are used in connection + with a QWidget subclass. Creating custom widgets is done by + subclassing QWidget or a suitable subclass and reimplementing the + virtual event handlers. + + \section1 Layouts + + \l{Layout Management}{Layouts} are an elegant and flexible way to + automatically arrange child widgets within their container. Each + widget reports its size requirements to the layout through the + \l{QWidget::}{sizeHint} and \l{QWidget::}{sizePolicy} properties, + and the layout distributes the available space accordingly. + + \table + \row + \o \image qgridlayout-with-5-children.png + \o \image qformlayout-with-6-children.png + \endtable + + \l{Qt Designer Manual}{\QD} is a powerful tool for interactively creating and + arranging widgets in layouts. + + \section1 Widget Styles + + \l{Implementing Styles and Style Aware Widgets}{Styles} draw on + behalf of widgets and encapsulate the look and feel of a GUI. Qt's + built-in widgets use the QStyle class to perform nearly all of their + drawing, ensuring that they look exactly like the equivalent native + widgets. - \table - \row - \o \image windowsxp-tabwidget.png - \o \image plastique-tabwidget.png - \o \image macintosh-tabwidget.png - \endtable - - \l{Qt Style Sheets} are a powerful mechanism that allows you to customize the - appearance of widgets, in addition to what is already possible by subclassing QStyle. -*/ - -/*! - \page widget-classes.html - \title Widget Classes + \table + \row + \o \image windowsxp-tabwidget.png + \o \image plastique-tabwidget.png + \o \image macintosh-tabwidget.png + \endtable - \contentspage Widgets and Layouts - \nextpage Layout Management + \l{Qt Style Sheets} are a powerful mechanism that allows you to customize the + appearance of widgets, in addition to what is already possible by subclassing QStyle. - Below you find a list of all widget classes in Qt. You can also browse the - widget classes Qt provides in the various supported styles in the - \l{Qt Widget Gallery}. + \section1 The Widget Classes - \tableofcontents + The following sections list the widget classes. See the \l{Qt Widget + Gallery} for some examples. - \section1 Basic Widgets + \section2 Basic Widgets - These basic widgets (controls), such as buttons, comboboxes and scroll bars, are - designed for direct use. + These basic widgets (controls), e.g. buttons, comboboxes and + scroll bars, are designed for direct use. - \table - \row - \o \image windows-label.png - \o \image windowsvista-pushbutton.png - \o \image gtk-progressbar.png - \row - \o \image plastique-combobox.png - \o \image macintosh-radiobutton.png - \o \image cde-lineedit.png - \endtable + \table + \row + \o \image windows-label.png + \o \image windowsvista-pushbutton.png + \o \image gtk-progressbar.png + \row + \o \image plastique-combobox.png + \o \image macintosh-radiobutton.png + \o \image cde-lineedit.png + \endtable - \annotatedlist basicwidgets + \annotatedlist basicwidgets - \section1 Advanced Widgets + \section2 Advanced Widgets - Advanced GUI widgets such as tab widgets and progress bars provide more - complex user interface controls. + Advanced GUI widgets, e.g. tab widgets and progress bars, provide + more complex user interface controls. - \table - \row - \o \image windowsxp-treeview.png - \o \image gtk-calendarwidget.png - \o \image qundoview.png - \endtable + \table + \row + \o \image windowsxp-treeview.png + \o \image gtk-calendarwidget.png + \o \image qundoview.png + \endtable - \annotatedlist advanced + \annotatedlist advanced - \table - \row - \o \image windowsvista-tabwidget.png - \o \image macintosh-groupbox.png - \endtable + \table + \row + \o \image windowsvista-tabwidget.png + \o \image macintosh-groupbox.png + \endtable - \section1 Organizer Widgets + \section2 Organizer Widgets - Classes like splitters, tab bars, button groups, etc are used to - organize and group GUI primitives into more complex applications or - dialogs. + Classes like splitters, tab bars, button groups, etc are used for + organizing and grouping GUI primitives into more complex + applications and dialogs. - \annotatedlist organizers + \annotatedlist organizers - \section1 Abstract Widget Classes + \section2 Abstract Widget Classes - Abstract widget classes usable through subclassing. They are generally - not usable in themselves, but provide functionality that can be used - by inheriting these classes. + The abstract widget classes are base classes. They are not usable as + standalone classes but provide functionality when they are subclassed. - \annotatedlist abstractwidgets + \annotatedlist abstractwidgets */ /*! diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index b282dab..c1e66d9 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -46,12 +46,11 @@ /*! \page application-windows.html - \title Application Windows and Dialogs + \title Window and Dialog Widgets + \brief Windows and Dialogs in Qt. \ingroup qt-gui-concepts \ingroup frameworks-technologies - \nextpage The Application Main Window - A \l{Widgets Tutorial}{widget} that is not embedded in a parent widget is called a window. Usually, windows have a frame and a title bar, although it is also possible to create windows without such decoration using suitable window flags). In Qt, QMainWindow @@ -165,12 +164,9 @@ /*! \page mainwindow.html - \title The Application Main Window - \brief Everything you need for a typical modern main application window, - including menus, toolbars, workspace, etc. - - \contentspage Application Windows and Dialogs - \nextpage Dialog Windows + \title Application Main Window + \ingroup qt-gui-concepts + \brief Creating the application window. \tableofcontents -- cgit v0.12 From b8f1d7fd87985375a373ca85052c475241822b03 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 12 May 2010 16:44:20 +0200 Subject: Optimized pixmapcache key generation for icons and styles If we sacrifice the readability we can make cache keys much faster. Since there is rarely a usecase where we need these as human readable strings we can take advantage of this fact and remove almost all memory allocations while still keeping them unique. Task-number: QTBUG-9850 Reviewed-by: brad --- src/gui/image/qicon.cpp | 23 +++++++------ src/gui/styles/qgtkpainter.cpp | 16 +++++++-- src/gui/styles/qstylehelper.cpp | 74 ++++++++++++----------------------------- 3 files changed, 48 insertions(+), 65 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 891b1db..9f1eea2 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -261,16 +261,19 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - QString key = QLatin1String("$qt_icon_") - + QString::number(pm.cacheKey()) - + QString::number(pe->mode) - + QString::number(QApplication::palette().cacheKey()) - + QLatin1Char('_') - + QString::number(actualSize.width()) - + QLatin1Char('_') - + QString::number(actualSize.height()) - + QLatin1Char('_'); - + int digits = sizeof(qint64)/sizeof(QChar); + quint64 tkey = pm.cacheKey(), + tmode = pe->mode, + tpalkey = QApplication::palette().cacheKey(), + twidth = actualSize.width(), + theight = actualSize.height(); + + QString key = QLatin1Literal("qt_") + % QString::fromRawData((QChar*)&tkey, digits) + % QString::fromRawData((QChar*)&tmode, digits) + % QString::fromRawData((QChar*)&tpalkey, digits) + % QString::fromRawData((QChar*)&twidth, digits) + % QString::fromRawData((QChar*)&theight, digits); if (mode == QIcon::Active) { if (QPixmapCache::find(key + QString::number(mode), pm)) diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index 1f68f2f..a6686e2 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -154,9 +154,21 @@ QGtkPainter::QGtkPainter(QPainter *_painter) static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, const QSize &size, GtkWidget *widget = 0) { + + int digits = sizeof(qint64)/sizeof(QChar); + quint64 tstate= state, + tshadow = shadow, + twidth = size.width(), + theight = size.height(), + twidget = quint64(widget); + // Note the widget arg should ideally use the widget path, though would compromise performance - QString tmp = QString(QLS("%0-%1-%2-%3x%4-%5")).arg(key).arg(uint(state)).arg(shadow) - .arg(size.width()).arg(size.height()).arg(quintptr(widget)); + QString tmp = key + % QString::fromRawData((QChar*)&tstate, digits) + % QString::fromRawData((QChar*)&tshadow, digits) + % QString::fromRawData((QChar*)&twidth, digits) + % QString::fromRawData((QChar*)&theight, digits) + % QString::fromRawData((QChar*)&twidget, digits); return tmp; } diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 296c51c..22f2014 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -58,67 +58,35 @@ QT_BEGIN_NAMESPACE -// internal helper. Converts an integer value to an unique string token -template -struct HexString -{ - inline HexString(const T t) - : val(t) - {} - - inline void write(QChar *&dest) const - { - const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - const char *c = reinterpret_cast(&val); - for (uint i = 0; i < sizeof(T); ++i) { - *dest++ = hexChars[*c & 0xf]; - *dest++ = hexChars[(*c & 0xf0) >> 4]; - ++c; - } - } - - const T val; -}; - -// specialization to enable fast concatenating of our string tokens to a string -template -struct QConcatenable > -{ - typedef HexString type; - enum { ExactSize = true }; - static int size(const HexString &str) { return sizeof(str.val) * 2; } - static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } -}; - namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) { const QStyleOptionComplex *complexOption = qstyleoption_cast(option); - - QString tmp = key - % QLatin1Char('-') - % HexString(option->state) - % QLatin1Char('-') - % HexString(option->direction) - % QLatin1Char('-') - % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) - % QLatin1Char('-') - % HexString(option->palette.cacheKey()) - % QLatin1Char('-') - % HexString(size.width()) - % QLatin1Char('x') - % HexString(size.height()); + int digits = sizeof(qint64)/sizeof(QChar); + quint64 state = option->state, + direction = option->direction, + subcontrols = (complexOption ? uint(complexOption->activeSubControls) : 0u), + palettekey = option->palette.cacheKey(), + width = size.width(), + height = size.height(); + + QString tmp = key % QString::fromRawData((QChar*)&state, digits) + % QString::fromRawData((QChar*)&direction, digits) + % QString::fromRawData((QChar*)&subcontrols, digits) + % QString::fromRawData((QChar*)&palettekey, digits) + % QString::fromRawData((QChar*)&width, digits) + % QString::fromRawData((QChar*)&height, digits); #ifndef QT_NO_SPINBOX if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - tmp = tmp - % QLatin1Char('-') - % HexString(spinBox->buttonSymbols) - % QLatin1Char('-') - % HexString(spinBox->stepEnabled) - % QLatin1Char('-') - % QLatin1Char(spinBox->frame ? '1' : '0'); + quint64 buttonsymbols = spinBox->buttonSymbols, + stepEnabled = spinBox->stepEnabled, + frame = spinBox->frame; + + tmp = tmp % QString::fromRawData((QChar*)&buttonsymbols, digits) + % QString::fromRawData((QChar*)&stepEnabled, digits) + % QString::fromRawData((QChar*)&frame, digits); } #endif // QT_NO_SPINBOX return tmp; -- cgit v0.12 From 9a69656bd64016933124813ea5403e7e5d454719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 14 May 2010 15:42:43 +0200 Subject: Added workarounds for two MBX/SGX specific GL ES bugs/problems. The workaround flags are put into the platform independent section for now, since there might be a general need for these as we expand our GL and GL ES usage. The workaround_needsFullClearOnEveryFrame flag covers the case where you get a performance penalty on PowerVR hw if all rendering buffers are not cleared. The workaround_brokenFBOReadBack flag covers the case where copying pixels from a texture (e.g. via glCopyTexSubImage2d()) bound in an FBO doesn't work. Task-number: QTBUG-10670 Reviewed-by: Gunnar --- .../gl2paintengineex/qtextureglyphcache_gl.cpp | 18 +++++------------- .../gl2paintengineex/qtextureglyphcache_gl_p.h | 2 -- src/opengl/qgl.cpp | 3 +++ src/opengl/qgl.h | 1 + src/opengl/qgl_egl.cpp | 20 +++++++++++++++++++- src/opengl/qgl_p.h | 8 +++++++- src/opengl/qglpaintdevice.cpp | 5 ++++- 7 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 452d37d..cc42c63 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -57,21 +57,13 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph , ctx(context) , m_width(0) , m_height(0) - , m_broken_fbo_readback(false) { // broken FBO readback is a bug in the SGX 1.3 and 1.4 drivers for the N900 where // copying between FBO's is broken if the texture is either GL_ALPHA or POT. The // workaround is to use a system-memory copy of the glyph cache for this device. // Switching to NPOT and GL_RGBA would both cost a lot more graphics memory and // be slower, so that is not desireable. -#if defined QT_OPENGL_ES_2 && !defined(QT_NO_EGL) - if (QByteArray((char*) glGetString(GL_RENDERER)).contains("SGX")) { - QGLContextPrivate *ctxd = context->d_func(); - m_broken_fbo_readback = QByteArray((char *) eglQueryString(ctxd->eglContext->display(), EGL_VERSION)).contains("1.3"); - } -#endif - - if (!m_broken_fbo_readback) + if (!ctx->d_ptr->workaround_brokenFBOReadBack) glGenFramebuffers(1, &m_fbo); connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)), @@ -83,7 +75,7 @@ QGLTextureGlyphCache::~QGLTextureGlyphCache() if (ctx) { QGLShareContextScope scope(ctx); - if (!m_broken_fbo_readback) + if (!ctx->d_ptr->workaround_brokenFBOReadBack) glDeleteFramebuffers(1, &m_fbo); if (m_width || m_height) @@ -96,7 +88,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) // create in QImageTextureGlyphCache baseclass is meant to be called // only to create the initial image and does not preserve the content, // so we don't call when this function is called from resize. - if (m_broken_fbo_readback && image().isNull()) + if (ctx->d_ptr->workaround_brokenFBOReadBack && image().isNull()) QImageTextureGlyphCache::createTextureData(width, height); glGenTextures(1, &m_texture); @@ -126,7 +118,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) GLuint oldTexture = m_texture; createTextureData(width, height); - if (m_broken_fbo_readback) { + if (ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::resizeTextureData(width, height); Q_ASSERT(image().depth() == 8); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits()); @@ -209,7 +201,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) { - if (m_broken_fbo_readback) { + if (ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::fillTexture(c, glyph); glBindTexture(GL_TEXTURE_2D, m_texture); diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index efb7435..6bcd655 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -115,8 +115,6 @@ private: int m_height; QGLShaderProgram *m_program; - - bool m_broken_fbo_readback; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 7c457de..922a96c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1612,6 +1612,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) current_fbo = 0; default_fbo = 0; active_engine = 0; + workaround_needsFullClearOnEveryFrame = false; + workaround_brokenFBOReadBack = false; + workaroundsCached = false; for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 92a064f..f297009 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -431,6 +431,7 @@ private: friend class QGLFramebufferObjectPrivate; friend class QGLFBOGLPaintDevice; friend class QGLPaintDevice; + friend class QGLWidgetGLPaintDevice; friend class QX11GLPixmapData; friend class QX11GLSharedContexts; private: diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 0fbbbf9..44e8ae9 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -185,8 +185,26 @@ void QGLContext::makeCurrent() return; } - if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) + if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) { QGLContextPrivate::setCurrentContext(this); + if (!d->workaroundsCached) { + d->workaroundsCached = true; + const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); + if (strstr(renderer, "SGX") || strstr(renderer, "MBX")) { + // PowerVR MBX/SGX chips needs to clear all buffers when starting to render + // a new frame, otherwise there will be a performance penalty to pay for + // each frame. + d->workaround_needsFullClearOnEveryFrame = true; + + // Older PowerVR SGX drivers (like the one in the N900) have a + // bug which prevents glCopyTexSubImage2D() to work with a POT + // or GL_ALPHA texture bound to an FBO. The only way to + // identify that driver is to check the EGL version number for it. + if (strstr(eglQueryString(d->eglContext->display(), EGL_VERSION), "1.3")) + d->workaround_brokenFBOReadBack = true; + } + } + } } void QGLContext::doneCurrent() diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index f19e394..d92f963 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -345,7 +345,7 @@ public: HDC hbitmap_hdc; #endif #ifndef QT_NO_EGL - bool ownsEglContext; + uint ownsEglContext : 1; QEglContext *eglContext; EGLSurface eglSurface; void destroyEglSurfaceForDevice(); @@ -382,6 +382,12 @@ public: uint internal_context : 1; uint version_flags_cached : 1; uint extension_flags_cached : 1; + + // workarounds for driver/hw bugs on different platforms + uint workaround_needsFullClearOnEveryFrame : 1; + uint workaround_brokenFBOReadBack : 1; + uint workaroundsCached : 1; + QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index e874e85..e1dcbfd 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -175,7 +175,10 @@ void QGLWidgetGLPaintDevice::beginPaint() float alpha = c.alphaF(); glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); } - glClear(GL_COLOR_BUFFER_BIT); + if (context()->d_func()->workaround_needsFullClearOnEveryFrame) + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + else + glClear(GL_COLOR_BUFFER_BIT); } } -- cgit v0.12 From 92ea8a1df59cb00178cd7670d2ce167bba3dd953 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 14 May 2010 15:55:48 +0200 Subject: Fix for autotest failure in qwidget::saveRestoreGeometry() The problem was that the fix for bug QTBUG-10519 introduced a new state for saving the geometry. However there is an exception and that exception comes into play when saving a maximized window. This fixes that by making sure we only enter into that state when the window is not currently maximized. Reviewed-by: tbastian --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 82eb12b..1f2cd8c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6731,7 +6731,7 @@ QByteArray QWidget::saveGeometry() const Q_D(const QWidget); QRect newFramePosition = frameGeometry(); QRect newNormalPosition = normalGeometry(); - if(d->topData()->wasMaximized) { + if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) { // Change the starting position newFramePosition.moveTo(0, 0); newNormalPosition.moveTo(0, 0); -- cgit v0.12 From c60045ad8df097ebcb7efa89a5fc18b3a4614df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 14 May 2010 16:37:48 +0200 Subject: Limit the lower glyph texture cache size to 16x16 in GL. The SGX chip has a limitation regarding FBOs in that it doesn't support FBO sizes that are POT and less than 16 pixels in width/height. Since the FBO we use in the GL glyph cache always mirrors the size of the texture itself, we limit that instead to avoid creating invalid FBOs. Task-number: QTBUG-10645 Reviewed-by: Gunnar --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index cc42c63..410cf21 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -91,6 +91,12 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) if (ctx->d_ptr->workaround_brokenFBOReadBack && image().isNull()) QImageTextureGlyphCache::createTextureData(width, height); + // Make the lower glyph texture size 16 x 16. + if (width < 16) + width = 16; + if (height < 16) + height = 16; + glGenTextures(1, &m_texture); glBindTexture(GL_TEXTURE_2D, m_texture); @@ -115,6 +121,12 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) int oldWidth = m_width; int oldHeight = m_height; + // Make the lower glyph texture size 16 x 16. + if (width < 16) + width = 16; + if (height < 16) + height = 16; + GLuint oldTexture = m_texture; createTextureData(width, height); -- cgit v0.12 From 336feccaf4517605306844690103baf331f11d50 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 14 May 2010 08:24:00 +0200 Subject: Remove skins from qml launcher. --- tools/qml/main.cpp | 21 ---- tools/qml/qml.pri | 2 - tools/qml/qmlruntime.cpp | 244 +---------------------------------------------- tools/qml/qmlruntime.h | 6 -- 4 files changed, 2 insertions(+), 271 deletions(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 116ca71..d1fc118 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -119,9 +119,6 @@ void usage() qWarning(" -maximized................................ run maximized"); qWarning(" -fullscreen............................... run fullscreen"); qWarning(" -stayontop................................ keep viewer window on top"); - qWarning(" -skin ...................... run with a skin window frame"); - qWarning(" \"list\" for a list of built-ins"); - qWarning(" -resizeview .............................. resize the view, not the skin"); qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); @@ -209,7 +206,6 @@ int main(int argc, char ** argv) QDeclarativeFolderListModel::registerTypes(); bool frameless = false; - bool resizeview = false; QString fileName; double fps = 0; int autorecord_from = 0; @@ -219,7 +215,6 @@ int main(int argc, char ** argv) QStringList recordargs; QStringList imports; QStringList plugins; - QString skin; QString script; QString scriptopts; bool runScript = false; @@ -252,11 +247,6 @@ int main(int argc, char ** argv) fullScreen = true; } else if (arg == "-stayontop") { stayOnTop = true; - } else if (arg == "-skin") { - if (lastArg) usage(); - skin = QString(argv[++i]); - } else if (arg == "-resizeview") { - resizeview = true; } else if (arg == "-netcache") { if (lastArg) usage(); cache = QString(argv[++i]).toInt(); @@ -418,21 +408,10 @@ int main(int argc, char ** argv) viewer->setNetworkCacheSize(cache); viewer->setRecordFile(recordfile); viewer->setSizeToView(sizeToView); - if (resizeview) - viewer->setScaleView(); if (fps>0) viewer->setRecordRate(fps); if (autorecord_to) viewer->setAutoRecord(autorecord_from,autorecord_to); - if (!skin.isEmpty()) { - if (skin == "list") { - foreach (QString s, viewer->builtinSkins()) - qWarning() << qPrintable(s); - exit(0); - } else { - viewer->setSkin(skin); - } - } if (devkeys) viewer->setDeviceKeys(true); viewer->setRecordDither(dither); diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index 3c86d31..a2058c7 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -32,5 +32,3 @@ symbian { FORMS = $$PWD/recopts.ui \ $$PWD/proxysettings.ui - -include(../shared/deviceskin/deviceskin.pri) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 16b0ffb..911bf8c 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -53,7 +53,6 @@ #include "qdeclarative.h" #include #include -#include "deviceskin.h" #include #include @@ -168,89 +167,6 @@ private: QWidget *refWidget; }; - -class PreviewDeviceSkin : public DeviceSkin -{ - Q_OBJECT -public: - explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent); - - void setPreview(QWidget *formWidget); - void setPreviewAndScale(QWidget *formWidget); - - void setScreenSize(const QSize& size) - { - QMatrix fit; - fit = fit.scale(qreal(size.width())/m_screenSize.width(), - qreal(size.height())/m_screenSize.height()); - setTransform(fit); - QApplication::syncX(); - } - - QSize standardScreenSize() const { return m_screenSize; } - - QMenu* menu; - -private slots: - void slotSkinKeyPressEvent(int code, const QString& text, bool autorep); - void slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep); - void slotPopupMenu(); - -private: - const QSize m_screenSize; -}; - - -PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) : - DeviceSkin(parameters, parent), - m_screenSize(parameters.screenSize()) -{ - menu = new QMenu(this); - connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)), - this, SLOT(slotSkinKeyPressEvent(int,QString,bool))); - connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)), - this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool))); - connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu())); -} - -void PreviewDeviceSkin::setPreview(QWidget *formWidget) -{ - formWidget->setFixedSize(m_screenSize); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) -{ - setScreenSize(formWidget->sizeHint()); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyPress,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } - -} - -void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } -} - -void PreviewDeviceSkin::slotPopupMenu() -{ - menu->exec(QCursor::pos()); -} - static struct { const char *name, *args; } ffmpegprofiles[] = { {"Maximum Quality", "-sameq"}, {"High Quality", "-qmax 2"}, @@ -463,7 +379,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags) #endif , loggerWindow(new LoggerWidget()) - , frame_stream(0), scaleSkin(true), mb(0) + , frame_stream(0), mb(0) , portraitOrientation(0), landscapeOrientation(0) , showWarningsWindow(0) , m_scriptOptions(0) @@ -475,7 +391,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) setWindowTitle(tr("Qt Qml Runtime")); devicemode = false; - skin = 0; canvas = 0; record_autotime = 0; record_rate = 50; @@ -653,51 +568,6 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) if (flatmenu) flatmenu->addSeparator(); - QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin")); - - QActionGroup *skinActions; - QAction *skinAction; - - skinActions = new QActionGroup(parent); - skinAction = new QAction(tr("Scale skin"), parent); - skinAction->setCheckable(true); - skinAction->setChecked(scaleSkin); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleSkin())); - skinAction = new QAction(tr("Resize view"), parent); - skinAction->setCheckable(true); - skinAction->setChecked(!scaleSkin); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleView())); - skinMenu->addSeparator(); - - skinActions = new QActionGroup(parent); - QSignalMapper *mapper = new QSignalMapper(parent); - skinAction = new QAction(tr("None"), parent); - skinAction->setCheckable(true); - if (currentSkin.isEmpty()) - skinAction->setChecked(true); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - mapper->setMapping(skinAction, ""); - connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); - skinMenu->addSeparator(); - - foreach (QString name, builtinSkins()) { - skinAction = new QAction(name, parent); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - skinAction->setCheckable(true); - if (":skin/"+name+".skin" == currentSkin) - skinAction->setChecked(true); - mapper->setMapping(skinAction, name); - connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); - } - connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setSkin(QString))); - - if (flatmenu) flatmenu->addSeparator(); #endif // Q_OS_SYMBIAN QMenu *settingsMenu = flatmenu ? flatmenu : menu->addMenu(tr("S&ettings")); @@ -813,31 +683,6 @@ void QDeclarativeViewer::warningsWidgetClosed() showWarningsWindow->setChecked(false); } -void QDeclarativeViewer::setScaleSkin() -{ - if (scaleSkin) - return; - scaleSkin = true; - if (skin) { - canvas->resize(initialSize); - canvas->setFixedSize(initialSize); - canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); - updateSizeHints(); - } -} - -void QDeclarativeViewer::setScaleView() -{ - if (!scaleSkin) - return; - scaleSkin = false; - if (skin) { - canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); - updateSizeHints(); - } -} - - void QDeclarativeViewer::takeSnapShot() { static int snapshotcount = 1; @@ -1091,83 +936,6 @@ void QDeclarativeViewer::startNetwork() #endif } -QStringList QDeclarativeViewer::builtinSkins() const -{ - QDir dir(":/skins/","*.skin"); - const QFileInfoList l = dir.entryInfoList(); - QStringList r; - for (QFileInfoList::const_iterator it = l.begin(); it != l.end(); ++it) { - r += (*it).baseName(); - } - return r; -} - -void QDeclarativeViewer::setSkin(const QString& skinDirOrName) -{ - QString skinDirectory = skinDirOrName; - - if (!QDir(skinDirOrName).exists() && QDir(":/skins/"+skinDirOrName+".skin").exists()) - skinDirectory = ":/skins/"+skinDirOrName+".skin"; - - if (currentSkin == skinDirectory) - return; - - currentSkin = skinDirectory; - - // XXX QWidget::setMask does not handle changes well, and we may - // XXX have been signalled from an item in a menu we're replacing, - // XXX hence some rather convoluted resetting here... - - QString err; - if (skin) { - skin->hide(); - skin->deleteLater(); - } - - DeviceSkinParameters parameters; - if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { - layout()->setEnabled(false); - if (mb) - mb->hide(); - if (!err.isEmpty()) - qWarning() << err; - skin = new PreviewDeviceSkin(parameters,this); - if (scaleSkin) - skin->setPreviewAndScale(canvas); - else - skin->setPreview(canvas); - createMenu(0,skin->menu); - if (scaleSkin) { - canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); - } - updateSizeHints(); - skin->show(); - } else if (skin) { - skin = 0; - clearMask(); - if ((windowFlags() & Qt::FramelessWindowHint)) { - menuBar()->clear(); - createMenu(menuBar(),0); - } - canvas->setParent(this, Qt::SubWindow); - setParent(0,windowFlags()); // recreate - mb->show(); - canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); - updateSizeHints(); - - layout()->setEnabled(true); - if (!scaleSkin) { - canvas->resize(initialSize); - canvas->setFixedSize(initialSize); - } - QSize newWindowSize = canvas->size(); - newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); - resize(newWindowSize); - show(); - } - canvas->show(); -} - void QDeclarativeViewer::setAutoRecord(int from, int to) { if (from==0) from=1; // ensure resized @@ -1496,24 +1264,16 @@ void QDeclarativeViewer::updateSizeHints() { if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { QSize newWindowSize = canvas->sizeHint(); - if (!skin) - newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); + newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); if (!isFullScreen() && !isMaximized()) { resize(newWindowSize); setFixedSize(newWindowSize); - if (skin && scaleSkin) { - skin->setScreenSize(newWindowSize); - } } } else { // QDeclarativeView::SizeRootObjectToView canvas->setMinimumSize(QSize(0,0)); canvas->setMaximumSize(QSize(16777215,16777215)); setMinimumSize(QSize(0,0)); setMaximumSize(QSize(16777215,16777215)); - if (skin && !scaleSkin) { - canvas->setFixedSize(skin->standardScreenSize()); - skin->setScreenSize(skin->standardScreenSize()); - } } updateGeometry(); } diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index b021d0d..0416b32 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -105,7 +105,6 @@ public: void setUseNativeFileBrowser(bool); void updateSizeHints(); void setSizeToView(bool sizeToView); - QStringList builtinSkins() const; QMenuBar *menuBar() const; @@ -123,10 +122,8 @@ public slots: void toggleRecording(); void toggleRecordingWithSelection(); void ffmpegFinished(int code); - void setSkin(const QString& skinDirectory); void showProxySettings (); void proxySettingsChanged (); - void setScaleView(); void toggleOrientation(); void statusChanged(); void setSlowMode(bool); @@ -143,7 +140,6 @@ private slots: void recordFrame(); void chooseRecordingOptions(); void pickRecordingFile(); - void setScaleSkin(); void setPortrait(); void setLandscape(); void startNetwork(); @@ -159,8 +155,6 @@ private: int menuBarHeight() const; LoggerWidget *loggerWindow; - PreviewDeviceSkin *skin; - QSize skinscreensize; QDeclarativeView *canvas; QSize initialSize; QString currentFileOrUrl; -- cgit v0.12 From 77e1ef8cb41f790115ff7552717e0ba4d33c3cf0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 14 May 2010 13:18:33 +0200 Subject: Rename QML Runtime (executable) to QML Launcher The qml executable was first referred to as QML Viewer, then QML Runtime ... however, the latter one caused much confusion (see old version of qmlruntime.qdoc). Doc changes reviewed by Leena Miettinen. --- .gitignore | 1 - doc/src/declarative/qmlruntime.qdoc | 47 +++++++++++----------- doc/src/snippets/declarative/gridview/gridview.qml | 2 +- .../snippets/declarative/listview/highlight.qml | 2 +- doc/src/snippets/declarative/listview/listview.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- src/declarative/QmlChanges.txt | 5 +++ tools/qdoc3/test/macros.qdocconf | 1 + tools/qml/content/Browser.qml | 6 +-- tools/qml/main.cpp | 14 +++---- tools/qml/qml.pro | 2 +- tools/qml/qmlruntime.cpp | 12 +++--- 12 files changed, 50 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index ad8e3ea..5707371 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,6 @@ bin/Qt*.dll bin/assistant* bin/designer* bin/dumpcpp* -bin/duiviewer* bin/idc* bin/linguist* bin/lrelease* diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 10aeac0..b105df4 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -46,15 +46,14 @@ \ingroup qttools This page documents the \e{Declarative UI Runtime} for the Qt GUI - toolkit, and the \c qml executable which can be used to run apps - written for the runtime. The \c qml executable reads a declarative user interface definition - (\c .qml) file and displays the user interface it describes. + toolkit, and the \QQL which can be used to run apps + written for the runtime. The \QQL reads a declarative + user interface definition (\c .qml) file and displays the user interface it describes. - QML is a runtime, as you can run plain qml files which pull in their required modules. + QML is a runtime, as you can run plain QML files which pull in their required modules. To run apps with the QML runtime, you can either start the runtime - from your own application (using a QDeclarativeView) or with the simple \c qml application. - The \c qml application can be - installed in a production environment, assuming that it is not already + from your own application (using a QDeclarativeView) or with the simple \QQL. + The launcher can be installed in a production environment, assuming that it is not already present in the system. It is generally packaged alongside Qt. To deploy an application using the QML runtime, you have two options: @@ -62,18 +61,18 @@ \list \o Write your own Qt application including a QDeclarative view and deploy it the same as any other Qt application (not discussed further on this page), or - \o Write a main QML file for your application, and run your application using the included \c qml tool. + \o Write a main QML file for your application, and run your application using the included \QQL. \endlist - To run an application with the \c qml tool, pass the filename as an argument: + To run an application with the \QQL, pass the filename as an argument: \code qml myQmlFile.qml \endcode - Deploying a QML application via the \c qml executable allows for QML only deployments, but can also + Deploying a QML application via the \QQL allows for QML only deployments, but can also include custom C++ modules just as easily. Below is an example of how you might structure - a complex application deployed via the qml runtime, it is a listing of the files that would + a complex application deployed via the QML runtime, it is a listing of the files that would be included in the deployment package. \code @@ -94,7 +93,7 @@ modules must contain a QDeclarativeExtentionPlugin subclass. The application would be executed either with your own application, the command 'qml MyApp.qml' or by - opening the qml file if your system has the \c qml executable registered as the handler for qml files. The MyApp.qml file would have access + opening the file if your system has the \QQL registered as the handler for QML files. The MyApp.qml file would have access to all of the deployed types using the import statements such as the following: \code @@ -102,19 +101,19 @@ import "OtherModule" 1.0 as Other \endcode - \section1 \c qml application functionality - The \c qml application implements some additional functionality to help it serve the role of a launcher - for myriad applications. If you implement your own launcher application, you may also wish to reimplement + \section1 Qt QML Launcher functionality + The \QQL implements some additional functionality to help it supporting + myriad applications. If you implement your own application, you may also wish to reimplement some or all of this functionality. However, much of this functionality is intended to aid the prototyping of - qml applications and may not be necessary for a deployed application. + QML applications and may not be necessary for a deployed application. \section2 Options - When run with the \c -help option, qml shows available options. + When run with the \c -help option, \c qml shows available options. \section2 Translations - When the runtime loads an initial QML file, it will install a translation file from + When the launcher loads an initial QML file, it will install a translation file from a "i18n" subdirectory relative to that initial QML file. The actual translation file loaded will be according to the system locale and have the form "qml_.qm", where is a two-letter ISO 639 language, @@ -126,12 +125,12 @@ See the \l{scripting.html#internationalization}{Qt Internationalization} documentation for information about how to make the JavaScript in QML files use translatable strings. - Additionally, the QML runtime will load translation files specified on the + Additionally, the launcher will load translation files specified on the command line via the \c -translation option. \section2 Dummy Data - The secondary use of the qml runtime is to allow QML files to be viewed with + The secondary use of the launcher is to allow QML files to be viewed with dummy data. This is useful when prototyping the UI, as the dummy data can be later replaced with actual data and bindings from a C++ plugin. To provide dummy data: create a directory called "dummydata" in the same directory as @@ -153,13 +152,13 @@ \section2 Runtime Object - All applications using the qmlruntime will have access to the 'runtime' + All applications using the launcher will have access to the 'runtime' property on the root context. This property contains several pieces of information about the runtime environment of the application. \section3 Screen Orientation - A special piece of dummy data which is integrated into the runtime is + A special piece of dummy data which is integrated into the launcher is a simple orientation property. The orientation can be set via the settings menu in the application, or by pressing Ctrl+T to toggle it. @@ -173,13 +172,13 @@ } \endcode - This allows your application to respond to the orientation of the screen changing. The runtime + This allows your application to respond to the orientation of the screen changing. The launcher will automatically update this on some platforms (currently the N900 only) to match the physical screen's orientation. On other plaforms orientation changes will only happen when explictly asked for. \section3 Window Active - The runtime.isActiveWindow property tells whether the main window of the qml runtime is currently active + The runtime.isActiveWindow property tells whether the main window of the launcher is currently active or not. This is especially useful for embedded devices when you want to pause parts of your application, including animations, when your application loses focus or goes to the background. diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index 1d3df97..cf345aa 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -4,7 +4,7 @@ import Qt 4.7 Rectangle { width: 240; height: 180; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist + // The launcher automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index 794b3f2..1282f8d 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -4,7 +4,7 @@ Rectangle { width: 180; height: 200; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist + // The launcher automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index 61bf126..44f0540 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -5,7 +5,7 @@ Rectangle { width: 180; height: 200; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist + // The launcher automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 50ba2f7..ade355d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -4,7 +4,7 @@ Rectangle { width: 400; height: 300 // MyPets model is defined in dummydata/MyPetsModel.qml - // The viewer automatically loads files in dummydata/* to assist + // The launcher automatically loads files in dummydata/* to assist // development without a real data source. // This one contains my pets. diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 604c14c..ec8f508 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -18,6 +18,11 @@ C++ API QDeclarativeExpression::value() has been renamed to QDeclarativeExpression::evaluate() +QML Launcher +------------ +The standalone executable has been renamed to qml launcher. Runtime warnings +can be now accessed via the menu (Debugging->Show Warnings). + ============================================================================= The changes below are pre Qt 4.7.0 beta 1 diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 22db23e..e7a1dbc 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -18,6 +18,7 @@ macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" +macro.QQL = "\\e{Qt QML Launcher}" macro.param = "\\e" macro.raisedaster.HTML = "*" macro.rarrow.HTML = "→" diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index 0912f58..c3a2cc0 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -12,12 +12,12 @@ Rectangle { FolderListModel { id: folders1 nameFilters: [ "*.qml" ] - folder: qmlViewerFolder + folder: qmlLauncherFolder } FolderListModel { id: folders2 nameFilters: [ "*.qml" ] - folder: qmlViewerFolder + folder: qmlLauncherFolder } SystemPalette { id: palette } @@ -62,7 +62,7 @@ Rectangle { if (folders.isFolder(index)) { down(filePath); } else { - qmlViewer.launch(filePath); + qmlLauncher.launch(filePath); } } width: root.width diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index d1fc118..380f5cc 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -86,7 +86,7 @@ QString warnings; void showWarnings() { if (!warnings.isEmpty()) { - QMessageBox::warning(0, QApplication::tr("Qt Declarative UI Runtime"), warnings); + QMessageBox::warning(0, QApplication::tr("Qt QML Launcher"), warnings); } } @@ -118,7 +118,7 @@ void usage() qWarning(" -frameless ............................... run with no window frame"); qWarning(" -maximized................................ run maximized"); qWarning(" -fullscreen............................... run fullscreen"); - qWarning(" -stayontop................................ keep viewer window on top"); + qWarning(" -stayontop................................ keep launcher window on top"); qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); @@ -157,9 +157,9 @@ void scriptOptsUsage() qWarning(" testerror ................................ test 'error' property of root item on playback"); qWarning(" snapshot ................................. file being recorded is static,"); qWarning(" only one frame will be recorded or tested"); - qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion"); - qWarning(" exitonfailure ............................ immediately exit the viewer on script failure"); - qWarning(" saveonexit ............................... save recording on viewer exit"); + qWarning(" exitoncomplete ........................... cleanly exit the launcher on script completion"); + qWarning(" exitonfailure ............................ immediately exit the launcher on script failure"); + qWarning(" saveonexit ............................... save recording on launcher exit"); qWarning(" "); qWarning(" One of record, play or both must be specified."); exit(1); @@ -197,7 +197,7 @@ int main(int argc, char ** argv) #endif QApplication app(argc, argv); - app.setApplicationName("QtQmlRuntime"); + app.setApplicationName("QtQmlLauncher"); app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); @@ -275,7 +275,7 @@ int main(int argc, char ** argv) if (lastArg) usage(); app.setStartDragDistance(QString(argv[++i]).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { - qWarning("Qt Qml Runtime version %s", QT_VERSION_STR); + qWarning("Qt QML Launcher version %s", QT_VERSION_STR); exit(0); } else if (arg == "-translation") { if (lastArg) usage(); diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 77a9533..847ed3a 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -37,5 +37,5 @@ symbian { } mac { QMAKE_INFO_PLIST=Info_mac.plist - TARGET=Qml + TARGET="QML Launcher" } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 911bf8c..9700090 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -350,7 +350,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) setupProxy(manager); if (cacheSize > 0) { QNetworkDiskCache *cache = new QNetworkDiskCache; - cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-duiviewer-network-cache")); + cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-launcher-network-cache")); cache->setMaximumCacheSize(cacheSize); manager->setCache(cache); } else { @@ -388,7 +388,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) , translator(0) { QDeclarativeViewer::registerTypes(); - setWindowTitle(tr("Qt Qml Runtime")); + setWindowTitle(tr("Qt QML Launcher")); devicemode = false; canvas = 0; @@ -887,7 +887,7 @@ bool QDeclarativeViewer::open(const QString& file_or_url) url = QUrl::fromLocalFile(fi.absoluteFilePath()); else url = QUrl(file_or_url); - setWindowTitle(tr("%1 - Qt Qml Runtime").arg(file_or_url)); + setWindowTitle(tr("%1 - Qt QML Launcher").arg(file_or_url)); if (!m_script.isEmpty()) tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); @@ -895,11 +895,11 @@ bool QDeclarativeViewer::open(const QString& file_or_url) delete canvas->rootObject(); canvas->engine()->clearComponentCache(); QDeclarativeContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("qmlViewer", this); + ctxt->setContextProperty("qmlLauncher", this); #ifdef Q_OS_SYMBIAN - ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone + ctxt->setContextProperty("qmlLauncherFolder", "E:\\"); // Documents on your S60 phone #else - ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); + ctxt->setContextProperty("qmlLauncherFolder", QDir::currentPath()); #endif ctxt->setContextProperty("runtime", Runtime::instance()); -- cgit v0.12 From 1f5ae3138ea4c436fe04d2c882d6debac5b061b8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 14 May 2010 16:24:27 +0200 Subject: Add new logo for QML Launcher (Mac OS X) --- tools/qml/Info_mac.plist | 2 ++ tools/qml/qml.icns | Bin 0 -> 196156 bytes tools/qml/qml.pro | 1 + 3 files changed, 3 insertions(+) create mode 100644 tools/qml/qml.icns diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist index ce4ebe3..80ca6a3 100644 --- a/tools/qml/Info_mac.plist +++ b/tools/qml/Info_mac.plist @@ -2,6 +2,8 @@ + CFBundleIconFile + @ICON@ CFBundleIdentifier com.nokia.qt.qml CFBundlePackageType diff --git a/tools/qml/qml.icns b/tools/qml/qml.icns new file mode 100644 index 0000000..c760516 Binary files /dev/null and b/tools/qml/qml.icns differ diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 847ed3a..6129639 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -38,4 +38,5 @@ symbian { mac { QMAKE_INFO_PLIST=Info_mac.plist TARGET="QML Launcher" + ICON=qml.icns } -- cgit v0.12 From f00a96efb66303a453f984e60a41120200b2c0c3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 May 2010 14:57:02 +0200 Subject: QtDeclarative doesn't use QtXml, so don't link to it or require others to --- src/declarative/declarative.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 4287e25..8037a16 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -1,13 +1,13 @@ TARGET = QtDeclarative QPRO_PWD = $$PWD -QT = core gui xml script network +QT = core gui script network contains(QT_CONFIG, svg): QT += svg contains(QT_CONFIG, opengl): QT += opengl DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 -unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml +unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui exists("qdeclarative_enable_gcov") { QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors -- cgit v0.12 From 25484ef9b55f0a017163a05228bb9b6b0e7a772d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 14 May 2010 18:04:39 +0200 Subject: More 4.7 stuff. --- dist/changes-4.7.0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 47992f9..1e3a69c 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -67,6 +67,9 @@ QtGui functions, and replaced them with setCopyCount(), copyCount() and supportsMultipleCopies(). + - QPrintDialog/QPrinter + * Added support for printing the current page. + - QCommonStyle * Fixed a bug that led to missing text pixels in QTabBar when using small font sizes. (QTBUG-7137) -- cgit v0.12 From 3849cd0cca618fac88a54861a3ec30780711ce75 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 14 May 2010 18:34:03 +0200 Subject: Update the dependencies in src.pro because we don't have a good buildsystem QtXml is not required by QtSvg, QtWebKit or QtDeclarative. And QtDeclarative doesn't link to QtWebKit anymore (imports do). But it does link to QtOpenGL. --- src/src.pro | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/src.pro b/src/src.pro index 9c4831c..3ceeb9c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -94,7 +94,7 @@ src_declarative.target = sub-declarative src_xml.depends = src_corelib src_xmlpatterns.depends = src_corelib src_network src_dbus.depends = src_corelib src_xml - src_svg.depends = src_xml src_gui + src_svg.depends = src_corelib src_gui src_script.depends = src_corelib src_scripttools.depends = src_script src_gui src_network src_network.depends = src_corelib @@ -110,15 +110,14 @@ src_declarative.target = sub-declarative contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl src_mediaservices.depends = src_multimedia src_tools_activeqt.depends = src_tools_idc src_gui - src_declarative.depends = src_xml src_gui src_script src_network src_svg + src_declarative.depends = src_gui src_script src_network src_plugins.depends = src_gui src_sql src_svg src_multimedia src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS src_imports.depends = src_gui src_declarative contains(QT_CONFIG, webkit) { - src_webkit.depends = src_gui src_sql src_network src_xml + src_webkit.depends = src_gui src_sql src_network contains(QT_CONFIG, mediaservices):src_webkit.depends += src_mediaservices contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns - contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit src_imports.depends += src_webkit exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } @@ -127,7 +126,18 @@ src_declarative.target = sub-declarative src_plugins.depends += src_dbus src_phonon.depends += src_dbus } - contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): src_plugins.depends += src_opengl + contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { + src_plugins.depends += src_opengl + src_declarative.depends += src_opengl + src_webkit.depends += src_opengl + } + contains(QT_CONFIG, xmlpatterns) { + src_declarative.depends += src_xmlpatterns + src_webkit.depends += src_xmlpatterns + } + contains(QT_CONFIG, svg) { + src_declarative.depends += src_svg + } } -- cgit v0.12 From c8d2e18c4b431870560f324a17f20904bb47ae68 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 14 May 2010 18:43:20 +0200 Subject: More improvements to pixmap cache key generation HexString is actually more optimal than fromRawData since we dont need any allocations while using it. Arguably the code is also a bit nicer. Task-number: QTBUG-9850 Reviewed-by: ogoffart --- src/gui/image/qicon.cpp | 26 ++++++++++---------------- src/gui/styles/qgtkpainter.cpp | 19 ++++++------------- src/gui/styles/qstylehelper.cpp | 30 +++++++++--------------------- src/gui/styles/qstylehelper_p.h | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 9f1eea2..7696632 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -55,6 +55,7 @@ #include "qcache.h" #include "qdebug.h" #include "private/qguiplatformplugin_p.h" +#include "private/qstylehelper_p.h" #ifdef Q_WS_MAC #include @@ -261,24 +262,17 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - int digits = sizeof(qint64)/sizeof(QChar); - quint64 tkey = pm.cacheKey(), - tmode = pe->mode, - tpalkey = QApplication::palette().cacheKey(), - twidth = actualSize.width(), - theight = actualSize.height(); - QString key = QLatin1Literal("qt_") - % QString::fromRawData((QChar*)&tkey, digits) - % QString::fromRawData((QChar*)&tmode, digits) - % QString::fromRawData((QChar*)&tpalkey, digits) - % QString::fromRawData((QChar*)&twidth, digits) - % QString::fromRawData((QChar*)&theight, digits); + % HexString(pm.cacheKey()) + % HexString(pe->mode) + % HexString(QApplication::palette().cacheKey()) + % HexString(actualSize.width()) + % HexString(actualSize.height()); if (mode == QIcon::Active) { - if (QPixmapCache::find(key + QString::number(mode), pm)) + if (QPixmapCache::find(key % HexString(mode), pm)) return pm; // horray - if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) { + if (QPixmapCache::find(key % HexString(QIcon::Normal), pm)) { QStyleOption opt(0); opt.palette = QApplication::palette(); QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); @@ -287,7 +281,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St } } - if (!QPixmapCache::find(key + QString::number(mode), pm)) { + if (!QPixmapCache::find(key % HexString(mode), pm)) { if (pm.size() != actualSize) pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (pe->mode != mode && mode != QIcon::Normal) { @@ -297,7 +291,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!generated.isNull()) pm = generated; } - QPixmapCache::insert(key + QString::number(mode), pm); + QPixmapCache::insert(key % HexString(mode), pm); } return pm; } diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index a6686e2..79c53e9 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -47,6 +47,7 @@ // This class is primarily a wrapper around the gtk painter functions // and takes care of converting all such calls into cached Qt pixmaps. +#include #include #include #include @@ -154,21 +155,13 @@ QGtkPainter::QGtkPainter(QPainter *_painter) static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, const QSize &size, GtkWidget *widget = 0) { - - int digits = sizeof(qint64)/sizeof(QChar); - quint64 tstate= state, - tshadow = shadow, - twidth = size.width(), - theight = size.height(), - twidget = quint64(widget); - // Note the widget arg should ideally use the widget path, though would compromise performance QString tmp = key - % QString::fromRawData((QChar*)&tstate, digits) - % QString::fromRawData((QChar*)&tshadow, digits) - % QString::fromRawData((QChar*)&twidth, digits) - % QString::fromRawData((QChar*)&theight, digits) - % QString::fromRawData((QChar*)&twidget, digits); + % HexString(state) + % HexString(shadow) + % HexString(size.width()) + % HexString(size.height()) + % HexString(quint64(widget)); return tmp; } diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 22f2014..d09d7fa 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -63,30 +63,18 @@ namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) { const QStyleOptionComplex *complexOption = qstyleoption_cast(option); - int digits = sizeof(qint64)/sizeof(QChar); - quint64 state = option->state, - direction = option->direction, - subcontrols = (complexOption ? uint(complexOption->activeSubControls) : 0u), - palettekey = option->palette.cacheKey(), - width = size.width(), - height = size.height(); - - QString tmp = key % QString::fromRawData((QChar*)&state, digits) - % QString::fromRawData((QChar*)&direction, digits) - % QString::fromRawData((QChar*)&subcontrols, digits) - % QString::fromRawData((QChar*)&palettekey, digits) - % QString::fromRawData((QChar*)&width, digits) - % QString::fromRawData((QChar*)&height, digits); + QString tmp = key % HexString(option->state) + % HexString(option->direction) + % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) + % HexString(option->palette.cacheKey()) + % HexString(size.width()) + % HexString(size.height()); #ifndef QT_NO_SPINBOX if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - quint64 buttonsymbols = spinBox->buttonSymbols, - stepEnabled = spinBox->stepEnabled, - frame = spinBox->frame; - - tmp = tmp % QString::fromRawData((QChar*)&buttonsymbols, digits) - % QString::fromRawData((QChar*)&stepEnabled, digits) - % QString::fromRawData((QChar*)&frame, digits); + tmp = tmp % HexString(spinBox->buttonSymbols) + % HexString(spinBox->stepEnabled) + % QLatin1Char(spinBox->frame ? '1' : '0'); ; } #endif // QT_NO_SPINBOX return tmp; diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 31cc4ed..555ad60 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -41,6 +41,7 @@ #include #include +#include #include #ifndef QSTYLEHELPER_P_H @@ -79,6 +80,37 @@ namespace QStyleHelper int bottom = 0); } +// internal helper. Converts an integer value to an unique string token +template + struct HexString +{ + inline HexString(const T t) + : val(t) + {} + + inline void write(QChar *&dest) const + { + const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + const char *c = reinterpret_cast(&val); + for (uint i = 0; i < sizeof(T); ++i) { + *dest++ = hexChars[*c & 0xf]; + *dest++ = hexChars[(*c & 0xf0) >> 4]; + ++c; + } + } + const T val; +}; + +// specialization to enable fast concatenating of our string tokens to a string +template + struct QConcatenable > +{ + typedef HexString type; + enum { ExactSize = true }; + static int size(const HexString &str) { return sizeof(str.val) * 2; } + static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } +}; + QT_END_NAMESPACE #endif // QSTYLEHELPER_P_H -- cgit v0.12 From 77ddabd7fdf0c8ba2e15951e83abbcce18270285 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 14 May 2010 20:06:15 +0200 Subject: Revert "Optimize QPixmapIconEngine's pixmap() function" This reverts commit ad6dafee9be288bcef6b2c4b318b234d2995abff. This is replaced by commit c8d2e18c4b431870560f324a17f20904bb47ae68 --- src/gui/image/qicon.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 5ef0ff9..891b1db 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -261,28 +261,21 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - struct { - quint64 pmc; - qint32 w; - qint32 h; - quint64 pac; - qint32 m; // Make struct size a multiple of 4, for safety's sake - } dill; - - dill.pmc = pm.cacheKey(); - dill.w = actualSize.width(); - dill.h = actualSize.height(); - dill.pac = QApplication::palette().cacheKey(); - dill.m = pe->mode; - - QString keyBase = QLatin1String("$qt_icon_") - + QString::fromRawData((QChar *)&dill, sizeof(dill)/sizeof(QChar)); - QString key = keyBase + QString::number(mode, 16); + QString key = QLatin1String("$qt_icon_") + + QString::number(pm.cacheKey()) + + QString::number(pe->mode) + + QString::number(QApplication::palette().cacheKey()) + + QLatin1Char('_') + + QString::number(actualSize.width()) + + QLatin1Char('_') + + QString::number(actualSize.height()) + + QLatin1Char('_'); + if (mode == QIcon::Active) { - if (QPixmapCache::find(key, pm)) + if (QPixmapCache::find(key + QString::number(mode), pm)) return pm; // horray - if (QPixmapCache::find(keyBase + QString::number(QIcon::Normal, 16), pm)) { + if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) { QStyleOption opt(0); opt.palette = QApplication::palette(); QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); @@ -291,7 +284,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St } } - if (!QPixmapCache::find(key, pm)) { + if (!QPixmapCache::find(key + QString::number(mode), pm)) { if (pm.size() != actualSize) pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (pe->mode != mode && mode != QIcon::Normal) { @@ -301,7 +294,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!generated.isNull()) pm = generated; } - QPixmapCache::insert(key, pm); + QPixmapCache::insert(key + QString::number(mode), pm); } return pm; } -- cgit v0.12 From b0f4dab4c825650c3a7a72b87508bf6f3e5ffd50 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 14 May 2010 23:47:37 +0200 Subject: Revert "More improvements to pixmap cache key generation" This reverts commit c8d2e18c4b431870560f324a17f20904bb47ae68. --- src/gui/image/qicon.cpp | 26 ++++++++++++++++---------- src/gui/styles/qgtkpainter.cpp | 19 +++++++++++++------ src/gui/styles/qstylehelper.cpp | 30 +++++++++++++++++++++--------- src/gui/styles/qstylehelper_p.h | 32 -------------------------------- 4 files changed, 50 insertions(+), 57 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 7696632..9f1eea2 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -55,7 +55,6 @@ #include "qcache.h" #include "qdebug.h" #include "private/qguiplatformplugin_p.h" -#include "private/qstylehelper_p.h" #ifdef Q_WS_MAC #include @@ -262,17 +261,24 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); + int digits = sizeof(qint64)/sizeof(QChar); + quint64 tkey = pm.cacheKey(), + tmode = pe->mode, + tpalkey = QApplication::palette().cacheKey(), + twidth = actualSize.width(), + theight = actualSize.height(); + QString key = QLatin1Literal("qt_") - % HexString(pm.cacheKey()) - % HexString(pe->mode) - % HexString(QApplication::palette().cacheKey()) - % HexString(actualSize.width()) - % HexString(actualSize.height()); + % QString::fromRawData((QChar*)&tkey, digits) + % QString::fromRawData((QChar*)&tmode, digits) + % QString::fromRawData((QChar*)&tpalkey, digits) + % QString::fromRawData((QChar*)&twidth, digits) + % QString::fromRawData((QChar*)&theight, digits); if (mode == QIcon::Active) { - if (QPixmapCache::find(key % HexString(mode), pm)) + if (QPixmapCache::find(key + QString::number(mode), pm)) return pm; // horray - if (QPixmapCache::find(key % HexString(QIcon::Normal), pm)) { + if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) { QStyleOption opt(0); opt.palette = QApplication::palette(); QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); @@ -281,7 +287,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St } } - if (!QPixmapCache::find(key % HexString(mode), pm)) { + if (!QPixmapCache::find(key + QString::number(mode), pm)) { if (pm.size() != actualSize) pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (pe->mode != mode && mode != QIcon::Normal) { @@ -291,7 +297,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!generated.isNull()) pm = generated; } - QPixmapCache::insert(key % HexString(mode), pm); + QPixmapCache::insert(key + QString::number(mode), pm); } return pm; } diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index 79c53e9..a6686e2 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -47,7 +47,6 @@ // This class is primarily a wrapper around the gtk painter functions // and takes care of converting all such calls into cached Qt pixmaps. -#include #include #include #include @@ -155,13 +154,21 @@ QGtkPainter::QGtkPainter(QPainter *_painter) static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, const QSize &size, GtkWidget *widget = 0) { + + int digits = sizeof(qint64)/sizeof(QChar); + quint64 tstate= state, + tshadow = shadow, + twidth = size.width(), + theight = size.height(), + twidget = quint64(widget); + // Note the widget arg should ideally use the widget path, though would compromise performance QString tmp = key - % HexString(state) - % HexString(shadow) - % HexString(size.width()) - % HexString(size.height()) - % HexString(quint64(widget)); + % QString::fromRawData((QChar*)&tstate, digits) + % QString::fromRawData((QChar*)&tshadow, digits) + % QString::fromRawData((QChar*)&twidth, digits) + % QString::fromRawData((QChar*)&theight, digits) + % QString::fromRawData((QChar*)&twidget, digits); return tmp; } diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index d09d7fa..22f2014 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -63,18 +63,30 @@ namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) { const QStyleOptionComplex *complexOption = qstyleoption_cast(option); - QString tmp = key % HexString(option->state) - % HexString(option->direction) - % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) - % HexString(option->palette.cacheKey()) - % HexString(size.width()) - % HexString(size.height()); + int digits = sizeof(qint64)/sizeof(QChar); + quint64 state = option->state, + direction = option->direction, + subcontrols = (complexOption ? uint(complexOption->activeSubControls) : 0u), + palettekey = option->palette.cacheKey(), + width = size.width(), + height = size.height(); + + QString tmp = key % QString::fromRawData((QChar*)&state, digits) + % QString::fromRawData((QChar*)&direction, digits) + % QString::fromRawData((QChar*)&subcontrols, digits) + % QString::fromRawData((QChar*)&palettekey, digits) + % QString::fromRawData((QChar*)&width, digits) + % QString::fromRawData((QChar*)&height, digits); #ifndef QT_NO_SPINBOX if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - tmp = tmp % HexString(spinBox->buttonSymbols) - % HexString(spinBox->stepEnabled) - % QLatin1Char(spinBox->frame ? '1' : '0'); ; + quint64 buttonsymbols = spinBox->buttonSymbols, + stepEnabled = spinBox->stepEnabled, + frame = spinBox->frame; + + tmp = tmp % QString::fromRawData((QChar*)&buttonsymbols, digits) + % QString::fromRawData((QChar*)&stepEnabled, digits) + % QString::fromRawData((QChar*)&frame, digits); } #endif // QT_NO_SPINBOX return tmp; diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 555ad60..31cc4ed 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -41,7 +41,6 @@ #include #include -#include #include #ifndef QSTYLEHELPER_P_H @@ -80,37 +79,6 @@ namespace QStyleHelper int bottom = 0); } -// internal helper. Converts an integer value to an unique string token -template - struct HexString -{ - inline HexString(const T t) - : val(t) - {} - - inline void write(QChar *&dest) const - { - const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - const char *c = reinterpret_cast(&val); - for (uint i = 0; i < sizeof(T); ++i) { - *dest++ = hexChars[*c & 0xf]; - *dest++ = hexChars[(*c & 0xf0) >> 4]; - ++c; - } - } - const T val; -}; - -// specialization to enable fast concatenating of our string tokens to a string -template - struct QConcatenable > -{ - typedef HexString type; - enum { ExactSize = true }; - static int size(const HexString &str) { return sizeof(str.val) * 2; } - static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } -}; - QT_END_NAMESPACE #endif // QSTYLEHELPER_P_H -- cgit v0.12 From b1749e9052c68dff6089bf5f0d2a41cd88dfcb50 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 15 May 2010 11:39:26 +0200 Subject: Revert "Optimized pixmapcache key generation for icons and styles" This reverts commit b8f1d7fd87985375a373ca85052c475241822b03. --- src/gui/image/qicon.cpp | 23 ++++++------- src/gui/styles/qgtkpainter.cpp | 16 ++------- src/gui/styles/qstylehelper.cpp | 74 +++++++++++++++++++++++++++++------------ 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 9f1eea2..891b1db 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -261,19 +261,16 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - int digits = sizeof(qint64)/sizeof(QChar); - quint64 tkey = pm.cacheKey(), - tmode = pe->mode, - tpalkey = QApplication::palette().cacheKey(), - twidth = actualSize.width(), - theight = actualSize.height(); - - QString key = QLatin1Literal("qt_") - % QString::fromRawData((QChar*)&tkey, digits) - % QString::fromRawData((QChar*)&tmode, digits) - % QString::fromRawData((QChar*)&tpalkey, digits) - % QString::fromRawData((QChar*)&twidth, digits) - % QString::fromRawData((QChar*)&theight, digits); + QString key = QLatin1String("$qt_icon_") + + QString::number(pm.cacheKey()) + + QString::number(pe->mode) + + QString::number(QApplication::palette().cacheKey()) + + QLatin1Char('_') + + QString::number(actualSize.width()) + + QLatin1Char('_') + + QString::number(actualSize.height()) + + QLatin1Char('_'); + if (mode == QIcon::Active) { if (QPixmapCache::find(key + QString::number(mode), pm)) diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index a6686e2..1f68f2f 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -154,21 +154,9 @@ QGtkPainter::QGtkPainter(QPainter *_painter) static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, const QSize &size, GtkWidget *widget = 0) { - - int digits = sizeof(qint64)/sizeof(QChar); - quint64 tstate= state, - tshadow = shadow, - twidth = size.width(), - theight = size.height(), - twidget = quint64(widget); - // Note the widget arg should ideally use the widget path, though would compromise performance - QString tmp = key - % QString::fromRawData((QChar*)&tstate, digits) - % QString::fromRawData((QChar*)&tshadow, digits) - % QString::fromRawData((QChar*)&twidth, digits) - % QString::fromRawData((QChar*)&theight, digits) - % QString::fromRawData((QChar*)&twidget, digits); + QString tmp = QString(QLS("%0-%1-%2-%3x%4-%5")).arg(key).arg(uint(state)).arg(shadow) + .arg(size.width()).arg(size.height()).arg(quintptr(widget)); return tmp; } diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 22f2014..296c51c 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -58,35 +58,67 @@ QT_BEGIN_NAMESPACE +// internal helper. Converts an integer value to an unique string token +template +struct HexString +{ + inline HexString(const T t) + : val(t) + {} + + inline void write(QChar *&dest) const + { + const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + const char *c = reinterpret_cast(&val); + for (uint i = 0; i < sizeof(T); ++i) { + *dest++ = hexChars[*c & 0xf]; + *dest++ = hexChars[(*c & 0xf0) >> 4]; + ++c; + } + } + + const T val; +}; + +// specialization to enable fast concatenating of our string tokens to a string +template +struct QConcatenable > +{ + typedef HexString type; + enum { ExactSize = true }; + static int size(const HexString &str) { return sizeof(str.val) * 2; } + static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } +}; + namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) { const QStyleOptionComplex *complexOption = qstyleoption_cast(option); - int digits = sizeof(qint64)/sizeof(QChar); - quint64 state = option->state, - direction = option->direction, - subcontrols = (complexOption ? uint(complexOption->activeSubControls) : 0u), - palettekey = option->palette.cacheKey(), - width = size.width(), - height = size.height(); - - QString tmp = key % QString::fromRawData((QChar*)&state, digits) - % QString::fromRawData((QChar*)&direction, digits) - % QString::fromRawData((QChar*)&subcontrols, digits) - % QString::fromRawData((QChar*)&palettekey, digits) - % QString::fromRawData((QChar*)&width, digits) - % QString::fromRawData((QChar*)&height, digits); + + QString tmp = key + % QLatin1Char('-') + % HexString(option->state) + % QLatin1Char('-') + % HexString(option->direction) + % QLatin1Char('-') + % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) + % QLatin1Char('-') + % HexString(option->palette.cacheKey()) + % QLatin1Char('-') + % HexString(size.width()) + % QLatin1Char('x') + % HexString(size.height()); #ifndef QT_NO_SPINBOX if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - quint64 buttonsymbols = spinBox->buttonSymbols, - stepEnabled = spinBox->stepEnabled, - frame = spinBox->frame; - - tmp = tmp % QString::fromRawData((QChar*)&buttonsymbols, digits) - % QString::fromRawData((QChar*)&stepEnabled, digits) - % QString::fromRawData((QChar*)&frame, digits); + tmp = tmp + % QLatin1Char('-') + % HexString(spinBox->buttonSymbols) + % QLatin1Char('-') + % HexString(spinBox->stepEnabled) + % QLatin1Char('-') + % QLatin1Char(spinBox->frame ? '1' : '0'); } #endif // QT_NO_SPINBOX return tmp; -- cgit v0.12 From fea180d80112faa1a314e240ab07c37e4c2e0d1d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 May 2010 17:04:31 +0200 Subject: Autotest: some improvements to timeout testing of tst_QTcpSocket --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index cd512a1..d195d3c 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -144,6 +144,7 @@ private slots: void blockingIMAP(); void nonBlockingIMAP(); void hostNotFound(); + void timeoutConnect_data(); void timeoutConnect(); void delayedClose(); void partialRead(); @@ -544,19 +545,36 @@ void tst_QTcpSocket::hostNotFound() } //---------------------------------------------------------------------------------- +void tst_QTcpSocket::timeoutConnect_data() +{ + QTest::addColumn("address"); + QTest::newRow("host") << QtNetworkSettings::serverName(); + QTest::newRow("ip") << QtNetworkSettings::serverIP(); +} void tst_QTcpSocket::timeoutConnect() { + QFETCH(QString, address); QTcpSocket *socket = newSocket(); - // Outgoing port 53 is firewalled in the Oslo office. - socket->connectToHost("cisco.com", 53); + QElapsedTimer timer; + timer.start(); + + // Port 1357 is configured to drop packets on the test server + socket->connectToHost(address, 1357); + QVERIFY(timer.elapsed() < 50); QVERIFY(!socket->waitForConnected(200)); QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); QCOMPARE(int(socket->error()), int(QTcpSocket::SocketTimeoutError)); - socket->connectToHost("cisco.com", 53); - QTest::qSleep(50); + timer.start(); + socket->connectToHost(address, 1357); + QVERIFY(timer.elapsed() < 50); + QTimer::singleShot(50, &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(socket->state() == QTcpSocket::ConnectingState + || socket->state() == QTcpSocket::HostLookupState); socket->abort(); QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); QCOMPARE(socket->openMode(), QIODevice::NotOpen); -- cgit v0.12 From f8788e4202e51fb36b3dcb4a80c83e16ff389150 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 15 May 2010 18:36:56 +0200 Subject: Fix building of tst_QTcpSocket --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index d195d3c..31cae40 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -549,7 +549,7 @@ void tst_QTcpSocket::timeoutConnect_data() { QTest::addColumn("address"); QTest::newRow("host") << QtNetworkSettings::serverName(); - QTest::newRow("ip") << QtNetworkSettings::serverIP(); + QTest::newRow("ip") << QtNetworkSettings::serverIP().toString(); } void tst_QTcpSocket::timeoutConnect() @@ -571,7 +571,7 @@ void tst_QTcpSocket::timeoutConnect() socket->connectToHost(address, 1357); QVERIFY(timer.elapsed() < 50); QTimer::singleShot(50, &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::enterLoop(5); + QTestEventLoop::instance().enterLoop(5); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(socket->state() == QTcpSocket::ConnectingState || socket->state() == QTcpSocket::HostLookupState); -- cgit v0.12 From 2e3d004ba736f5c77614feeaf3594217217bd29e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 15 May 2010 23:53:16 +0200 Subject: tst_bic: Fix building on Mac 64 --- tests/auto/bic/tst_bic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index 010965c..400fcc1 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -191,7 +191,7 @@ void tst_Bic::sizesAndVTables_data() #elif defined Q_OS_MAC && defined(__i386__) # define FILESUFFIX "macx-gcc-ia32" #elif defined Q_OS_MAC && defined(__amd64__) -# define FILESUFFIX "macx-gcc-amd64"; +# define FILESUFFIX "macx-gcc-amd64" #elif defined Q_OS_WIN && defined Q_CC_GNU # define FILESUFFIX "win32-gcc-ia32" #else -- cgit v0.12 From e9a59ff4f650d878fd79fed1f605f3f4e9120d35 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 14 May 2010 19:04:40 +0200 Subject: Use case-insensitive comparison for the "data" scheme in URLs --- src/gui/text/qtextdocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index afba678..c7a9756 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1947,7 +1947,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) #endif // handle data: URLs - if (r.isNull() && name.scheme() == QLatin1String("data")) + if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0) r = qDecodeDataUrl(name).second; // if resource was not loaded try to load it here -- cgit v0.12 -- cgit v0.12