|
|
|
@ -96,14 +96,14 @@ struct Cache::Private {
|
|
|
|
|
* If it can't find one, it will create a new one and return it.
|
|
|
|
|
*/
|
|
|
|
|
ImageData::Ptr getOrCreateImageData(const KURL& url, const TQDateTime& timestamp) {
|
|
|
|
|
if (mImages.tqcontains(url)) {
|
|
|
|
|
if (mImages.contains(url)) {
|
|
|
|
|
ImageData::Ptr data = mImages[url];
|
|
|
|
|
if (data->timestamp == timestamp) return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImageData::Ptr data = new ImageData(url, timestamp);
|
|
|
|
|
mImages[url] = data;
|
|
|
|
|
if (mPriorityURLs.tqcontains(url)) data->priority = true;
|
|
|
|
|
if (mPriorityURLs.contains(url)) data->priority = true;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -144,12 +144,12 @@ Cache* Cache::instance() {
|
|
|
|
|
void Cache::setPriorityURL( const KURL& url, bool set ) {
|
|
|
|
|
if( set ) {
|
|
|
|
|
d->mPriorityURLs.append( url );
|
|
|
|
|
if( d->mImages.tqcontains( url )) {
|
|
|
|
|
if( d->mImages.contains( url )) {
|
|
|
|
|
d->mImages[ url ]->priority = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
d->mPriorityURLs.remove( url );
|
|
|
|
|
if( d->mImages.tqcontains( url )) {
|
|
|
|
|
if( d->mImages.contains( url )) {
|
|
|
|
|
d->mImages[ url ]->priority = false;
|
|
|
|
|
}
|
|
|
|
|
checkMaxSize();
|
|
|
|
@ -185,13 +185,13 @@ void Cache::tqinvalidate( const KURL& url ) {
|
|
|
|
|
|
|
|
|
|
TQDateTime Cache::timestamp( const KURL& url ) const {
|
|
|
|
|
LOG(url.prettyURL());
|
|
|
|
|
if( d->mImages.tqcontains( url )) return d->mImages[ url ]->timestamp;
|
|
|
|
|
if( d->mImages.contains( url )) return d->mImages[ url ]->timestamp;
|
|
|
|
|
return TQDateTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQByteArray Cache::file( const KURL& url ) const {
|
|
|
|
|
LOG(url.prettyURL());
|
|
|
|
|
if( d->mImages.tqcontains( url )) {
|
|
|
|
|
if( d->mImages.contains( url )) {
|
|
|
|
|
const ImageData::Ptr data = d->mImages[ url ];
|
|
|
|
|
if( data->file.isNull()) return TQByteArray();
|
|
|
|
|
data->age = 0;
|
|
|
|
@ -206,7 +206,7 @@ void Cache::getFrames( const KURL& url, ImageFrames* frames, TQCString* format )
|
|
|
|
|
Q_ASSERT(format);
|
|
|
|
|
frames->clear();
|
|
|
|
|
*format = TQCString();
|
|
|
|
|
if( d->mImages.tqcontains( url )) {
|
|
|
|
|
if( d->mImages.contains( url )) {
|
|
|
|
|
const ImageData::Ptr data = d->mImages[ url ];
|
|
|
|
|
if( data->frames.isEmpty()) return;
|
|
|
|
|
*frames = data->frames;
|
|
|
|
@ -216,7 +216,7 @@ void Cache::getFrames( const KURL& url, ImageFrames* frames, TQCString* format )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQPixmap Cache::thumbnail( const KURL& url, TQSize& imagesize ) const {
|
|
|
|
|
if( d->mImages.tqcontains( url )) {
|
|
|
|
|
if( d->mImages.contains( url )) {
|
|
|
|
|
const ImageData::Ptr data = d->mImages[ url ];
|
|
|
|
|
if( data->thumbnail.isNull()) return TQPixmap();
|
|
|
|
|
imagesize = data->imagesize;
|
|
|
|
|