QDeclarativeImageProvider for caching images on file?
-
[quote author="pdrummond" date="1304604386"]
A better test would be to have a ListView where the items are locally sourced but they include an image that is loaded from the network. When you run the app for the first time, the images will be downloaded, then you shut down the app, turn wifi off, re-run the app and the images should still be displayed because they are automatically sourced from the disk cache. [/quote]
That was the test. And not by turn wifi off, I unplugged adsl modem. :) I am pretty sure caching is working.And the cache is in C:\Users\myusername\AppData\Local\cache on Win7.
-
Do your images load if you turn off WiFi then run the app?
-
What I have been telling you, :) they load. Cache folder exists with http, https, prepaped folders. In http folder there are cache files cache_*.cache. Cache items contains the header and the compressed image (but I don't think images are compressed).
-
Sorry, I just couldn't tell from your posts whether your tests were the same as mine. I am going to write a simple test case and maybe file a bug report on this. Caching simply doesn't work for me :-(
-
Sorry to hear that caching for you doesn't work.
What's the cache directory? Is it created?
-
Hey, did you get this to work? I would really appreciate the solution! Thanks!
-
[quote author="jkosonen" date="1313401377"]Hey, did you get this to work? I would really appreciate the solution! Thanks![/quote]
It's working for me see https://github.com/minimoog/qtwitdget/blob/master/namfactory.h
-
I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.
So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.
-
[quote author="pdrummond" date="1313407193"]I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.
So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.[/quote]
I would like to have that kind of an solution, but no idea where to start. Shame that you can't publish the code..
-
[quote author="pdrummond" date="1313407193"]I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.
So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.[/quote]
Did you do your own QAbstractnetworkCache or?