qt: medialib: implement separate data loaders
When the database queries are executed asynchronously, we must still be
able to delete a list model from the main thread without blocking. As a
consequence, the data loader must be able to outlive the list model
instance; this implies that loading data must not involve calling
methods on the list model itself (fetch() and countTotalElements()).
Nevertheless, the actual data to load depends on the list model (the
content is not the same between a list of videos and a list of albums).
To be able to detach the lifetime of the data loader from the one of the
list model, make the list models provide loader instances on demand,
instead of implementing the loading methods directly.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>
17 files changed: