+ /* Stop any currently running visualization */
+ visualSelector->hide();
+ visualSelectorEnabled = false;
+ }
+ doComponentsUpdate();
+}
+#endif
+
+void MainInterface::toggleMenus()
+{
+ msg_Dbg( p_intf, "I HAS HERE, HIDING YOUR MENUZ: \\_o<~~ coin coin" );
+ TOGGLEV( controls );
+ TOGGLEV( statusBar() );
+ updateGeometry();
+}
+
+/* Video widget cannot do this synchronously as it runs in another thread */
+/* Well, could it, actually ? Probably dangerous ... */
+void MainInterface::doComponentsUpdate()
+{
+ calculateInterfaceSize();
+ resize( mainSize );
+}
+
+void MainInterface::toggleAdvanced()
+{
+ controls->toggleAdvanced();
+}
+
+bool MainInterface::isAdvancedVisible()
+{
+ return controls->b_advancedVisible;
+}
+
+/************************************************************************
+ * Other stuff
+ ************************************************************************/
+void MainInterface::setDisplay( float pos, int time, int length )
+{
+ char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
+ secstotimestr( psz_length, length );
+ secstotimestr( psz_time, b_remainingTime ? length - time : time );
+ QString title; title.sprintf( "%s/%s", psz_time, psz_length );
+ if( b_remainingTime ) timeLabel->setText( " -"+title+" " );
+ else timeLabel->setText( " "+title+" " );
+}
+
+void MainInterface::toggleTimeDisplay()
+{
+ b_remainingTime = ( b_remainingTime ? false : true );
+}
+
+void MainInterface::setElapsedTime(){ b_remainingTime = false; }
+void MainInterface::setRemainTime(){ b_remainingTime = true; }
+
+void MainInterface::setName( QString name )
+{
+ input_name = name;
+ nameLabel->setText( " " + name+" " );
+}
+
+void MainInterface::setStatus( int status )
+{
+ controls->setStatus( status );
+ if( sysTray )
+ updateSystrayMenu( status );
+}
+
+void MainInterface::updateOnTimer()
+{
+ /* \todo Make this event-driven */
+ if( intf_ShouldDie( p_intf ) )
+ {
+ QApplication::closeAllWindows();
+ QApplication::quit();
+ }
+ if( need_components_update )
+ {
+ doComponentsUpdate();
+ need_components_update = false;
+ }
+
+ controls->updateOnTimer();
+}
+
+/*****************************************************************************
+ * Systray Icon and Systray Menu
+ *****************************************************************************/
+
+/**
+ * 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 );
+
+ 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
+ * FIXME !!!
+ **/
+void MainInterface::updateSystrayMenu( int status )
+{
+ QVLCMenu::updateSystrayMenu( this, p_intf ) ;
+}
+
+/**
+ * Updates the Systray Icon's menu and toggle the main interface
+ */
+void MainInterface::toggleUpdateSystrayMenu()
+{
+ if( isHidden() )
+ {
+ show();
+ activateWindow();
+ }
+ else
+ {
+#ifdef WIN32
+ /* check if any visible window is above vlc in the z-order,
+ * but ignore the ones always on top */
+ WINDOWINFO wi;
+ HWND hwnd;
+ wi.cbSize = sizeof( WINDOWINFO );
+ for( hwnd = GetNextWindow( internalWinId(), GW_HWNDPREV );
+ hwnd && !IsWindowVisible( hwnd );
+ hwnd = GetNextWindow( hwnd, GW_HWNDPREV ) );
+ if( !hwnd || !GetWindowInfo( hwnd, &wi ) ||
+ (wi.dwExStyle&WS_EX_TOPMOST) )
+#else
+ if( isActiveWindow() )
+#endif
+ {
+ hide();
+ }