X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fqt4.cpp;h=fb4fb49fa50c40c7ec8f8c22e04f240db55035d5;hb=6b468738b8468b1ca799cdda6cd0defbde720920;hp=ac00b62d8fb7031f67353981648341c34c1f60cd;hpb=e3db765137abde9ae995e532fa86dda512e59644;p=vlc diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp index ac00b62d8f..fb4fb49fa5 100755 --- a/modules/gui/qt4/qt4.cpp +++ b/modules/gui/qt4/qt4.cpp @@ -39,6 +39,7 @@ #include "input_manager.hpp" #include "main_interface.hpp" #include "dialogs/help.hpp" /* update */ +#include "recents.hpp" #ifdef HAVE_X11_XLIB_H #include @@ -123,6 +124,9 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); #define PRIVACY_TEXT N_( "Ask for network policy at start" ) +#define RECENTPLAY_TEXT N_( "Save the recently played items in the menu" ) +#define RECENTPLAY_FILTER_TEXT N_( "List of words separated by | to filter" ) + #define SLIDERCOL_TEXT N_( "Define the colors of the volume slider " ) #define SLIDERCOL_LONGTEXT N_( "Define the colors of the volume slider\n" \ "By specifying the 12 numbers separated by a ';'\n" \ @@ -209,6 +213,10 @@ vlc_module_begin(); add_bool( "qt-privacy-ask", true, NULL, PRIVACY_TEXT, PRIVACY_TEXT, false ); + add_bool( "qt-recentplay", true, NULL, RECENTPLAY_TEXT, + RECENTPLAY_TEXT, false ); + add_string( "qt-recentplay-filter", NULL, NULL, + RECENTPLAY_FILTER_TEXT, RECENTPLAY_FILTER_TEXT, false ); change_internal(); set_callbacks( OpenDialogs, Close ); @@ -263,8 +271,6 @@ static int Open( vlc_object_t *p_this ) /* Access to the playlist */ p_intf->p_sys->p_playlist = pl_Hold( p_intf ); - /* Listen to the messages */ - //p_intf->p_sys->p_sub = msg_Subscribe( p_intf->p_libvlc, NULL, NULL ); /* one settings to rule them all */ var_Create( p_this, "window_widget", VLC_VAR_ADDRESS ); @@ -298,7 +304,6 @@ static void Close( vlc_object_t *p_this ) } vlc_object_release( p_intf->p_sys->p_playlist ); - //msg_Unsubscribe( p_intf->p_sys->p_sub ); free( p_intf->p_sys ); } @@ -315,15 +320,20 @@ static void Run( intf_thread_t *p_intf ) } else { - int canc = vlc_savecancel (); Init( VLC_OBJECT(p_intf) ); - vlc_restorecancel( canc ); } } static QMutex windowLock; static QWaitCondition windowWait; +static void ThreadCleanup( void *param) +{ + intf_thread_t *p_intf = (intf_thread_t *)param; + QCloseEvent *event = new QCloseEvent(); + QApplication::postEvent( p_intf->p_sys->p_mi, event ); +} + static void *Init( vlc_object_t *obj ) { intf_thread_t *p_intf = (intf_thread_t *)obj; @@ -333,6 +343,8 @@ static void *Init( vlc_object_t *obj ) int argc = 1; int canc = vlc_savecancel (); + msg_Dbg( p_intf, "Setting ThreadCleanup"); + vlc_cleanup_push( ThreadCleanup, (void*)p_intf ); Q_INIT_RESOURCE( vlc ); #if !defined(WIN32) && !defined(__APPLE__) @@ -447,10 +459,12 @@ static void *Init( vlc_object_t *obj ) p_intf->p_sys->psz_filepath = EMPTY_STR( psz_path ) ? config_GetHomeDir() : psz_path; + vlc_restorecancel (canc); /* Launch */ app->exec(); /* And quit */ + canc = vlc_savecancel (); msg_Dbg( p_intf, "Quitting the Qt4 Interface" ); if (miP) @@ -477,6 +491,9 @@ static void *Init( vlc_object_t *obj ) */ DialogsProvider::killInstance(); + /* Delete the recentsMRL object before the configuration */ + RecentsMRL::killInstance(); + /* Delete the configuration. Application has to be deleted after that. */ delete p_intf->p_sys->mainSettings; @@ -490,6 +507,7 @@ static void *Init( vlc_object_t *obj ) config_PutPsz( p_intf, "qt-filedialog-path", p_intf->p_sys->psz_filepath ); free( psz_path ); vlc_restorecancel (canc); + vlc_cleanup_pop(); return NULL; }