[vlc-commits] commit: Qt: menus, force ViewMenu to run at menuBar creation. ( Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Sat Mar 13 16:19:01 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Mar 13 16:06:09 2010 +0100| [190459cf85bb73f05b12b86c3740365627218745] | committer: Jean-Baptiste Kempf 

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

Fixes #3406

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=190459cf85bb73f05b12b86c3740365627218745
---

 modules/gui/qt4/main_interface.cpp |    3 +++
 modules/gui/qt4/menus.cpp          |   12 ++++++++----
 modules/gui/qt4/menus.hpp          |    4 ++--
 modules/gui/qt4/qt4.cpp            |    2 +-
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 6c717b4..150aff8 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -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 )
 {
     if( i_visualmode == 0 )
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 310dcc7..a58a8bc 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -295,8 +295,12 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
     BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
 
     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" ) );
+
 }
 #undef BAR_ADD
 #undef BAR_DADD
@@ -415,7 +419,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QWidget* parent )
  * View Menu
  * 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;
     QMenu *menu;
@@ -430,7 +434,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current )
         menu->clear();
     }
 
-    MainInterface *mi = p_intf->p_sys->p_mi;
+    MainInterface *mi = _mi ? _mi : p_intf->p_sys->p_mi;
     assert( mi );
 
     menu->addAction( QIcon( ":/menu/playlist_menu" ),
@@ -446,7 +450,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current )
     action = menu->addAction( qtr( "Mi&nimal View" ) );
     action->setShortcut( qtr( "Ctrl+H" ) );
     action->setCheckable( true );
-    action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
+    action->setChecked( !current && (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
 
     CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
     CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index 4ff29ac..4a022ce 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -85,7 +85,7 @@ public:
     static void MiscPopupMenu( intf_thread_t * );
 
     /* Systray */
-    static void updateSystrayMenu( MainInterface *,intf_thread_t  *,
+    static void updateSystrayMenu( MainInterface *, intf_thread_t  *,
                                    bool b_force_visible = false);
 
     /* Actions */
@@ -100,7 +100,7 @@ private:
     static QMenu *ToolsMenu( 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 void ExtensionsMenu( intf_thread_t *p_intf, QMenu * );
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index bfd30ab..d633d8a 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -448,12 +448,12 @@ static void *Thread( void *obj )
         p_mi = new MainInterface( p_intf );
     else
         p_mi = NULL;
+    p_intf->p_sys->p_mi = p_mi;
 
     /* Explain how to show a dialog :D */
     p_intf->pf_show_dialog = ShowDialog;
 
     /* */
-    p_intf->p_sys->p_mi = p_mi;
     vlc_sem_post (&ready);
 
     /* Last settings */



More information about the vlc-commits mailing list