[vlc-commits] qt: add url context menu

Pierre Lamot git at videolan.org
Mon Sep 28 14:01:40 CEST 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Sep 23 17:14:46 2020 +0200| [6fdc97a92b4542099627a36a61ae00a0705316f5] | committer: Pierre Lamot

qt: add url context menu

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6fdc97a92b4542099627a36a61ae00a0705316f5
---

 modules/gui/qt/maininterface/mainui.cpp   |  1 +
 modules/gui/qt/menus/qml_menu_wrapper.cpp | 11 +++++++++++
 modules/gui/qt/menus/qml_menu_wrapper.hpp |  9 +++++++++
 3 files changed, 21 insertions(+)

diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index 624edb90c3..c2d5460126 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -184,6 +184,7 @@ void MainUI::registerQMLTypes()
         qmlRegisterType<ArtistContextMenu>( "org.videolan.medialib", 0, 1, "ArtistContextMenu" );
         qmlRegisterType<GenreContextMenu>( "org.videolan.medialib", 0, 1, "GenreContextMenu" );
         qmlRegisterType<AlbumTrackContextMenu>( "org.videolan.medialib", 0, 1, "AlbumTrackContextMenu" );
+        qmlRegisterType<URLContextMenu>( "org.videolan.medialib", 0, 1, "URLContextMenu" );
         qmlRegisterType<VideoContextMenu>( "org.videolan.medialib", 0, 1, "VideoContextMenu" );
     }
 
diff --git a/modules/gui/qt/menus/qml_menu_wrapper.cpp b/modules/gui/qt/menus/qml_menu_wrapper.cpp
index e48548b6b9..f42e31572a 100644
--- a/modules/gui/qt/menus/qml_menu_wrapper.cpp
+++ b/modules/gui/qt/menus/qml_menu_wrapper.cpp
@@ -24,6 +24,7 @@
 #include "medialibrary/mlartistmodel.hpp"
 #include "medialibrary/mlgenremodel.hpp"
 #include "medialibrary/mlalbumtrackmodel.hpp"
+#include "medialibrary/mlurlmodel.hpp"
 #include "network/networkmediamodel.hpp"
 #include "playlist/playlist_controller.hpp"
 #include "playlist/playlist_model.hpp"
@@ -158,6 +159,16 @@ void AlbumTrackContextMenu::popup(const QModelIndexList &selected, QPoint pos, Q
     BaseMedialibMenu::popup(m_model, MLAlbumTrackModel::TRACK_ID, selected, pos, options);
 }
 
+URLContextMenu::URLContextMenu(QObject* parent)
+    : BaseMedialibMenu(parent)
+{}
+
+void URLContextMenu::popup(const QModelIndexList &selected, QPoint pos, QVariantMap options)
+{
+    BaseMedialibMenu::popup(m_model, MLUrlModel::URL_ID, selected, pos, options);
+}
+
+
 VideoContextMenu::VideoContextMenu(QObject* parent)
     : QObject(parent)
 {}
diff --git a/modules/gui/qt/menus/qml_menu_wrapper.hpp b/modules/gui/qt/menus/qml_menu_wrapper.hpp
index 9af03a4a6b..369817d8ca 100644
--- a/modules/gui/qt/menus/qml_menu_wrapper.hpp
+++ b/modules/gui/qt/menus/qml_menu_wrapper.hpp
@@ -30,6 +30,7 @@ class MLAlbumModel;
 class MLGenreModel;
 class MLArtistModel;
 class MLAlbumTrackModel;
+class MLUrlModel;
 class MLVideoModel;
 class NetworkMediaModel;
 class QmlMainContext;
@@ -126,6 +127,14 @@ public slots:
     void popup(const QModelIndexList& selected, QPoint pos, QVariantMap options = {});
 };
 
+class URLContextMenu : public BaseMedialibMenu {
+    Q_OBJECT
+    SIMPLE_MENU_PROPERTY(MLUrlModel*, model, nullptr)
+public:
+    URLContextMenu(QObject* parent = nullptr);
+public slots:
+    void popup(const QModelIndexList& selected, QPoint pos, QVariantMap options = {});
+};
 
 class VideoContextMenu : public QObject {
     Q_OBJECT



More information about the vlc-commits mailing list