this will allow to unload the interface module without unloading Qt in a
further patch.
the new structure is still a vlc object as we use it notably for logging
capacity and to interact with vlc variables
QThreadPool::start() could only be called with a QRunnable before Qt
5.15, not a lambda: https://doc.qt.io/qt-5/qthreadpool.html#start-1
Use the older method instead.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>
On Qt view initialization completed, a medialibrary "reload" is
requested.
This call, which could take several seconds in practice (especially when
the medialibrary is initialized for the first time), was issued on
the UI thread, freezing the whole interface on starting.
Execute it from the Qt medialibrary thread pool instead.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>
The item id sometimes represents the id of the "current" item, sometimes
the id of the "parent" item. Therefore, the fact that it is a "parent"
id depends on the context, and is not intrinsic to the type.
This caused confusion when getId() returned a MLParentId, representing
the id of the current item.
Rename to MLItemId to clarify.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>
The database queries, initiated by list models, must be executed
asynchronously (on a thread different from the UI thread).
When a list model is destroyed (from the UI thread), some database
queries might still be executing. It would be incorrect for the list
model to wait for them (it would block the UI thread), so they must be
executed on an external thread pool.
Since the queries themselves require the medialib to be executed, they
must not outlive it (or the asynchronous code might crash). Therefore,
the right scope for executing asynchronous queries is the MediaLib
instance.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>