[vlc-commits] [Git][videolan/vlc][master] 5 commits: qt: map `PLAYLIST_TYPE_AUDIO` to `VLC_ML_PLAYLIST_TYPE_AUDIO`

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jun 22 09:48:31 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
071dca63 by Fatih Uzunoglu at 2025-06-22T09:28:58+00:00
qt: map `PLAYLIST_TYPE_AUDIO` to `VLC_ML_PLAYLIST_TYPE_AUDIO`

With the `ONLY` option, playlists can disappear in the interface
when the user adds a different type content, such as by dragging.
This is problematic because the interface may not know whether
the dragged media is considered as video or audio by media library,
so it is not possible to (even if we want) disallow (at least
from the interface side) adding different type of media. Not to
mention, media library can be manipulated by anything, so such
blockage would probably does not make sense.

This is especially important because we currently do not offer a
view that shows all or mixed playlists.

- - - - -
b19547c8 by Fatih Uzunoglu at 2025-06-22T09:28:58+00:00
qt: map `PLAYLIST_TYPE_VIDEO` to `VLC_ML_PLAYLIST_TYPE_VIDEO`

With the `ONLY` option, playlists can disappear in the interface
when the user adds a different type content, such as by dragging.
This is problematic because the interface may not know whether
the dragged media is considered as video or audio by media library,
so it is not possible to (even if we want) disallow (at least
from the interface side) adding different type of media. Not to
mention, media library can be manipulated by anything, so such
blockage would probably does not make sense.

This is especially important because we currently do not offer a
view that shows all or mixed playlists.

- - - - -
0d437c3c by Fatih Uzunoglu at 2025-06-22T09:28:58+00:00
qt: add `PLAYLIST_TYPE_AUDIO_ONLY` to `MLPlaylistListModel::PlaylistType` enumeration

- - - - -
dd615037 by Fatih Uzunoglu at 2025-06-22T09:28:58+00:00
qt: add `PLAYLIST_TYPE_VIDEO_ONLY` to `MLPlaylistListModel::PlaylistType` enumeration

- - - - -
1fc476ad by Fatih Uzunoglu at 2025-06-22T09:28:58+00:00
qml: re-provide adding to mixed playlists option in `MLContextMenu`

- "Add to a playlist" option now offers also the mixed playlists,
  like it was before 405e1efb.
- The new "-only" option shows the segregated add to playlist dialog.

We can do this because we now show mixed playlists in the interface,
thus playlists would not become "hidden" (in the interface) if we
allow adding a different type of media in a homogenous playlist.

- - - - -


3 changed files:

- modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
- modules/gui/qt/medialibrary/mlplaylistlistmodel.hpp
- modules/gui/qt/util/qml/MLContextMenu.qml


Changes:

=====================================
modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
=====================================
@@ -483,8 +483,12 @@ static inline vlc_ml_playlist_type_t qmlToMLPlaylistType(MLPlaylistListModel::Pl
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_ALL:
         return VLC_ML_PLAYLIST_TYPE_ALL;
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_AUDIO:
-        return VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY;
+        return VLC_ML_PLAYLIST_TYPE_AUDIO;
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_VIDEO:
+        return VLC_ML_PLAYLIST_TYPE_VIDEO;
+    case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_AUDIO_ONLY:
+        return VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY;
+    case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_VIDEO_ONLY:
         return VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY;
     default:
         vlc_assert_unreachable();


=====================================
modules/gui/qt/medialibrary/mlplaylistlistmodel.hpp
=====================================
@@ -45,6 +45,8 @@ public:
         PLAYLIST_TYPE_ALL,
         PLAYLIST_TYPE_AUDIO,
         PLAYLIST_TYPE_VIDEO,
+        PLAYLIST_TYPE_AUDIO_ONLY,
+        PLAYLIST_TYPE_VIDEO_ONLY,
     };
     Q_ENUM(PlaylistType)
 


=====================================
modules/gui/qt/util/qml/MLContextMenu.qml
=====================================
@@ -66,6 +66,9 @@ NativeMenu {
             "text": qsTr("Remove from favorites"),
             "action": removeFavorite,
             "visible": _showRemoveFavorite
+        }, {
+            "text": (root.showPlayAsAudioAction ? qsTr("Add to a video-only playlist") : qsTr("Add to an audio-only playlist")),
+            "action": (root.showPlayAsAudioAction ? root.addToVideoOnlyPlaylist : root.addToAudioOnlyPlaylist)
         }, {
             "text": qsTr("Add to a playlist"),
             "action": addToAPlaylist
@@ -127,13 +130,17 @@ NativeMenu {
         model.ml.addToPlaylist(_mlIDList(dataList), _playerOptions(options))
     }
 
-    function addToAPlaylist(dataList, options, indexes) {
-        let type
-        // if (dataList.length === 1)
-            type = root.showPlayAsAudioAction ? MLPlaylistListModel.PLAYLIST_TYPE_VIDEO
-                                              : MLPlaylistListModel.PLAYLIST_TYPE_AUDIO
-        // else
-        //    type = MLPlaylistListModel.PLAYLIST_TYPE_ALL // iterate through items?
+    function addToAudioOnlyPlaylist(dataList, options, indexes) {
+        addToAPlaylist(dataList, options, indexes, MLPlaylistListModel.PLAYLIST_TYPE_AUDIO_ONLY)
+    }
+
+    function addToVideoOnlyPlaylist(dataList, options, indexes) {
+        addToAPlaylist(dataList, options, indexes, MLPlaylistListModel.PLAYLIST_TYPE_VIDEO_ONLY)
+    }
+
+    function addToAPlaylist(dataList, options, indexes, type) {
+        if (type === undefined)
+            type = MLPlaylistListModel.PLAYLIST_TYPE_ALL
 
         DialogsProvider.playlistsDialog(_mlIDList(dataList), type)
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3db080cbac1140e86b5acb5f9164e41f4fa34fc5...1fc476ad71d53ecc95db8d62214d35bcafb418ec

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3db080cbac1140e86b5acb5f9164e41f4fa34fc5...1fc476ad71d53ecc95db8d62214d35bcafb418ec
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list