[vlc-commits] qt: add function to browse and add audio and video

Prince Gupta git at videolan.org
Fri Nov 6 16:00:44 CET 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Oct  9 19:25:19 2020 +0530| [a13349de2a85d59a422473dc38e92a25c4132f90] | committer: Pierre Lamot

qt: add function to browse and add audio and video

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/dialogs/dialogs_provider.cpp | 25 ++++++++++++++++++++-----
 modules/gui/qt/dialogs/dialogs_provider.hpp |  4 ++++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/dialogs/dialogs_provider.cpp b/modules/gui/qt/dialogs/dialogs_provider.cpp
index e71dd88f58..1d56587d57 100644
--- a/modules/gui/qt/dialogs/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs/dialogs_provider.cpp
@@ -755,7 +755,7 @@ void DialogsProvider::openAndTranscodingDialogs()
                                 ->showTab( OPEN_FILE_TAB );
 }
 
-void DialogsProvider::loadSubtitlesFile()
+void  DialogsProvider::loadMediaFile( const es_format_category_e category, const int filter , const QString &dialogTitle)
 {
     input_item_t *p_item = THEMIM->getInput();
     if( !p_item ) return;
@@ -771,18 +771,33 @@ void DialogsProvider::loadSubtitlesFile()
         free(path);
     }
 
-    QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
-                                      EXT_FILTER_SUBTITLE,
+    QStringList qsl = showSimpleOpen( dialogTitle,
+                                      filter,
                                       url );
 
     foreach( const QString &qsUrl, qsl )
     {
 
-        if ( THEMIM->AddAssociatedMedia( SPU_ES, qsUrl, true, true, false ) )
-            msg_Warn( p_intf, "unable to load subtitles from '%s'", qtu( qsUrl ) );
+        if ( THEMIM->AddAssociatedMedia( category, qsUrl, true, true, false ) )
+            msg_Warn( p_intf, "unable to load media from '%s', category(%d)", qtu( qsUrl ), category );
     }
 }
 
+void DialogsProvider::loadSubtitlesFile()
+{
+    loadMediaFile( SPU_ES, EXT_FILTER_SUBTITLE, qtr( "Open subtitles..." ) );
+}
+
+void DialogsProvider::loadAudioFile()
+{
+    loadMediaFile( AUDIO_ES, EXT_FILTER_AUDIO, qtr( "Open audio..." ) );
+}
+
+void DialogsProvider::loadVideoFile()
+{
+    loadMediaFile( VIDEO_ES, EXT_FILTER_VIDEO, qtr( "Open video..." ) );
+}
+
 
 /****************************************************************************
  * Menus
diff --git a/modules/gui/qt/dialogs/dialogs_provider.hpp b/modules/gui/qt/dialogs/dialogs_provider.hpp
index a588fd939a..f7a430f0b1 100644
--- a/modules/gui/qt/dialogs/dialogs_provider.hpp
+++ b/modules/gui/qt/dialogs/dialogs_provider.hpp
@@ -108,6 +108,8 @@ private:
     virtual ~DialogsProvider();
     static DialogsProvider *instance;
 
+    void loadMediaFile( es_format_category_e category, int filter, const QString& dialogTitle );
+
     intf_thread_t *p_intf;
 
     QMenu* popupMenu;
@@ -171,6 +173,8 @@ public slots:
     void savePlayingToPlaylist();
 
     void loadSubtitlesFile();
+    void loadAudioFile();
+    void loadVideoFile();
 
     void quit();
 



More information about the vlc-commits mailing list