[vlc-devel] commit: Fix popup menu play and interface entries. (Jean-Baptiste Kempf )
git version control
git at videolan.org
Wed Jun 18 08:33:41 CEST 2008
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Jun 17 23:21:55 2008 -0700| [3b4ca0c1da25a49b3126f319ae19f12d2538fc37]
Fix popup menu play and interface entries.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b4ca0c1da25a49b3126f319ae19f12d2538fc37
---
modules/gui/qt4/menus.cpp | 38 ++++++++++++++++++++++++++++++--------
modules/gui/qt4/menus.hpp | 8 +++++---
2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 7850c30..2e6e319 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -463,7 +463,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
**/
QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
{
- vlc_object_t *p_object;
+ vlc_object_t *p_vout;
input_thread_t *p_input;
vector<int> objects;
vector<const char *> varnames;
@@ -496,13 +496,13 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
p_input = THEMIM->getInput();
if( p_input )
vlc_object_yield( p_input );
- p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_VOUT,
+ p_vout = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
- VideoAutoMenuBuilder( p_object, p_input, objects, varnames );
+ VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
- if( p_object )
- vlc_object_release( p_object );
+ if( p_vout )
+ vlc_object_release( p_vout );
if( p_input )
vlc_object_release( p_input );
@@ -639,6 +639,9 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
else if( THEPL->items.i_size )
addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "",
":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) );
+ else
+ addDPStaticEntry( menu, qtr( "Play" ), "",
+ ":/pixmaps/play_16px.png", SLOT( openDialog() ) );
addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), "",
":/pixmaps/stop_16px.png", SLOT( stop() ) );
@@ -759,15 +762,34 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
QMenu *menu = new QMenu();
QMenu *submenu;
QAction *action;
+ bool b_isFullscreen = false;
POPUP_BOILERPLATE;
PopupMenuControlEntries( menu, p_intf, p_input );
menu->addSeparator();
- bool b_fullscreen;
if( p_input )
{
+ vlc_object_t *p_vout = (vlc_object_t *)
+ vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
+
+ /* Add a fullscreen switch button */
+ if( p_vout )
+ {
+ vlc_value_t val;
+ var_Get( p_vout, "fullscreen", &val );
+ b_isFullscreen = !( !val.b_bool );
+ if( b_isFullscreen )
+ CreateAndConnect( menu, "fullscreen",
+ qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
+ p_vout->i_object_id, val, VLC_VAR_BOOL,
+ b_isFullscreen );
+ }
+
+ vlc_object_release( p_vout );
+ menu->addSeparator();
+
vlc_object_yield( p_input );
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
vlc_object_release( p_input );
@@ -793,8 +815,8 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
menu->addSeparator();
- /* Add some special entries for windowed mode */
- if( !b_fullscreen )
+ /* Add some special entries for windowed mode: Interface Menu */
+ if( !b_isFullscreen )
{
submenu = new QMenu( qtr( "Interface" ), menu );
submenu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ),
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index 07384e1..893a3a4 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -78,7 +78,8 @@ public:
static QMenu *FileMenu();
static QMenu *SDMenu( intf_thread_t * );
static QMenu *PlaylistMenu( intf_thread_t *, MainInterface * );
- static QMenu *ToolsMenu( intf_thread_t *, QMenu *, MainInterface *, bool, bool with = true );
+ static QMenu *ToolsMenu( intf_thread_t *, QMenu *, MainInterface *,
+ bool, bool with = true );
static QMenu *NavigMenu( intf_thread_t *, QMenu * );
static QMenu *VideoMenu( intf_thread_t *, QMenu * );
static QMenu *AudioMenu( intf_thread_t *, QMenu * );
@@ -114,7 +115,7 @@ private:
class MenuFunc : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
MenuFunc( QMenu *_menu, int _id ) { menu = _menu; id = _id; };
@@ -128,7 +129,8 @@ public:
case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break;
}
};
- int id; QMenu *menu;
+ int id;
+ QMenu *menu;
};
#endif
More information about the vlc-devel
mailing list