1. The mechanism implemented to keep these two in-sync is broken
2. Interface changes some CSD controls based on window visibility, this
causes conflicts (ref #26668)
Note that in some cases they have been changed to forward declarations, and
in some they have been moved, for instance inclusion of `<QUrl>` was moved
from `qt.hpp` to where it was needed.
this function allows to run lambdas on the ML thread, this should be used to
perform operation that requires to call vlc_ml_xxx functions as vlc_ml_xxx
should *not* be called from the UI thread
obj: this is the instance of the calling QObject, we ensure that this object is
still live when calling the ui callback, if this object gets destroyed the task
is canceled
mlCb: this callback is executed in a background thread (thread pool), it takes
as arguments the instance of the medialibrary, and a context, the context can be
modified to pass data to the UI callback
uiCB: this callback is executed on the Qt thread, it takes as first argument the
id of the tasks, and as second argument the context that was created for the ML
callback
queue: this allow the task to be ran on a specific thread, when this parameter
isn't provided, the task can be scheduled on any thread.
Ctx is the type of context, this context is created by the runner and passed
sequentially to the ML callback then to UI callback, the ML callback may modify
its properties as a way to pass data to the UI callback
⚠️ the ml callback **SHOULD NOT** capture the obj object or point to its
properties by reference, as the obj object may potentially be destroyed when the
function is called
the ui callback **MAY** capture the object obj as we will ensure that the object
still exists before calling the callback
the uiCb **MAY NOT** be called if the object obj is released earlier
anything stored int the context Ctx **MUST** auto release when the context is
destroyed
sample usage:
```
//structure used to pass data from the ML thread to the UI thread
struct Ctx {
bool success;
};
m_mediaLib->runOnMLThread<Ctx>(
//reference to the object making the call, this is used to ensure that
//the caller still exists before calling the UI callback
this,
//ML thread, data needed from the caller are passed in the capture of the lambda
//capturing this or any of its member is not allowed here
//the callback have in parametters the ml instance and a context that will be shared with
//the UI callback
[url, indexed](vlc_medialibrary_t* ml, Ctx& ctx)
{
int res;
if ( indexed )
res = vlc_ml_add_folder( ml, qtu( url ) );
else
res = vlc_ml_remove_folder( ml, qtu( url ) );
ctx.success = (res == VLC_SUCCESS);
},
//UI callback, capturing this is allowed, (runOnMLThread will ensure that `this`
//still exists at this point
//the callback has as parametters the request id and the shared context
[this, indexed](quint64, Ctx& ctx){
if (ctx.success)
{
m_indexed = indexed;
emit isIndexedChanged();
}
},
//allow to specify if the task should be run on a specific thread, null (default) will run on any thread
"ML_FOLDER_ADD_QUEUE");
```
qt/open_panels: use 'save-recentplay'
qt/preferences: use 'save-recentplay'
qt/MainInterface: use 'save-recentplay'
qt/recent_menu: use 'save-recentplay'
fixes undefined sanitizers warnings -
../../modules/gui/qt/maininterface/main_interface.cpp:283:19: runtime
error: load of value 190, which is not a valid value for type 'bool'
.... etc
FirstRun dialog used Qt::WA_DeleteOnClose, it lifecycle would be bound to the
QApplication. On close the firstrun dialog will save some changes to the
preferences. So we need to ensure the dialog is properly destroyed before the
context becomes invalid when closing the application.
this commit updates 3895e912bf which got reverted
in a39d175575
Since the actual interface object is now contained in the main Qt
Interface. This fixes regressions introduced by
537d41a468 which were breaking the vlc var
fetching.
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
* PlayerControlbarModel class is repurposed
and renamed to "player_controlbar_model.cpp/hpp".
PlayerControlbarModel is now a supermodel that
instantiates and handles three ControlListModel
for its 'left', 'center', and 'right' properties.
ControlListModel is the stripped down version of
the old PlayerControlbarModel.
* ControlbarProfileModel is created during
MainInterface initialization. ControlbarProfileModel
creates and handles toolbar/controlbar profiles
that act as a wrapper of PlayerControlbarModel
instances. Saving and loading from settings
happens in ControlbarProfileModel.
* Default control layout is now defined in
ControlbarProfile class. ControlbarProfile
injects the default configuration
during construction.
* Default profiles are now defined in
ControlbarProfileModel class.
ControlbarProfileModel class automatically
matches defaults based on player identifiers.
Signed-off-by: Pierre Lamot <pierre@videolabs.io>