Commit 17f0388b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: add a close to systray menu option.

Close #2825
parent c65a0ac1
......@@ -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 ) );
}
/**
......
......@@ -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;
......
......@@ -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 ) ); }
......
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