Commit fc3b9a8e authored by Laurent Aimar's avatar Laurent Aimar

Implemented 'Boss Key' in qt4 interface (close #3838).

 There is an incorrect interaction with 'pause on minimized' feature
when showing back the video (depending on qt-system-tray).
parent 1fde8b5a
...@@ -68,6 +68,8 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, ...@@ -68,6 +68,8 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param ); vlc_value_t old_val, vlc_value_t new_val, void *param );
static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable, static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param ); vlc_value_t old_val, vlc_value_t new_val, void *param );
static int IntfBossCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
...@@ -235,6 +237,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -235,6 +237,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( this, askToQuit(), THEDP, quit() ); CONNECT( this, askToQuit(), THEDP, quit() );
CONNECT( this, askBoss(), this, setBoss() );
/** END of CONNECTS**/ /** END of CONNECTS**/
...@@ -242,6 +246,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -242,6 +246,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
* Callbacks * Callbacks
************/ ************/
var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf ); var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
var_AddCallback( p_intf->p_libvlc, "intf-boss", IntfBossCB, p_intf );
/* Register callback for the intf-popupmenu variable */ /* Register callback for the intf-popupmenu variable */
var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf ); var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
...@@ -326,6 +331,7 @@ MainInterface::~MainInterface() ...@@ -326,6 +331,7 @@ MainInterface::~MainInterface()
delete statusBar(); delete statusBar();
/* Unregister callbacks */ /* Unregister callbacks */
var_DelCallback( p_intf->p_libvlc, "intf-boss", IntfBossCB, p_intf );
var_DelCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf ); var_DelCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
var_DelCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf ); var_DelCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
...@@ -1267,6 +1273,25 @@ void MainInterface::toggleInterfaceFullScreen() ...@@ -1267,6 +1273,25 @@ void MainInterface::toggleInterfaceFullScreen()
emit fullscreenInterfaceToggled( b_interfaceFullScreen ); emit fullscreenInterfaceToggled( b_interfaceFullScreen );
} }
void MainInterface::emitBoss()
{
emit askBoss();
}
void MainInterface::setBoss()
{
THEMIM->pause();
#ifndef HAVE_MAEMO
if( sysTray )
{
hide();
}
else
#endif
{
showMinimized();
}
}
/***************************************************************************** /*****************************************************************************
* PopupMenuCB: callback triggered by the intf-popupmenu playlist variable. * PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.
* We don't show the menu directly here because we don't want the * We don't show the menu directly here because we don't want the
...@@ -1303,3 +1328,18 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable, ...@@ -1303,3 +1328,18 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
/* Show event */ /* Show event */
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/*****************************************************************************
* IntfBossCB: callback triggered by the intf-boss libvlc variable.
*****************************************************************************/
static int IntfBossCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
VLC_UNUSED( p_this ); VLC_UNUSED( psz_variable ); VLC_UNUSED( old_val );
VLC_UNUSED( new_val );
intf_thread_t *p_intf = (intf_thread_t *)param;
p_intf->p_sys->p_mi->emitBoss();
return VLC_SUCCESS;
}
...@@ -203,6 +203,8 @@ public slots: ...@@ -203,6 +203,8 @@ public slots:
unsigned *pi_width, unsigned *pi_height ); unsigned *pi_width, unsigned *pi_height );
void releaseVideoSlot( void ); void releaseVideoSlot( void );
void emitBoss();
private slots: private slots:
void debug(); void debug();
void destroyPopupMenu(); void destroyPopupMenu();
...@@ -240,6 +242,7 @@ private slots: ...@@ -240,6 +242,7 @@ private slots:
void setVideoSize( unsigned int, unsigned int ); void setVideoSize( unsigned int, unsigned int );
void setVideoFullScreen( bool ); void setVideoFullScreen( bool );
void setVideoOnTop( bool ); void setVideoOnTop( bool );
void setBoss();
signals: signals:
void askGetVideo( WId *p_id, int *pi_x, int *pi_y, void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
...@@ -251,6 +254,7 @@ signals: ...@@ -251,6 +254,7 @@ signals:
void minimalViewToggled( bool ); void minimalViewToggled( bool );
void fullscreenInterfaceToggled( bool ); void fullscreenInterfaceToggled( bool );
void askToQuit(); void askToQuit();
void askBoss();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment