Commit afad1bb5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: simplify systray menu and add volume control

Some speed/seek functions are now gone, because they don't really make
sense for an audio playback.
Volume functions are now in, because this is useful
parent f06b4d30
...@@ -560,6 +560,21 @@ void QVLCMenu::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu ) ...@@ -560,6 +560,21 @@ void QVLCMenu::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu )
extMgr->menu( extMenu ); extMgr->menu( extMenu );
} }
static inline void VolumeEntries( intf_thread_t *p_intf, QMenu *current )
{
current->addSeparator();
QAction *action = current->addAction( qtr( "Increase Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
action->setData( STATIC_ENTRY );
action = current->addAction( qtr( "Decrease Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
action->setData( STATIC_ENTRY );
action = current->addAction( qtr( "Mute" ),
ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
action->setData( STATIC_ENTRY );
}
/** /**
* Main Audio Menu * Main Audio Menu
**/ **/
...@@ -578,17 +593,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current ) ...@@ -578,17 +593,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
current->addSeparator(); current->addSeparator();
addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) ); addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) );
current->addSeparator(); VolumeEntries( p_intf, current );
QAction *action = current->addAction( qtr( "Increase Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
action->setData( STATIC_ENTRY );
action = current->addAction( qtr( "Decrease Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
action->setData( STATIC_ENTRY );
action = current->addAction( qtr( "Mute" ),
ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
action->setData( STATIC_ENTRY );
} }
p_input = THEMIM->getInput(); p_input = THEMIM->getInput();
...@@ -786,17 +791,21 @@ void QVLCMenu::PopupPlayEntries( QMenu *menu, ...@@ -786,17 +791,21 @@ void QVLCMenu::PopupPlayEntries( QMenu *menu,
} }
} }
void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
bool b_normal )
{ {
QAction *action; QAction *action;
/* Faster/Slower */ if( b_normal )
action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(), {
SLOT( faster() ) ); /* Faster/Slower */
action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
SLOT( faster() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */ #ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/faster2") ); action->setIcon( QIcon( ":/toolbar/faster2") );
#endif #endif
action->setData( STATIC_ENTRY ); action->setData( STATIC_ENTRY );
}
action = menu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(), action = menu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
SLOT( littlefaster() ) ); SLOT( littlefaster() ) );
...@@ -810,15 +819,20 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) ...@@ -810,15 +819,20 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf )
SLOT( littleslower() ) ); SLOT( littleslower() ) );
action->setData( STATIC_ENTRY ); action->setData( STATIC_ENTRY );
action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(), if( b_normal )
SLOT( slower() ) ); {
action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
SLOT( slower() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */ #ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/slower2") ); action->setIcon( QIcon( ":/toolbar/slower2") );
#endif #endif
action->setData( STATIC_ENTRY ); action->setData( STATIC_ENTRY );
}
menu->addSeparator(); menu->addSeparator();
if( !b_normal ) return;
action = menu->addAction( qtr( "&Jump Forward" ), THEMIM->getIM(), action = menu->addAction( qtr( "&Jump Forward" ), THEMIM->getIM(),
SLOT( jumpFwd() ) ); SLOT( jumpFwd() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */ #ifndef __APPLE__ /* No icons in menus in Mac */
...@@ -1092,8 +1106,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, ...@@ -1092,8 +1106,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
PopupPlayEntries( sysMenu, p_intf, p_input ); PopupPlayEntries( sysMenu, p_intf, p_input );
PopupMenuPlaylistControlEntries( sysMenu, p_intf); PopupMenuPlaylistControlEntries( sysMenu, p_intf);
PopupMenuControlEntries( sysMenu, p_intf); PopupMenuControlEntries( sysMenu, p_intf, false );
VolumeEntries( p_intf, sysMenu );
sysMenu->addSeparator();
addDPStaticEntry( sysMenu, qtr( "&Open a Media" ), addDPStaticEntry( sysMenu, qtr( "&Open a Media" ),
":/type/file-wide", SLOT( openFileDialog() ) ); ":/type/file-wide", SLOT( openFileDialog() ) );
addDPStaticEntry( sysMenu, qtr( "&Quit" ) , addDPStaticEntry( sysMenu, qtr( "&Quit" ) ,
......
...@@ -126,7 +126,7 @@ private: ...@@ -126,7 +126,7 @@ private:
static void PopupMenuStaticEntries( QMenu *menu ); static void PopupMenuStaticEntries( QMenu *menu );
static void PopupPlayEntries( QMenu *menu, intf_thread_t *p_intf, static void PopupPlayEntries( QMenu *menu, intf_thread_t *p_intf,
input_thread_t *p_input ); input_thread_t *p_input );
static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ); static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, bool b = true );
static void PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf ); static void PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf );
/* Generic automenu methods */ /* Generic automenu methods */
......
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