[vlc-commits] Implemented 'Boss Key' in qt4 interface (close #3838).
Laurent Aimar
git at videolan.org
Mon Sep 5 23:13:12 CEST 2011
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Sep 5 23:10:24 2011 +0200| [fc3b9a8e6d706f547d10010556a76e4de76b8e3c] | committer: 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).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fc3b9a8e6d706f547d10010556a76e4de76b8e3c
---
modules/gui/qt4/main_interface.cpp | 40 ++++++++++++++++++++++++++++++++++++
modules/gui/qt4/main_interface.hpp | 4 +++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index d9bd7ea..193bf7f 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -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 );
static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
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 )
{
@@ -235,6 +237,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( this, askToQuit(), THEDP, quit() );
+ CONNECT( this, askBoss(), this, setBoss() );
+
/** END of CONNECTS**/
@@ -242,6 +246,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
* Callbacks
************/
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 */
var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
@@ -326,6 +331,7 @@ MainInterface::~MainInterface()
delete statusBar();
/* 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-popupmenu", PopupMenuCB, p_intf );
@@ -1267,6 +1273,25 @@ void MainInterface::toggleInterfaceFullScreen()
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.
* 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,
/* Show event */
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;
+}
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index d96d6cb..cfac21f 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -203,6 +203,8 @@ public slots:
unsigned *pi_width, unsigned *pi_height );
void releaseVideoSlot( void );
+ void emitBoss();
+
private slots:
void debug();
void destroyPopupMenu();
@@ -240,6 +242,7 @@ private slots:
void setVideoSize( unsigned int, unsigned int );
void setVideoFullScreen( bool );
void setVideoOnTop( bool );
+ void setBoss();
signals:
void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
@@ -251,6 +254,7 @@ signals:
void minimalViewToggled( bool );
void fullscreenInterfaceToggled( bool );
void askToQuit();
+ void askBoss();
};
More information about the vlc-commits
mailing list