odd behaviour of browsers/CollectionTreeItemModelBase

Nikhil Marathe nsm.nikhil at gmail.com
Sat Jun 19 10:46:05 CEST 2010


Hi,

CollectionTreeItemModelBase.cpp - populateChildren() is responsible
for populating collection entries like Artist/Album listings when a
collection is expanded. It clears the list every time (except for
Various Artists) some change happens, or the underlying QueryMaker
emits new results.

In the current Amarok code, where most collections are local, this is
fine, because even after the list is completely repopulated, it is
still quite fast.

But two projects, Upnp and Playdar integration have a problem with
this style of doing it. On a network, it makes much more sense to emit
results as they come. For example, if I emit new artists I receive
from a Upnp server, I can start producing entries in 2 seconds. This
way doesn't work currently because the next time I emit new entries,
all my old artists have been cleared away! The solution is to cache
the artists in the collection and then send all of them once I have
received all of them. But this can take 30 or more seconds depending
on the size of the collection, leading to a HUGE difference in the
speed the user perceives.

My solution is that the list gets cleared BEFORE the query maker is
run(). But while a query is running, the list is NOT cleared, assuming
that the query maker won't give duplicates. But I'm not the author of
the code and might be overlooking some things. Or perhaps this may not
be odd behaviour at all due to certain reasons I'm not aware off.

So if what I am suggesting, is the solution, I'm willing to take a
stab at fixing it. But I would just like to get comments from more
experienced developers ( especially Maximilian who wrote the code ).

Regards,
Nikhil


More information about the Amarok-devel mailing list