Commit 190459cf authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: menus, force ViewMenu to run at menuBar creation.

Fixes #3406
parent ccb91d37
...@@ -860,6 +860,9 @@ void MainInterface::dockPlaylist( bool p_docked ) ...@@ -860,6 +860,9 @@ void MainInterface::dockPlaylist( bool p_docked )
} }
} }
/*
If b_switch is false, then we are normalView
*/
void MainInterface::toggleMinimalView( bool b_switch ) void MainInterface::toggleMinimalView( bool b_switch )
{ {
if( i_visualmode == 0 ) if( i_visualmode == 0 )
......
...@@ -295,8 +295,12 @@ void QVLCMenu::createMenuBar( MainInterface *mi, ...@@ -295,8 +295,12 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 ); BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
BAR_ADD( ToolsMenu( bar ), qtr( "&Tools" ) ); BAR_ADD( ToolsMenu( bar ), qtr( "&Tools" ) );
BAR_ADD( ViewMenu( p_intf, bar ), qtr( "V&iew" ) ); QMenu *_menu = ViewMenu( p_intf, bar );
_menu->setTitle( qtr( "V&iew" ) );
bar->addMenu( _menu );
ViewMenu( p_intf, _menu, mi );
BAR_ADD( HelpMenu( bar ), qtr( "&Help" ) ); BAR_ADD( HelpMenu( bar ), qtr( "&Help" ) );
} }
#undef BAR_ADD #undef BAR_ADD
#undef BAR_DADD #undef BAR_DADD
...@@ -415,7 +419,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QWidget* parent ) ...@@ -415,7 +419,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QWidget* parent )
* View Menu * View Menu
* Interface modification, load other interfaces, activate Extensions * Interface modification, load other interfaces, activate Extensions
**/ **/
QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current ) QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface *_mi )
{ {
QAction *action; QAction *action;
QMenu *menu; QMenu *menu;
...@@ -430,7 +434,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current ) ...@@ -430,7 +434,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current )
menu->clear(); menu->clear();
} }
MainInterface *mi = p_intf->p_sys->p_mi; MainInterface *mi = _mi ? _mi : p_intf->p_sys->p_mi;
assert( mi ); assert( mi );
menu->addAction( QIcon( ":/menu/playlist_menu" ), menu->addAction( QIcon( ":/menu/playlist_menu" ),
...@@ -446,7 +450,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current ) ...@@ -446,7 +450,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current )
action = menu->addAction( qtr( "Mi&nimal View" ) ); action = menu->addAction( qtr( "Mi&nimal View" ) );
action->setShortcut( qtr( "Ctrl+H" ) ); action->setShortcut( qtr( "Ctrl+H" ) );
action->setCheckable( true ); action->setCheckable( true );
action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) ); action->setChecked( !current && (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) ); CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) ); CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
......
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
static void MiscPopupMenu( intf_thread_t * ); static void MiscPopupMenu( intf_thread_t * );
/* Systray */ /* Systray */
static void updateSystrayMenu( MainInterface *,intf_thread_t *, static void updateSystrayMenu( MainInterface *, intf_thread_t *,
bool b_force_visible = false); bool b_force_visible = false);
/* Actions */ /* Actions */
...@@ -100,7 +100,7 @@ private: ...@@ -100,7 +100,7 @@ private:
static QMenu *ToolsMenu( QWidget * ); static QMenu *ToolsMenu( QWidget * );
static QMenu *ViewMenu( intf_thread_t *, QWidget * ); static QMenu *ViewMenu( intf_thread_t *, QWidget * );
static QMenu *ViewMenu( intf_thread_t *, QMenu * ); static QMenu *ViewMenu( intf_thread_t *, QMenu *, MainInterface * mi = NULL );
static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * ); static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
static void ExtensionsMenu( intf_thread_t *p_intf, QMenu * ); static void ExtensionsMenu( intf_thread_t *p_intf, QMenu * );
......
...@@ -448,12 +448,12 @@ static void *Thread( void *obj ) ...@@ -448,12 +448,12 @@ static void *Thread( void *obj )
p_mi = new MainInterface( p_intf ); p_mi = new MainInterface( p_intf );
else else
p_mi = NULL; p_mi = NULL;
p_intf->p_sys->p_mi = p_mi;
/* Explain how to show a dialog :D */ /* Explain how to show a dialog :D */
p_intf->pf_show_dialog = ShowDialog; p_intf->pf_show_dialog = ShowDialog;
/* */ /* */
p_intf->p_sys->p_mi = p_mi;
vlc_sem_post (&ready); vlc_sem_post (&ready);
/* Last settings */ /* Last settings */
......
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