Commit 9ea4f58e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Subtitles menu

parent 9cbd95e7
...@@ -321,6 +321,7 @@ void VLCMenuBar::createMenuBar( MainInterface *mi, ...@@ -321,6 +321,7 @@ void VLCMenuBar::createMenuBar( MainInterface *mi,
BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 ); BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 );
BAR_DADD( AudioMenu( p_intf, bar ), qtr( "&Audio" ), 1 ); BAR_DADD( AudioMenu( p_intf, bar ), qtr( "&Audio" ), 1 );
BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 ); BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
BAR_DADD( SubtitleMenu( p_intf, bar ), qtr( "Subti&tle" ), 5 );
addMenuToMainbar( ToolsMenu( bar ), qtr( "&Tools" ), bar ); addMenuToMainbar( ToolsMenu( bar ), qtr( "&Tools" ), bar );
...@@ -619,16 +620,19 @@ QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current ) ...@@ -619,16 +620,19 @@ QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current )
} }
/* Subtitles */ /* Subtitles */
QMenu *VLCMenuBar::SubtitleMenu( QMenu *current ) QMenu *VLCMenuBar::SubtitleMenu( intf_thread_t *, QMenu *current )
{ {
QAction *action; if( current->isEmpty() )
QMenu *submenu = new QMenu( qtr( "&Subtitle Track" ), current ); {
action = current->addMenu( submenu ); QAction *action;
action->setData( "spu-es" ); QMenu *submenu = new QMenu( qtr( "&Subtitle Track" ), current );
addDPStaticEntry( submenu, qtr( "Open File..." ), "", action = current->addMenu( submenu );
SLOT( loadSubtitlesFile() ) ); action->setData( "spu-es" );
submenu->addSeparator(); addDPStaticEntry( submenu, qtr( "Open File..." ), "",
return submenu; SLOT( loadSubtitlesFile() ) );
submenu->addSeparator();
}
return current;
} }
/** /**
...@@ -646,7 +650,7 @@ QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subt ...@@ -646,7 +650,7 @@ QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subt
{ {
addActionWithSubmenu( current, "video-es", qtr( "Video &Track" ) ); addActionWithSubmenu( current, "video-es", qtr( "Video &Track" ) );
if( b_subtitle) if( b_subtitle)
SubtitleMenu( current ); SubtitleMenu( p_intf, current );
current->addSeparator(); current->addSeparator();
/* Surface modifiers */ /* Surface modifiers */
...@@ -1036,7 +1040,7 @@ void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -1036,7 +1040,7 @@ void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
if( action->menu()->isEmpty() ) if( action->menu()->isEmpty() )
action->setEnabled( false ); action->setEnabled( false );
submenu = SubtitleMenu( menu ); submenu = SubtitleMenu( p_intf, menu );
submenu->setTitle( qtr( "Subti&tle") ); submenu->setTitle( qtr( "Subti&tle") );
UpdateItem( p_intf, menu, "spu-es", VLC_OBJECT(p_input), true ); UpdateItem( p_intf, menu, "spu-es", VLC_OBJECT(p_input), true );
......
...@@ -117,11 +117,14 @@ private: ...@@ -117,11 +117,14 @@ private:
} }
static QMenu *RebuildNavigMenu( intf_thread_t *, QMenu *, bool b_keep = false ); static QMenu *RebuildNavigMenu( intf_thread_t *, QMenu *, bool b_keep = false );
static QMenu *VideoMenu( intf_thread_t *, QMenu *, bool b_subtitle = true ); static QMenu *VideoMenu( intf_thread_t *, QMenu *, bool b_subtitle = false );
static QMenu *VideoMenu( intf_thread_t *p_intf, QWidget *parent ) { static QMenu *VideoMenu( intf_thread_t *p_intf, QWidget *parent ) {
return VideoMenu( p_intf, new QMenu( parent ) ); return VideoMenu( p_intf, new QMenu( parent ) );
} }
static QMenu *SubtitleMenu( QMenu *current); static QMenu *SubtitleMenu( intf_thread_t *, QMenu *current);
static QMenu *SubtitleMenu( intf_thread_t *p_intf, QWidget *parent) {
return SubtitleMenu( p_intf, new QMenu( parent ) );
}
static QMenu *AudioMenu( intf_thread_t *, QMenu * ); static QMenu *AudioMenu( intf_thread_t *, QMenu * );
static QMenu *AudioMenu( intf_thread_t *p_intf, QWidget *parent ) { static QMenu *AudioMenu( intf_thread_t *p_intf, QWidget *parent ) {
...@@ -173,6 +176,7 @@ public: ...@@ -173,6 +176,7 @@ public:
case 2: VLCMenuBar::VideoMenu( p_intf, menu ); break; case 2: VLCMenuBar::VideoMenu( p_intf, menu ); break;
case 3: VLCMenuBar::RebuildNavigMenu( p_intf, menu ); break; case 3: VLCMenuBar::RebuildNavigMenu( p_intf, menu ); break;
case 4: VLCMenuBar::ViewMenu( p_intf, menu ); break; case 4: VLCMenuBar::ViewMenu( p_intf, menu ); break;
case 5: VLCMenuBar::SubtitleMenu( p_intf, menu ); break;
} }
} }
private: private:
......
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