]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs_provider.cpp
We don't want the & and ... in the title
[vlc] / modules / gui / qt4 / dialogs_provider.cpp
index 2fc319b63e1ab0504e514794e64d5826886513ed..98d11ab919ff4a0f0c89d14f290d8e548f98dab2 100644 (file)
 #include <QSignalMapper>
 #include <QFileDialog>
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "qt4.hpp"
 #include "dialogs_provider.hpp"
 #include "main_interface.hpp"
 #include "menus.hpp"
 #include <vlc_intf_strings.h>
+#include "input_manager.hpp"
 
 /* The dialogs */
 #include "dialogs/playlist.hpp"
@@ -88,7 +89,7 @@ DialogsProvider::~DialogsProvider()
 
 void DialogsProvider::quit()
 {
-    vlc_object_kill( p_intf );
+    vlc_object_kill( p_intf->p_libvlc );
     QApplication::closeAllWindows();
     QApplication::quit();
 }
@@ -317,7 +318,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
                       PLAYLIST_END,
-                      pl ? VLC_TRUE : VLC_FALSE, VLC_FALSE );
+                      pl ? true : false, false );
         i++;
     }
 }
@@ -345,7 +346,7 @@ void DialogsProvider::simpleMLAppendDialog()
  **/
 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
 {
-    QString dir = QFileDialog::getExistingDirectory( 0, qtr(I_OP_OPDIR) );
+    QString dir = QFileDialog::getExistingDirectory( 0, qtr("Open Directory") );
     if (!dir.isEmpty()) {
         input_item_t *p_input = input_ItemNewExt( THEPL,
                                         qtu( "directory://" + dir ), NULL,
@@ -354,8 +355,9 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
         /* FIXME: playlist_AddInput() can fail */
         playlist_AddInput( THEPL, p_input,
                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
-                       PLAYLIST_END, pl, VLC_FALSE );
-        input_Read( THEPL, p_input, VLC_FALSE );
+                       PLAYLIST_END, pl, pl_Unlocked );
+        input_Read( THEPL, p_input, false );
+        vlc_gc_decref( p_input );
     }
 }
 
@@ -445,7 +447,7 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
 
         playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-                        -1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
+                        -1, &psz_option, 1, true, pl_Unlocked );
     }
 }
 
@@ -528,3 +530,18 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
         break;
     }
 }
+
+void DialogsProvider::loadSubtitlesFile()
+{
+    input_thread_t *p_input = THEMIM->getInput();
+    if( !p_input )
+        return;
+    QString qsFile = QFileDialog::getOpenFileName(
+             NULL,
+             qtr( "Choose subtitles file" ),
+             "",
+             qtr( "Subtitles files (*.cdg *.idx *.srt *.sub *.utf);;"
+                  "All files (*)" ) );
+    if( !input_AddSubtitles( p_input, qtu( qsFile ), true ) )
+        msg_Warn( p_intf, "unable to load subtitles file..." );
+}