diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/fx/qfxpixmapcache.cpp | 22 | ||||
-rw-r--r-- | src/declarative/fx/qfxpixmapcache.h | 4 | ||||
-rw-r--r-- | src/declarative/fx/qfxwebview.cpp | 14 | ||||
-rw-r--r-- | src/declarative/fx/qfxwebview.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 2 |
7 files changed, 39 insertions, 9 deletions
diff --git a/src/declarative/fx/qfxpixmapcache.cpp b/src/declarative/fx/qfxpixmapcache.cpp index 7fc713b..0cc09cd 100644 --- a/src/declarative/fx/qfxpixmapcache.cpp +++ b/src/declarative/fx/qfxpixmapcache.cpp @@ -63,6 +63,7 @@ public: reply->deleteLater(); } QNetworkReply *reply; + QPixmap pixmap; // ensure reference to pixmap to QPixmapCache does not discard int refCount; void addRef() @@ -169,6 +170,9 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) qWarning() << "Format error loading" << url; *pixmap = QPixmap(); ok = false; + } else { + if ((*iter)->refCount > 1) + (*iter)->pixmap = *pixmap; } (*iter)->release(); } @@ -176,6 +180,15 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) QPixmapCache::insert(key, *pixmap); } else { ok = !pixmap->isNull(); +#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML + if (url.scheme()!=QLatin1String("file")) +#endif + // We may be the second finder. Still need to check for active replies. + { + QFxSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + if (iter != qfxActiveNetworkReplies.end()) + (*iter)->release(); + } } return ok; } @@ -246,4 +259,13 @@ void QFxPixmapCache::cancelGet(const QUrl& url, QObject* obj) (*iter)->release(); } +/*! + This function is mainly for test verification. It returns the number of + requests that are still unfinished. +*/ +int QFxPixmapCache::pendingRequests() +{ + return qfxActiveNetworkReplies.count(); +} + QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxpixmapcache.h b/src/declarative/fx/qfxpixmapcache.h index ca5d47b..fb5b88a 100644 --- a/src/declarative/fx/qfxpixmapcache.h +++ b/src/declarative/fx/qfxpixmapcache.h @@ -60,7 +60,9 @@ public: static QNetworkReply *get(QmlEngine *, const QUrl& url, QPixmap *pixmap); static void cancelGet(const QUrl& url, QObject* obj); - static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QFxPixmapCache::get, and finished. Or must be a local file. + static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QFxPixmapCache::get, and any returned reply finished. + + static int pendingRequests(); // mainly for test verification }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 7247837..04a4eef 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -325,6 +325,12 @@ QUrl QFxWebView::url() const void QFxWebView::setUrl(const QUrl &url) { + if (url.isEmpty()) { + // Make absolute. + setUrl(QUrl("about:blank")); + return; + } + Q_D(QFxWebView); if (url == page()->mainFrame()->url()) return; @@ -333,7 +339,7 @@ void QFxWebView::setUrl(const QUrl &url) d->idealwidth>0 ? d->idealwidth : width(), d->idealheight>0 ? d->idealheight : height())); - Q_ASSERT(url.isEmpty() || !url.isRelative()); + Q_ASSERT(!url.isRelative()); if (isComponentComplete()) page()->mainFrame()->load(url); @@ -1174,15 +1180,15 @@ private: QFxWebView *webview; }; -QFxWebView *QFxWebPage::view() +QFxWebView *QFxWebPage::viewItem() { return static_cast<QFxWebView*>(parent()); } QObject *QFxWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { - QUrl comp = qmlContext(view())->resolvedUrl(url); - return new QWidget_Dummy_Plugin(comp,view(),paramNames,paramValues); + QUrl comp = qmlContext(viewItem())->resolvedUrl(url); + return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index b1709e9..9bd2afd 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -70,7 +70,7 @@ public: protected: QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); private: - QFxWebView *view(); + QFxWebView *viewItem(); }; diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index bbcc64d..4f96d12 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -365,7 +365,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, case QVariant::Url: { instr.type = QmlInstruction::StoreUrl; - QUrl u = output->url.resolved(QUrl(string)); + QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string)); instr.storeUrl.propertyIndex = prop.propertyIndex(); instr.storeUrl.value = output->indexForString(u.toString()); } diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 9e1deb0..c844a32 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -355,7 +355,7 @@ void QmlComponent::loadUrl(const QUrl &url) d->clear(); - if (url.isRelative()) + if (url.isRelative() && !url.isEmpty()) d->url = d->engine->baseUrl().resolved(url); else d->url = url; diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 61850c3..97ab375 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -422,7 +422,7 @@ void QmlContext::setContextProperty(const QString &name, QObject *value) QUrl QmlContext::resolvedUrl(const QUrl &src) { QmlContext *ctxt = this; - if (src.isRelative()) { + if (src.isRelative() && !src.isEmpty()) { if (ctxt) { while(ctxt) { if(ctxt->d_func()->url.isValid()) |