]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
* configure.ac: enabled Obj-C exceptions in the OBJCFLAGS (they're currently used...
[vlc] / modules / gui / qt4 / qt4.cpp
index 179ca845ac543589de90d66dcabc3cee5b6d4bd7..9c0d6361066781c42b8d002d43b4e925497739c9 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * qt4.cpp : QT4 interface
  ****************************************************************************
- * Copyright (C) 2000-2005 the VideoLAN team
- * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *
@@ -47,10 +47,12 @@ vlc_module_begin();
     set_callbacks( Open, Close );
 
     set_program( "qvlc" );
+    add_shortcut("qt");
 
     add_submodule();
         set_description( "Dialogs provider" );
         set_capability( "dialogs provider", 51 );
+        add_bool( "qt-always-video", VLC_FALSE, NULL, "", "", VLC_TRUE );
         set_callbacks( OpenDialogs, Close );
 vlc_module_end();
 
@@ -65,6 +67,11 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys = (intf_sys_t *)malloc(sizeof( intf_sys_t ) );
     memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
 
+    p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
+                            VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    if( !p_intf->p_sys->p_playlist )
+        return VLC_EGENERIC;
+
     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
 
     return VLC_SUCCESS;
@@ -85,6 +92,7 @@ static void Close( vlc_object_t *p_this )
     p_intf->b_dead = VLC_TRUE;
     vlc_mutex_unlock( &p_intf->object_lock );
 
+    vlc_object_release( p_intf->p_sys->p_playlist );
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
     free( p_intf->p_sys );
 }
@@ -112,9 +120,14 @@ static void Init( intf_thread_t *p_intf )
 {
     char *argv[] = { "" };
     int argc = 1;
+    Q_INIT_RESOURCE( vlc );
+
     QApplication *app = new QApplication( argc, argv , true );
     p_intf->p_sys->p_app = app;
 
+    // Initialize timers
+    DialogsProvider::getInstance( p_intf );
+
     /* Normal interface */
     if( !p_intf->pf_show_dialog )
     {
@@ -123,13 +136,12 @@ static void Init( intf_thread_t *p_intf )
         p_mi->show();
     }
 
-    DialogsProvider::getInstance( p_intf );
-
     if( p_intf->pf_show_dialog )
         vlc_thread_ready( p_intf );
 
     app->setQuitOnLastWindowClosed( false );
     app->exec();
+    delete p_intf->p_sys->p_mi;
 }
 
 /*****************************************************************************
@@ -142,3 +154,16 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
     QApplication::postEvent( DialogsProvider::getInstance( p_intf ),
                              static_cast<QEvent*>(event) );
 }
+
+/*****************************************************************************
+ * PopupMenuCB: callback to show the popupmenu.
+ *  We don't show the menu directly here because we don't want the
+ *  caller to block for a too long time.
+ *****************************************************************************/
+static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+                        vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+    intf_thread_t *p_intf = (intf_thread_t *)param;
+    ShowDialog( p_intf, INTF_DIALOG_POPUPMENU, new_val.b_bool, 0 );
+    return VLC_SUCCESS;
+}