summaryrefslogtreecommitdiffstats
path: root/src/gvcore/cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gvcore/cache.cpp')
-rw-r--r--src/gvcore/cache.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/src/gvcore/cache.cpp b/src/gvcore/cache.cpp
index 99ab9fc..ccebb47 100644
--- a/src/gvcore/cache.cpp
+++ b/src/gvcore/cache.cpp
@@ -21,7 +21,7 @@ Copyright 2000-2004 Aurélien Gâteau
#include "cache.h"
-// Qt
+// TQt
// KDE
#include <kconfig.h>
@@ -52,24 +52,24 @@ const char CONFIG_CACHE_MAXSIZE[]="maxSize";
struct ImageData : public KShared {
- ImageData( const KURL& url, const QDateTime& _timestamp )
+ ImageData( const KURL& url, const TQDateTime& _timestamp )
: timestamp(_timestamp)
, age(0)
, fast_url( url.isLocalFile() && !KIO::probably_slow_mounted( url.path()))
, priority( false ) {
}
- void addFile( const QByteArray& file );
- void addImage( const ImageFrames& frames, const QCString& format );
- void addThumbnail( const QPixmap& thumbnail, QSize imagesize );
+ void addFile( const TQByteArray& file );
+ void addImage( const ImageFrames& frames, const TQCString& format );
+ void addThumbnail( const TQPixmap& thumbnail, TQSize imagesize );
long long cost() const;
int size() const;
- QByteArray file;
+ TQByteArray file;
ImageFrames frames;
- QPixmap thumbnail;
- QSize imagesize;
- QCString format;
- QDateTime timestamp;
+ TQPixmap thumbnail;
+ TQSize imagesize;
+ TQCString format;
+ TQDateTime timestamp;
mutable int age;
bool fast_url;
bool priority;
@@ -82,28 +82,28 @@ struct ImageData : public KShared {
typedef KSharedPtr<ImageData> Ptr;
};
-typedef QMap<KURL, ImageData::Ptr> ImageMap;
+typedef TQMap<KURL, ImageData::Ptr> ImageMap;
struct Cache::Private {
ImageMap mImages;
int mMaxSize;
int mThumbnailSize;
- QValueList< KURL > mPriorityURLs;
+ TQValueList< KURL > mPriorityURLs;
/**
* This function tries to returns a valid ImageData for url and timestamp.
* If it can't find one, it will create a new one and return it.
*/
- ImageData::Ptr getOrCreateImageData(const KURL& url, const QDateTime& timestamp) {
- if (mImages.contains(url)) {
+ ImageData::Ptr getOrCreateImageData(const KURL& url, const TQDateTime& timestamp) {
+ if (mImages.tqcontains(url)) {
ImageData::Ptr data = mImages[url];
if (data->timestamp == timestamp) return data;
}
ImageData::Ptr data = new ImageData(url, timestamp);
mImages[url] = data;
- if (mPriorityURLs.contains(url)) data->priority = true;
+ if (mPriorityURLs.tqcontains(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.contains( url )) {
+ if( d->mImages.tqcontains( url )) {
d->mImages[ url ]->priority = true;
}
} else {
d->mPriorityURLs.remove( url );
- if( d->mImages.contains( url )) {
+ if( d->mImages.tqcontains( url )) {
d->mImages[ url ]->priority = false;
}
checkMaxSize();
@@ -157,21 +157,21 @@ void Cache::setPriorityURL( const KURL& url, bool set ) {
}
-void Cache::addFile( const KURL& url, const QByteArray& file, const QDateTime& timestamp ) {
+void Cache::addFile( const KURL& url, const TQByteArray& file, const TQDateTime& timestamp ) {
LOG(url.prettyURL());
updateAge();
d->getOrCreateImageData(url, timestamp)->addFile(file);
checkMaxSize();
}
-void Cache::addImage( const KURL& url, const ImageFrames& frames, const QCString& format, const QDateTime& timestamp ) {
+void Cache::addImage( const KURL& url, const ImageFrames& frames, const TQCString& format, const TQDateTime& timestamp ) {
LOG(url.prettyURL());
updateAge();
d->getOrCreateImageData(url, timestamp)->addImage(frames, format);
checkMaxSize();
}
-void Cache::addThumbnail( const KURL& url, const QPixmap& thumbnail, QSize imagesize, const QDateTime& timestamp ) {
+void Cache::addThumbnail( const KURL& url, const TQPixmap& thumbnail, TQSize imagesize, const TQDateTime& timestamp ) {
// Thumbnails are many and often - things would age too quickly. Therefore
// when adding thumbnails updateAge() is called from the outside only once for all of them.
// updateAge();
@@ -179,34 +179,34 @@ void Cache::addThumbnail( const KURL& url, const QPixmap& thumbnail, QSize image
checkMaxSize();
}
-void Cache::invalidate( const KURL& url ) {
+void Cache::tqinvalidate( const KURL& url ) {
d->mImages.remove( url );
}
-QDateTime Cache::timestamp( const KURL& url ) const {
+TQDateTime Cache::timestamp( const KURL& url ) const {
LOG(url.prettyURL());
- if( d->mImages.contains( url )) return d->mImages[ url ]->timestamp;
- return QDateTime();
+ if( d->mImages.tqcontains( url )) return d->mImages[ url ]->timestamp;
+ return TQDateTime();
}
-QByteArray Cache::file( const KURL& url ) const {
+TQByteArray Cache::file( const KURL& url ) const {
LOG(url.prettyURL());
- if( d->mImages.contains( url )) {
+ if( d->mImages.tqcontains( url )) {
const ImageData::Ptr data = d->mImages[ url ];
- if( data->file.isNull()) return QByteArray();
+ if( data->file.isNull()) return TQByteArray();
data->age = 0;
return data->file;
}
- return QByteArray();
+ return TQByteArray();
}
-void Cache::getFrames( const KURL& url, ImageFrames* frames, QCString* format ) const {
+void Cache::getFrames( const KURL& url, ImageFrames* frames, TQCString* format ) const {
LOG(url.prettyURL());
Q_ASSERT(frames);
Q_ASSERT(format);
frames->clear();
- *format = QCString();
- if( d->mImages.contains( url )) {
+ *format = TQCString();
+ if( d->mImages.tqcontains( url )) {
const ImageData::Ptr data = d->mImages[ url ];
if( data->frames.isEmpty()) return;
*frames = data->frames;
@@ -215,15 +215,15 @@ void Cache::getFrames( const KURL& url, ImageFrames* frames, QCString* format )
}
}
-QPixmap Cache::thumbnail( const KURL& url, QSize& imagesize ) const {
- if( d->mImages.contains( url )) {
+TQPixmap Cache::thumbnail( const KURL& url, TQSize& imagesize ) const {
+ if( d->mImages.tqcontains( url )) {
const ImageData::Ptr data = d->mImages[ url ];
- if( data->thumbnail.isNull()) return QPixmap();
+ if( data->thumbnail.isNull()) return TQPixmap();
imagesize = data->imagesize;
// data.age = 0;
return data->thumbnail;
}
- return QPixmap();
+ return TQPixmap();
}
void Cache::updateAge() {
@@ -298,33 +298,33 @@ void Cache::checkMaxSize() {
}
}
-void Cache::readConfig(KConfig* config,const QString& group) {
+void Cache::readConfig(KConfig* config,const TQString& group) {
KConfigGroupSaver saver( config, group );
d->mMaxSize = config->readNumEntry( CONFIG_CACHE_MAXSIZE, d->mMaxSize );
checkMaxSize();
}
-void ImageData::addFile( const QByteArray& f ) {
+void ImageData::addFile( const TQByteArray& f ) {
file = f;
file.detach(); // explicit sharing
age = 0;
}
-void ImageData::addImage( const ImageFrames& fs, const QCString& f ) {
+void ImageData::addImage( const ImageFrames& fs, const TQCString& f ) {
frames = fs;
format = f;
age = 0;
}
-void ImageData::addThumbnail( const QPixmap& thumb, QSize imgsize ) {
+void ImageData::addThumbnail( const TQPixmap& thumb, TQSize imgsize ) {
thumbnail = thumb;
imagesize = imgsize;
// age = 0;
}
int ImageData::size() const {
- return QMAX( fileSize() + imageSize() + thumbnailSize(), 100 ); // some minimal size per item
+ return TQMAX( fileSize() + imageSize() + thumbnailSize(), 100 ); // some minimal size per item
}
int ImageData::fileSize() const {
@@ -345,7 +345,7 @@ int ImageData::imageSize() const {
bool ImageData::reduceSize() {
if( !file.isNull() && fast_url && !frames.isEmpty()) {
- file = QByteArray();
+ file = TQByteArray();
#ifdef DEBUG_CACHE
kdDebug() << "Cache: Dumping fast file: " << _cache_url.prettyURL() << ":" << cost() << endl;
#endif
@@ -355,7 +355,7 @@ bool ImageData::reduceSize() {
#ifdef DEBUG_CACHE
kdDebug() << "Cache: Dumping thumbnail: " << _cache_url.prettyURL() << ":" << cost() << endl;
#endif
- thumbnail = QPixmap();
+ thumbnail = TQPixmap();
return true;
}
if( !file.isNull() && !frames.isEmpty()) {
@@ -367,7 +367,7 @@ bool ImageData::reduceSize() {
kdDebug() << "Cache: Dumping images: " << _cache_url.prettyURL() << ":" << cost() << endl;
#endif
} else {
- file = QByteArray();
+ file = TQByteArray();
#ifdef DEBUG_CACHE
kdDebug() << "Cache: Dumping file: " << _cache_url.prettyURL() << ":" << cost() << endl;
#endif