Commit cd669541 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

qt4 - Systray: - Repair the hide-and-never-show-back bug,

               - Repair the quit-VLC-but-let-the-menu W32 bug,
               - add an option to start VLC minimized.
parent 12dcce3f
......@@ -159,9 +159,16 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
var_AddCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
vlc_object_release( p_playlist );
}
if( QSystemTrayIcon::isSystemTrayAvailable() &&
( config_GetInt( p_intf, "qt-start-mininimized") == 1))
{
hide();
createSystrayMenu();
}
if( QSystemTrayIcon::isSystemTrayAvailable() &&
( config_GetInt( p_intf, "qt-system-tray") == 1))
createSystrayMenu();
}
MainInterface::~MainInterface()
......@@ -275,7 +282,7 @@ void MainInterface::handleMainUi( QSettings *settings )
void MainInterface::createSystrayMenu()
{
QIcon iconVLC = QIcon( QPixmap( ":/vlc128.png" ) );
sysTray = new QSystemTrayIcon( iconVLC );
sysTray = new QSystemTrayIcon( iconVLC, this );
systrayMenu = new QMenu( qtr( "VLC media player" ), this );
systrayMenu->setIcon( iconVLC );
QVLCMenu::updateSystrayMenu( this, p_intf, true );
......@@ -289,15 +296,22 @@ void MainInterface::updateSystrayMenu( int status )
QVLCMenu::updateSystrayMenu( this, p_intf ) ;
}
void MainInterface::toggleUpdateSystrayMenu()
{
QVLCMenu::updateSystrayMenu( this, p_intf );
toggleVisible();
}
void MainInterface::handleSystrayClick( QSystemTrayIcon::ActivationReason reason )
{
switch( reason )
{
case QSystemTrayIcon::Trigger:
this->show(); break;
this->toggleVisible(); break;
case QSystemTrayIcon::MiddleClick:
sysTray->showMessage( qtr( "VLC media player" ),
qtr( "Control menu for the player" ),
qtr( "Control menu for the player" )
+ nameLabel->text() ,
QSystemTrayIcon::Information, 4000 );
break;
}
......
......@@ -117,6 +117,7 @@ private:
public slots:
void undockPlaylist();
void playlist();
void toggleUpdateSystrayMenu();
private slots:
void setNavigation( int );
void setStatus( int );
......@@ -130,8 +131,8 @@ private slots:
void visual();
void advanced();
void updateVolume( int sliderVolume );
void updateSystrayMenu( int );
void handleSystrayClick( QSystemTrayIcon::ActivationReason );
void updateSystrayMenu( int );
};
......
......@@ -600,13 +600,15 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, intf_thread_t *p_intf,
POPUP_PLAY_ENTRIES( sysMenu );
sysMenu->addSeparator();
if( mi->isVisible() || b_force_visible )
if( !mi->isVisible() || b_force_visible )
{
sysMenu->addAction( qtr("Hide Interface"), mi, SLOT( hide() ) );
sysMenu->addAction( qtr("Hide Interface"), mi,
SLOT( toggleUpdateSystrayMenu() ) );
}
else
{
sysMenu->addAction( qtr("Show Interface"), mi, SLOT( show() ) );
sysMenu->addAction( qtr("Show Interface"), mi,
SLOT( toggleUpdateSystrayMenu() ) );
}
DP_SADD( sysMenu, qtr("&Open" ), "", "", openFileDialog(), "" );
DP_SADD( sysMenu, qtr("&Quit") , "", "", quit(), "" );
......
......@@ -53,6 +53,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
"in order to control VLC media player" \
"for basic actions")
#define MINIMIZED_TEXT N_("Start VLC only with a systray icon")
#define MINIMIZED_LONGTEXT N_("When you launch VLC with that option" \
"VLC will start just with an icon in" \
"your taskbar")
vlc_module_begin();
set_shortname( (char *)"Qt" );
set_description( (char*)_("Qt interface") );
......@@ -73,6 +77,8 @@ vlc_module_begin();
ADVANCED_PREFS_LONGTEXT, VLC_FALSE );
add_bool( "qt-system-tray", VLC_TRUE, NULL, SYSTRAY_TEXT,
SYSTRAY_LONGTEXT, VLC_FALSE);
add_bool( "qt-start-mininimized", VLC_FALSE, NULL, MINIMIZED_TEXT,
MINIMIZED_LONGTEXT, VLC_TRUE);
set_callbacks( OpenDialogs, Close );
vlc_module_end();
......
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