Commit 087123fe authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: menu, code simplification.

parent 4d866e7a
...@@ -79,8 +79,8 @@ public slots: ...@@ -79,8 +79,8 @@ public slots:
void toggleMuteAudio(); void toggleMuteAudio();
void AudioUp(); void AudioUp();
void AudioDown(); void AudioDown();
protected slots:
void play(); void play();
protected slots:
void fullscreen(); void fullscreen();
void snapshot(); void snapshot();
void playlist(); void playlist();
......
...@@ -614,6 +614,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) ...@@ -614,6 +614,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
} }
/* */
input_thread_t *p_object; input_thread_t *p_object;
vector<vlc_object_t *> objects; vector<vlc_object_t *> objects;
vector<const char *> varnames; vector<const char *> varnames;
...@@ -622,15 +623,20 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) ...@@ -622,15 +623,20 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
if( p_object ) if( p_object )
vlc_object_hold( p_object ); vlc_object_hold( p_object );
InputAutoMenuBuilder( p_object, objects, varnames ); InputAutoMenuBuilder( p_object, objects, varnames );
/* Title and so on */
PUSH_VAR( "prev-title" ); PUSH_VAR( "prev-title" );
PUSH_VAR( "next-title" ); PUSH_VAR( "next-title" );
PUSH_VAR( "prev-chapter" ); PUSH_VAR( "prev-chapter" );
PUSH_VAR( "next-chapter" ); PUSH_VAR( "next-chapter" );
menu->addSeparator();
EnableStaticEntries( menu, ( p_object != NULL ) ); EnableStaticEntries( menu, ( p_object != NULL ) );
if( p_object ) if( p_object )
{
vlc_object_release( p_object ); vlc_object_release( p_object );
}
return Populate( p_intf, menu, varnames, objects ); return Populate( p_intf, menu, varnames, objects );
} }
...@@ -715,23 +721,17 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, ...@@ -715,23 +721,17 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
intf_thread_t *p_intf, intf_thread_t *p_intf,
input_thread_t *p_input ) input_thread_t *p_input )
{ {
if( p_input ) if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
{
QAction *action = menu->addAction( qtr( "Play" ),
ActionsManager::getInstance( p_intf ), SLOT( play() ) );
action->setIcon( QIcon( ":/play" ) );
}
else
{ {
vlc_value_t val;
var_Get( p_input, "state", &val );
if( val.i_int == PLAYING_S )
addMIMStaticEntry( p_intf, menu, qtr( "Pause" ), addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
":/pause", SLOT( togglePlayPause() ) ); ":/pause", SLOT( togglePlayPause() ) );
else
addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
":/play", SLOT( togglePlayPause() ) );
} }
else if( THEPL->items.i_size )
addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
":/play", SLOT( togglePlayPause() ) );
else
addDPStaticEntry( menu, qtr( "Play" ),
":/play", SLOT( openDialog() ) );
addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), addMIMStaticEntry( p_intf, menu, qtr( "Stop" ),
":/stop", SLOT( stop() ) ); ":/stop", SLOT( stop() ) );
......
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