merge findInCache methods
This commit is contained in:
parent
a4af5cfa02
commit
b9d4f2f042
16
theme.cpp
16
theme.cpp
@ -906,8 +906,12 @@ bool Theme::useNativeWidgetStyle() const
|
|||||||
return d->useNativeWidgetStyle;
|
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()) {
|
if (d->useCache()) {
|
||||||
const QString id = d->keysToCache.value(key);
|
const QString id = d->keysToCache.value(key);
|
||||||
if (d->pixmapsToCache.contains(id)) {
|
if (d->pixmapsToCache.contains(id)) {
|
||||||
@ -925,16 +929,6 @@ bool Theme::findInCache(const QString &key, QPixmap &pix)
|
|||||||
return false;
|
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)
|
void Theme::insertIntoCache(const QString& key, const QPixmap& pix)
|
||||||
{
|
{
|
||||||
if (d->useCache()) {
|
if (d->useCache()) {
|
||||||
|
12
theme.h
12
theme.h
@ -261,16 +261,6 @@ class PLASMA_EXPORT Theme : public QObject
|
|||||||
Q_INVOKABLE QString styleSheet(const QString &css = QString()) const;
|
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
|
* This is an overloaded member provided to check with file timestamp
|
||||||
* where cache is still valid.
|
* 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
|
* @return true when pixmap was found and loaded from cache, false otherwise
|
||||||
* @since 4.3
|
* @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.
|
* Insert specified pixmap into the cache.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user