[vlc-commits] Qt: add a close to systray menu option.

Jean-Baptiste Kempf git at videolan.org
Mon Apr 25 00:32:29 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr 25 00:31:52 2011 +0200| [17f0388b7e0d5bd26b2a159ccf6356ee9b1f288a] | committer: Jean-Baptiste Kempf

Qt: add a close to systray menu option.

Close #2825

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

 modules/gui/qt4/main_interface.cpp |   12 ++++++------
 modules/gui/qt4/menus.cpp          |   10 ++++++++--
 modules/gui/qt4/menus.hpp          |    2 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 7fbb8cb..bfc44b4 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -132,6 +132,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     settings->endGroup( );
 
+    /*********************************
+     * Create the Systray Management *
+     *********************************/
+    initSystray();
+
     /**************************
      *  UI and Widgets design
      **************************/
@@ -152,11 +157,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     createStatusBar();
     setStatusBarVisibility( getSettings()->value( "MainWindow/status-bar-visible", false ).toBool() );
 
-    /*********************************
-     * Create the Systray Management *
-     *********************************/
-    initSystray();
-
     /********************
      * Input Manager    *
      ********************/
@@ -971,7 +971,7 @@ void MainInterface::createSystray()
     sysTray->show();
 
     CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ),
-            this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
+             this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
 }
 
 /**
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 952b244..11b5715 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -309,7 +309,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
        setDesktopAware set to false */
     QMenuBar *bar = mi->menuBar();
 
-    addMenuToMainbar( FileMenu( p_intf, bar ), qtr( "&Media" ), bar );
+    addMenuToMainbar( FileMenu( p_intf, bar, mi ), qtr( "&Media" ), bar );
 
     /* Dynamic menus, rebuilt before being showed */
     BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 );
@@ -329,7 +329,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
  * Media ( File ) Menu
  * Opening, streaming and quit
  **/
-QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent )
+QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi )
 {
     QMenu *menu = new QMenu( parent );
     QAction *action;
@@ -379,6 +379,12 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent )
     action->setCheckable( true );
     action->setChecked( THEMIM->getPlayExitState() );
 
+    if( mi->getSysTray() )
+    {
+        action = menu->addAction( qtr( "Close to systray"), mi,
+                                 SLOT( toggleUpdateSystrayMenu() ) );
+    }
+
     addDPStaticEntry( menu, qtr( "&Quit" ) ,
         ":/menu/quit", SLOT( quit() ), "Ctrl+Q" );
     return menu;
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index ed6900c..b28df6d 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -93,7 +93,7 @@ public:
 
 private:
     /* All main Menus */
-    static QMenu *FileMenu( intf_thread_t *, QWidget * );
+    static QMenu *FileMenu( intf_thread_t *, QWidget *, MainInterface * mi = NULL );
 
     static QMenu *ToolsMenu( QMenu * );
     static QMenu *ToolsMenu( QWidget *parent ) { return ToolsMenu( new QMenu( parent ) ); }



More information about the vlc-commits mailing list