need_components_update = false;
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = videoIsActive = false;
-
+
input_name = "";
videoEmbeddedFlag = false;
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops(true);
+ /* Systray */
+ systray = NULL;
+ 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();
+
/* Init input manager */
MainInputManager::getInstance( p_intf );
ON_TIMEOUT( updateOnTimer() );
/* Naming in the controller */
CONNECT( THEMIM->getIM(), nameChanged( QString ), this,
setName( QString ) );
- if( config_GetInt( p_intf, "qt-system-tray" ) )
+ if( config_GetInt( p_intf, "qt-system-tray" ) && systray )
{
CONNECT( THEMIM->getIM(), nameChanged( QString ), this,
- updateSystrayTooltipName(QString));
+ updateSystrayTooltipName( QString ) );
}
if( config_GetInt( p_intf, "qt-name-in-title" ) )
{
CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
CONNECT( THEMIM->getIM(), navigationChanged( int ),
this, setNavigation(int) );
- if( config_GetInt( p_intf, "qt-system-tray" ) )
+ if( config_GetInt( p_intf, "qt-system-tray" ) && systray )
{
CONNECT( THEMIM->getIM(), statusChanged( int ), this,
- updateSystrayTooltipStatus(int));
+ updateSystrayTooltipStatus( int ) );
}
CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( float ) );
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();
}
{
videoWidget = new VideoWidget( p_intf );
videoWidget->widgetSize = QSize( 1, 1 );
- videoWidget->resize( videoWidget->widgetSize );
+ //videoWidget->resize( videoWidget->widgetSize );
ui.vboxLayout->insertWidget( 0, videoWidget );
p_intf->pf_request_window = ::DoRequest;
setMinimumSize( PREF_W, addSize.height() );
}
-void MainInterface::createSystrayMenu()
+/**
+ * Create a SystemTray icon and a menu that would go with it.
+ * Connects to a click handler on the icon.
+ **/
+void MainInterface::createSystray()
{
QIcon iconVLC = QIcon( QPixmap( ":/vlc128.png" ) );
sysTray = new QSystemTrayIcon( iconVLC, this );
+ sysTray->setToolTip( qtr( "VLC media player" ));
+
systrayMenu = new QMenu( qtr( "VLC media player" ), this );
systrayMenu->setIcon( iconVLC );
- sysTray->setToolTip( qtr( "VLC media player" ));
+
QVLCMenu::updateSystrayMenu( this, p_intf, true );
sysTray->show();
+
CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ),
this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
}
+/**
+ * Update the menu of the Systray Icon.
+ * May be unneedded, since it just calls QVLCMenu::update
+ **/
void MainInterface::updateSystrayMenu( int status )
{
QVLCMenu::updateSystrayMenu( this, p_intf ) ;
}
}
-
+/**
+ * Updates the name of the systray Icon tooltip.
+ * Doesn't check if the systray exists, check before you call it.
+ **/
void MainInterface::updateSystrayTooltipName( QString name )
{
if( name.isEmpty() )
}
}
+/**
+ * Updates the status of the systray Icon tooltip.
+ * Doesn't check if the systray exists, check before you call it.
+ **/
void MainInterface::updateSystrayTooltipStatus( int i_status )
{
switch( i_status )
- {
- case 0:
- {
- sysTray->setToolTip( qtr( "VLC media player" ) );
- break;
- }
- case PLAYING_S:
- {
- sysTray->setToolTip( input_name );
- //+ " - " + qtr( "Playing" ) );
- break;
- }
- case PAUSE_S:
- {
- sysTray->setToolTip( input_name + " - "
- + qtr( "Paused") );
- break;
- }
- }
+ {
+ case 0:
+ {
+ sysTray->setToolTip( qtr( "VLC media player" ) );
+ break;
+ }
+ case PLAYING_S:
+ {
+ sysTray->setToolTip( input_name );
+ //+ " - " + qtr( "Playing" ) );
+ break;
+ }
+ case PAUSE_S:
+ {
+ sysTray->setToolTip( input_name + " - "
+ + qtr( "Paused") );
+ break;
+ }
+ }
}
+
/**********************************************************************
* Handling of the components
**********************************************************************/
ui.playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
else
ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) );
- updateSystrayMenu( status );
+ if( systrayMenu )
+ updateSystrayMenu( status );
}
#define HELP_MENU N_("Menu")
{
QMenu *menu = new QMenu();
menu->addMenu( SDMenu( p_intf ) );
+ menu->addAction ( QIcon(":/pixmaps/vlc_playlist_16px.png"),
+ qtr( "Playlist"), mi, SLOT( playlist() ) );
menu->addSeparator();
DP_SADD( menu, qtr( I_PL_LOAD ), "", "", openPlaylist(), "Ctrl+L" );
adv->setCheckable( true );
if( adv_controls_enabled ) adv->setChecked( true );
- DP_SADD( menu, qtr( "Hide Menus..." ), "","",hideMenus(), "Ctrl+H" );
- menu->addSeparator();
+ DP_SADD( menu, qtr( "Hide Menus..." ), "","",hideMenus(), "Ctrl+H" );
+ menu->addSeparator();
#if 0 /* For Visualisations. Not yet working */
adv = menu->addAction( qtr("Visualizations selector" ),
adv->setCheckable( true );
if( visual_selector_enabled ) adv->setChecked( true );
#endif
- menu->addAction ( QIcon(":/pixmaps/vlc_playlist_16px.png"),
- qtr( "Playlist"), mi, SLOT( playlist() ) );
+ menu->addAction ( QIcon(":/pixmaps/vlc_playlist_16px.png"),
+ qtr( "Playlist"), mi, SLOT( playlist() ) );
}
DP_SADD( menu, qtr( I_MENU_EXT ), "", ":/pixmaps/vlc_settings_16px.png",
extendedDialog() , "Ctrl+E" );