[vlc-devel] [PATCH 07/21] qt: add function to browse and add audio and video
Prince Gupta
guptaprince8832 at gmail.com
Fri Oct 23 15:21:01 CEST 2020
---
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 37975707d1..0811e2349f 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();
--
2.25.1
More information about the vlc-devel
mailing list