allow setting of the disk cache size; init it to "no limit", so we can see how that puppy grows with time

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=872362
This commit is contained in:
Aaron J. Seigo 2008-10-17 02:26:26 +00:00
parent 12c5b4da94
commit 5197a55791
2 changed files with 16 additions and 0 deletions

View File

@ -65,6 +65,7 @@ public:
useGlobal(true),
hasWallpapers(false)
{
pixmapCache.setCacheLimit(0);
generalFont = QApplication::font();
}
@ -531,6 +532,11 @@ void Theme::invalidateRectsCache(const QString& image)
imageGroup.deleteGroup();
}
void Theme::setCacheLimit(int kbytes)
{
d->pixmapCache.setCacheLimit(kbytes);
}
}
#include <theme.moc>

10
theme.h
View File

@ -192,6 +192,16 @@ class PLASMA_EXPORT Theme : public QObject
**/
void insertIntoCache(const QString& key, const QPixmap& pix);
/**
* Sets the maximum size of the cache (in kilobytes). If cache gets bigger
* the limit then some entries are removed
* Setting cache limit to 0 disables automatic cache size limiting.
*
* Note that the cleanup might not be done immediately, so the cache might
* temporarily (for a few seconds) grow bigger than the limit.
**/
void setCacheLimit(int kbytes);
bool findInRectsCache(const QString &image, const QString &element, QRectF &rect) const;
void insertIntoRectsCache(const QString& image, const QString &element, const QRectF &rect);
void invalidateRectsCache(const QString& image);