[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: how to use the cache-to-disk feature in Wallpaper
From:       Benoit Jacob <jacob.benoit.1 () gmail ! com>
Date:       2009-04-10 23:30:30
Message-ID: d9f848520904101630u58b96a73l1d2cd683544442a0 () mail ! gmail ! com
[Download RAW message or body]

2009/4/10 Aaron J. Seigo <aseigo@kde.org>:
> On Friday 10 April 2009, Benoit Jacob wrote:
>> I did setUsingDiskCache(true); in the constructor, and I emit
>
> when you are ready to cache the image, you can now call:
>
> insertIntoCache(const QString& key, const QImage &image);
>
> and if you want to see if it exists and retrieve it call:
>
> bool findInCache(const QString &key, QImage &image, unsigned int lastModified
> = 0)
>
> with the same key. so in your case, you may want to include things like the
> the view point and zoom level in the key.

Thanks! I see.

>
> also, i'd suggest:
>
> * deleting the old image so the user doesn't end up with a bajillion cached
> papers (maybe i should add that bookkeeping into Wallpaper itself? Hmmmm..
> yes, probably... "let me get back to you on that one," he says, again.)

Maybe I don't understand, but I think that the Wallpaper class doesn't
seem to have enough information to do the bookkeeping.

Here's an example: the user has 2 different Mandelbrot's in 2
desktops. The expected behavior is to keep the most recent cached
image for each Mandelbrot. I don't see how to make that automatically
handled in Wallpaper?

So unless you can figure a way to make that work magically, I'd suggest either

void removeFromCache(const QString& key);

or changing  insertIntoCache as follows:

void insertIntoCache(const QString& key, const QImage &image, const
QString& oldkey);
where the cache entry corresponding to oldkey is automatically removed
from cache (one may then pass an empty string -- perhaps that'd be the
default value -- if one doesn't want to remove anything).

Cheers,
Benoit
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic