X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fdialogs_provider.cpp;h=87a26b9723c28cdccb1dd2e3f2ea57d0c4bc991d;hb=4dc4a8d088e1ab8b46e83ed5f52413830dc489ef;hp=068abb7d64d2adef3359d086cd8d80045aea9e21;hpb=3ab81753822bd0a37786e6fd026a349e7a0e0830;p=vlc diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index 068abb7d64..87a26b9723 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include "qt4.hpp" #include "dialogs_provider.hpp" #include "main_interface.hpp" @@ -88,7 +88,7 @@ DialogsProvider::~DialogsProvider() void DialogsProvider::quit() { - vlc_object_kill( p_intf ); + vlc_object_kill( p_intf->p_libvlc ); QApplication::closeAllWindows(); QApplication::quit(); } @@ -317,7 +317,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++; } } @@ -351,10 +351,12 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go ) qtu( "directory://" + dir ), NULL, 0, NULL, -1 ); + /* 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, false ); + input_Read( THEPL, p_input, false ); + vlc_gc_decref( p_input ); } } @@ -444,7 +446,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, false ); } } @@ -501,6 +503,17 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) qdialog = (InteractionDialog*)(p_dialog->p_private); if( qdialog ) qdialog->update(); + else + { + /* The INTERACT_NEW message was forgotten + so we must create the dialog and update it*/ + qdialog = new InteractionDialog( p_intf, p_dialog ); + p_dialog->p_private = (void*)qdialog; + if( !(p_dialog->i_status == ANSWERED_DIALOG) ) + qdialog->show(); + if( qdialog ) + qdialog->update(); + } break; case INTERACT_HIDE: qdialog = (InteractionDialog*)(p_dialog->p_private); @@ -516,3 +529,22 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) break; } } + +void DialogsProvider::loadSubtitlesFile() +{ + playlist_t *p_playlist = pl_Yield( p_intf ); + if( !p_playlist || !p_playlist->p_input ) + { + msg_Err( p_intf, "cannot get 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_playlist->p_input, qtu( qsFile ), true ) ) + msg_Warn( p_intf, "unable to load subtitles file..." ); + pl_Release( p_playlist ); +}