20 #include <QAbstractNetworkCache>
24 QCache<QUrl, QImage> QgsTileCache::sTileCache( 256 );
25 QMutex QgsTileCache::sTileCacheMutex;
30 const QMutexLocker locker( &sTileCacheMutex );
31 sTileCache.insert( url,
new QImage( image ) );
36 QNetworkRequest req( url );
39 const QUrl adjUrl = req.url();
41 const QMutexLocker locker( &sTileCacheMutex );
43 if ( QImage *i = sTileCache.object( adjUrl ) )
52 const QByteArray imageData = data->readAll();
55 image = QImage::fromData( imageData );
59 if ( ! image.isNull( ) )
61 sTileCache.insert( adjUrl,
new QImage( image ) );
71 const QMutexLocker locker( &sTileCacheMutex );
72 return sTileCache.totalCost();
77 const QMutexLocker locker( &sTileCacheMutex );
78 return sTileCache.maxCost();