Is there a PreviewJob version where i can add more items?

Mark markg85 at gmail.com
Mon Jan 28 09:07:20 GMT 2013


On Fri, Jan 25, 2013 at 1:58 PM, Sebastian K├╝gler <sebas at kde.org> wrote:
> On Thursday, January 24, 2013 22:48:00 Mark wrote:
>> In my project is need to create thumbnails of files and am using
>> PreviewJob for that right now. It works fine, no issue there, but i
>> have a slightly different workflow that doesn't seem to fit the
>> PreviewJob class.
>>
>> My flow "should" go as follows:
>>
>> - A batch of files arrives
>> - - for each item a check is done to see if a thumbnail exists for it,
>> if not then the item should be added to a Queue (QQueue perhaps?)
>> - - PreviewJob gets notified of items in the queue and start processing them
>>
>> That is how i would like to have it because then i can just add items
>> to the queue as a want and the PreviewJob class just progresses all
>> items. Not really a strange request, right?
>>
>> So the question is, how can i use the current PreviewJob class for
>> this? It doesn't seem to be capable of doing that. There also doesn't
>> seem to be a function to add additional items other then through the
>> constructor.
>>
>> What i'm doing right now is creating a PreviewJob instance for every
>> batch that arrives. It works, but "feels" as if it needs to be changed
>> to a proper queue. Please do correct me if i'm wrong.
>
> To me, that sounds fine. In the end, KIO will do the scheduling for you, so
> PreviewJobs are, in that regard, just fire and forget.

Thank you for clarifying that, sebas :)

Though i think i won't escape from either subclassing it or
re-implementing it due to the following reasons:
- in my case i don't want to send or receive a KFileItem(List), just a
QString, KUrl or QUrl.
- perhaps even a QModelIndex which would make it very easy to use this
with a model with no extra bookkeeping.
- i have a lot of bookkeeping now to manage the different batches
where it "could" be just as easy as one queue.

Note: why is PreviewJob having caching things? Isn't this a bit too
much caching settings?




More information about the kde-core-devel mailing list