diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-06-23 01:26:47 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-06-23 01:26:47 (GMT) |
commit | a661bbf81258f73bc8734302f69a5b6e3ca5e317 (patch) | |
tree | 5ed76e6c4163b01b2c7a5c2b665f295c7f64ce3f /src/declarative/fx/qfxwebview.cpp | |
parent | c7fcd4b772092cf0764cfd97463c3aa3d7cc9e9f (diff) | |
download | Qt-a661bbf81258f73bc8734302f69a5b6e3ca5e317.zip Qt-a661bbf81258f73bc8734302f69a5b6e3ca5e317.tar.gz Qt-a661bbf81258f73bc8734302f69a5b6e3ca5e317.tar.bz2 |
Move cacheSize property to QFxPaintedItem from QFxWebView.
Was missed in the refactoring.
Diffstat (limited to 'src/declarative/fx/qfxwebview.cpp')
-rw-r--r-- | src/declarative/fx/qfxwebview.cpp | 84 |
1 files changed, 3 insertions, 81 deletions
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index d5dc874..adb33e8 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -150,47 +150,17 @@ class QFxWebViewPrivate : public QFxPaintedItemPrivate public: QFxWebViewPrivate() : QFxPaintedItemPrivate(), page(0), idealwidth(0), idealheight(0), interactive(true), lastPress(0), lastRelease(0), mouseX(0), mouseY(0), - max_imagecache_size(100000), progress(1.0), pending(PendingNone) + progress(1.0), pending(PendingNone) { } QWebPage *page; - struct ImageCacheItem { - ImageCacheItem() : age(0) {} - ~ImageCacheItem() { } - int age; - QRect area; -#if defined(QFX_RENDER_QPAINTER) - QPixmap image; -#else - GLTexture image; -#endif - }; - QList<ImageCacheItem*> imagecache; - void dirtyCache(const QRect& dirt) - { - for (int i=0; i<imagecache.count(); ) { - if (imagecache[i]->area.intersects(dirt)) { - imagecache.removeAt(i); - } else { - ++i; - } - } - } - void clearCache() - { - foreach (ImageCacheItem* i, imagecache) - delete i; - imagecache.clear(); - } - int idealwidth; int idealheight; bool interactive; QMouseEvent *lastPress, *lastRelease; int mouseX, mouseY; - int max_imagecache_size; qreal progress; QBasicTimer dcTimer; QString statusBarMessage; @@ -460,9 +430,8 @@ void QFxWebView::setInteractive(bool i) void QFxWebView::updateCacheForVisibility() { - Q_D(QFxWebView); if (!isVisible()) - d->clearCache(); + clearCache(); } void QFxWebView::expandToWebPage() @@ -479,7 +448,7 @@ void QFxWebView::expandToWebPage() cs.setHeight(height()); if (cs != page()->viewportSize()) { page()->setViewportSize(cs); - d->clearCache(); + clearCache(); setImplicitWidth(cs.width()); setImplicitHeight(cs.height()); } @@ -502,53 +471,6 @@ void QFxWebView::paintPage(const QRect& r) update(); } -/*! - \qmlproperty int WebView::cacheSize - - This property holds the maximum number of pixels of image cache to - allow. The default is 0.1 megapixels. The cache will not be larger - than the (unscaled) size of the WebView. -*/ - -/*! - \property QFxWebView::cacheSize - - The maximum number of pixels of image cache to allow. The default - is 0.1 megapixels. The cache will not be larger than the (unscaled) - size of the QFxWebView. -*/ -int QFxWebView::cacheSize() const -{ - Q_D(const QFxWebView); - return d->max_imagecache_size; -} - -void QFxWebView::setCacheSize(int pixels) -{ - Q_D(QFxWebView); - if (pixels < d->max_imagecache_size) { - int cachesize=0; - for (int i=0; i<d->imagecache.count(); ++i) { - QRect area = d->imagecache[i]->area; - cachesize += area.width()*area.height(); - } - while (d->imagecache.count() && cachesize > pixels) { - int oldest=-1; - int age=-1; - for (int i=0; i<d->imagecache.count(); ++i) { - int a = d->imagecache[i]->age; - if (a > age) { - oldest = i; - age = a; - } - } - cachesize -= d->imagecache[oldest]->area.width()*d->imagecache[oldest]->area.height(); - d->imagecache.removeAt(oldest); - } - } - d->max_imagecache_size = pixels; -} - void QFxWebView::dump(int depth) { QByteArray ba(depth * 4, ' '); |