[vlc-commits] Qt: menu simplification
Jean-Baptiste Kempf
git at videolan.org
Tue Feb 28 03:38:23 CET 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Feb 28 02:24:12 2012 +0100| [3f5029f86312e70edb86252dabcaae3ba6a71cc5] | committer: Jean-Baptiste Kempf
Qt: menu simplification
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f5029f86312e70edb86252dabcaae3ba6a71cc5
---
modules/gui/qt4/menus.cpp | 67 +++++++++++++++++++-------------------------
modules/gui/qt4/menus.hpp | 6 ++--
2 files changed, 32 insertions(+), 41 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 7d8df49..44654a4 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -733,8 +733,7 @@ QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_
delete actions[i];
}
- PopupPlayEntries( menu, p_intf, p_object );
- PopupMenuPlaylistControlEntries( menu, p_intf );
+ PopupMenuPlaylistEntries( menu, p_intf, p_object );
/* */
EnableStaticEntries( menu, (p_object != NULL ) );
@@ -776,7 +775,7 @@ QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
Populate( p_intf, menu, varnames, objects ); \
menu->popup( QCursor::pos() ); \
-void VLCMenuBar::PopupPlayEntries( QMenu *menu,
+void VLCMenuBar::PopupMenuPlaylistEntries( QMenu *menu,
intf_thread_t *p_intf,
input_thread_t *p_input )
{
@@ -793,9 +792,31 @@ void VLCMenuBar::PopupPlayEntries( QMenu *menu,
}
else
{
- addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
- ":/menu/pause", SLOT( togglePlayPause() ) );
+ addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
+ ":/menu/pause", SLOT( togglePlayPause() ) );
}
+
+ /* Stop */
+ action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
+ ":/menu/stop", SLOT( stop() ), true );
+ if( !p_input )
+ action->setEnabled( false );
+
+ /* Next / Previous */
+ bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
+ action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
+ ":/menu/previous", SLOT( prev() ), true );
+ action->setEnabled( !bPlaylistEmpty );
+ action->setData( ACTION_NO_CLEANUP );
+ CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
+
+ action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
+ ":/menu/next", SLOT( next() ), true );
+ action->setEnabled( !bPlaylistEmpty );
+ action->setData( ACTION_NO_CLEANUP );
+ CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
+
+ menu->addSeparator();
}
void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
@@ -863,33 +884,6 @@ void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
menu->addSeparator();
}
-void VLCMenuBar::PopupMenuPlaylistControlEntries( QMenu *menu,
- intf_thread_t *p_intf )
-{
- bool bEnable = THEMIM->getInput() != NULL;
- bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
- QAction *action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
- ":/menu/stop", SLOT( stop() ), true );
- /* Disable Stop in the right-click popup menu */
- if( !bEnable )
- action->setEnabled( false );
-
- /* Next / Previous */
- action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
- ":/menu/previous", SLOT( prev() ), true );
- action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP );
- CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
-
- action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
- ":/menu/next", SLOT( next() ), true );
- action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP );
- CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
-
- menu->addSeparator();
-}
-
void VLCMenuBar::PopupMenuStaticEntries( QMenu *menu )
{
QMenu *openmenu = new QMenu( qtr( "Open Media" ), menu );
@@ -962,8 +956,7 @@ void VLCMenuBar::MiscPopupMenu( intf_thread_t *p_intf, bool show )
Populate( p_intf, menu, varnames, objects );
menu->addSeparator();
- PopupPlayEntries( menu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( menu, p_intf);
+ PopupMenuPlaylistEntries( menu, p_intf, p_input );
menu->addSeparator();
PopupMenuControlEntries( menu, p_intf );
@@ -985,8 +978,7 @@ void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
bool b_isFullscreen = false;
MainInterface *mi = p_intf->p_sys->p_mi;
- PopupPlayEntries( menu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( menu, p_intf );
+ PopupMenuPlaylistEntries( menu, p_intf, p_input );
menu->addSeparator();
if( p_input )
@@ -1130,8 +1122,7 @@ void VLCMenuBar::updateSystrayMenu( MainInterface *mi,
sysMenu->addSeparator();
#endif
- PopupPlayEntries( sysMenu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( sysMenu, p_intf);
+ PopupMenuPlaylistEntries( sysMenu, p_intf, p_input );
PopupMenuControlEntries( sysMenu, p_intf, false );
VolumeEntries( p_intf, sysMenu );
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index 8ffa9a6..b880985 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -131,10 +131,10 @@ private:
/* Popups Menus */
static void PopupMenuStaticEntries( QMenu *menu );
- static void PopupPlayEntries( QMenu *menu, intf_thread_t *p_intf,
- input_thread_t *p_input );
- static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, bool b = true );
+ static void PopupMenuPlaylistEntries( QMenu *menu, intf_thread_t *p_intf,
+ input_thread_t *p_input );
static void PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf );
+ static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, bool b = true );
/* Generic automenu methods */
static QMenu * Populate( intf_thread_t *, QMenu *current,
More information about the vlc-commits
mailing list