merge findInCache methods

This commit is contained in:
Aaron Seigo 2011-05-20 08:23:43 +02:00
parent a4af5cfa02
commit b9d4f2f042
2 changed files with 6 additions and 22 deletions

View File

@ -906,8 +906,12 @@ bool Theme::useNativeWidgetStyle() const
return d->useNativeWidgetStyle;
}
bool Theme::findInCache(const QString &key, QPixmap &pix)
bool Theme::findInCache(const QString &key, QPixmap &pix, unsigned int lastModified)
{
if (lastModified != 0 && d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime())) {
return false;
}
if (d->useCache()) {
const QString id = d->keysToCache.value(key);
if (d->pixmapsToCache.contains(id)) {
@ -925,16 +929,6 @@ bool Theme::findInCache(const QString &key, QPixmap &pix)
return false;
}
// BIC FIXME: Should be merged with the other findInCache method above when we break BC
bool Theme::findInCache(const QString &key, QPixmap &pix, unsigned int lastModified)
{
if (d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime())) {
return false;
}
return findInCache(key, pix);
}
void Theme::insertIntoCache(const QString& key, const QPixmap& pix)
{
if (d->useCache()) {

12
theme.h
View File

@ -261,16 +261,6 @@ class PLASMA_EXPORT Theme : public QObject
Q_INVOKABLE QString styleSheet(const QString &css = QString()) const;
/**
* Tries to load pixmap with the specified key from cache.
*
* @param key the name to use in the cache for this image
* @param pix the pixmap object to populate with the resulting data if found
*
* @return true when pixmap was found and loaded from cache, false otherwise
**/
bool findInCache(const QString &key, QPixmap &pix);
/**
* This is an overloaded member provided to check with file timestamp
* where cache is still valid.
@ -283,7 +273,7 @@ class PLASMA_EXPORT Theme : public QObject
* @return true when pixmap was found and loaded from cache, false otherwise
* @since 4.3
**/
bool findInCache(const QString &key, QPixmap &pix, unsigned int lastModified);
bool findInCache(const QString &key, QPixmap &pix, unsigned int lastModified = 0);
/**
* Insert specified pixmap into the cache.