+
+ p_intf->pf_request_window = NULL;
+ p_intf->pf_release_window = NULL;
+ p_intf->pf_control_window = NULL;
+}
+
+void MainInterface::setVLCWindowsTitle( QString aTitle )
+{
+ if( aTitle.isEmpty() )
+ {
+ this->setWindowTitle( qtr( "VLC media player" ) );
+ }
+ else
+ {
+ this->setWindowTitle( aTitle + " - " + qtr( "VLC media player" ) );
+ }
+}
+
+void MainInterface::handleMainUi( QSettings *settings )
+{
+ QWidget *main = new QWidget( this );
+ setCentralWidget( main );
+ ui.setupUi( centralWidget() );
+
+ slider = new InputSlider( Qt::Horizontal, NULL );
+ ui.vboxLayout->insertWidget( 0, slider );
+ ui.discFrame->hide();
+ BUTTON_SET_IMG( ui.prevSectionButton, "", previous.png, "" );
+ BUTTON_SET_IMG( ui.nextSectionButton, "", next.png, "" );
+ BUTTON_SET_IMG( ui.menuButton, "", previous.png, "" );
+
+ BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
+ qtr("Previous"), prev() );
+ BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
+ BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
+ BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
+
+ /* Volume */
+ ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
+ ui.volumeSlider->setMaximum( 100 );
+ ui.volMuteLabel->setToolTip( qtr( "Mute" ) );
+ VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
+ ui.volMuteLabel->installEventFilter(h);
+ ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
+
+ BUTTON_SET_IMG( ui.playlistButton, "" , playlist_icon.png,
+ playlistEmbeddedFlag ? qtr( "Show playlist" ) :
+ qtr( "Open playlist" ) );
+ BUTTONACT( ui.playlistButton, playlist() );
+
+ /* Set initial size */
+ resize ( PREF_W, PREF_H );
+
+ addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
+
+ advControls = new ControlsWidget( p_intf );
+ ui.vboxLayout->insertWidget( 0, advControls );
+ advControls->updateGeometry();
+ if( !advControlsEnabled ) advControls->hide();
+ need_components_update = true;
+
+ visualSelector = new VisualSelector( p_intf );
+ ui.vboxLayout->insertWidget( 0, visualSelector );
+ visualSelector->hide();
+
+ if( alwaysVideoFlag )
+ {
+ bgWidget = new BackgroundWidget( p_intf );
+ bgWidget->widgetSize = settings->value( "backgroundSize",
+ QSize( 200, 200 ) ).toSize();
+ bgWidget->resize( bgWidget->widgetSize );
+ bgWidget->updateGeometry();
+ ui.vboxLayout->insertWidget( 0, bgWidget );
+ }
+
+ if( videoEmbeddedFlag )
+ {
+ videoWidget = new VideoWidget( p_intf );
+ videoWidget->widgetSize = QSize( 1, 1 );
+ videoWidget->resize( videoWidget->widgetSize );
+ ui.vboxLayout->insertWidget( 0, videoWidget );
+
+ p_intf->pf_request_window = ::DoRequest;
+ p_intf->pf_release_window = ::DoRelease;
+ p_intf->pf_control_window = ::DoControl;
+ }
+ setMinimumSize( PREF_W, addSize.height() );
+}
+
+void MainInterface::createSystrayMenu()
+{
+ QIcon iconVLC = QIcon( QPixmap( ":/vlc128.png" ) );
+ sysTray = new QSystemTrayIcon( iconVLC, this );
+ 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 ) );
+}
+
+void MainInterface::updateSystrayMenu( int status )
+{
+ QVLCMenu::updateSystrayMenu( this, p_intf ) ;
+}
+
+void MainInterface::toggleUpdateSystrayMenu()
+{
+ toggleVisible();
+ QVLCMenu::updateSystrayMenu( this, p_intf );
+}
+
+void MainInterface::handleSystrayClick( QSystemTrayIcon::ActivationReason reason )
+{
+ switch( reason )
+ {
+ case QSystemTrayIcon::Trigger:
+ toggleUpdateSystrayMenu();
+ break;
+ case QSystemTrayIcon::MiddleClick:
+ sysTray->showMessage( qtr( "VLC media player" ),
+ qtr( "Control menu for the player" ),
+ QSystemTrayIcon::Information, 4000 );
+ break;
+ }
+}
+
+
+void MainInterface::updateSystrayTooltipName( QString name )
+{
+ if( name.isEmpty() )
+ {
+ sysTray->setToolTip( qtr( "VLC media player" ) );
+ }
+ else
+ {
+ sysTray->setToolTip( name );
+ }
+}
+
+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;
+ }
+ }
+}
+/**********************************************************************
+ * Handling of the components
+ **********************************************************************/
+void MainInterface::calculateInterfaceSize()
+{
+ int width = 0, height = 0;
+ if( VISIBLE( bgWidget ) )
+ {
+ width = bgWidget->widgetSize.width();
+ height = bgWidget->widgetSize.height();
+ assert( !(playlistWidget && playlistWidget->isVisible() ) );
+ }
+ else if( VISIBLE( playlistWidget ) )
+ {
+ width = playlistWidget->widgetSize.width();
+ height = playlistWidget->widgetSize.height();
+ }
+ else if( videoIsActive )
+ {
+ width = videoWidget->widgetSize.width() ;
+ height = videoWidget->widgetSize.height();
+ }
+ else
+ {
+ width = PREF_W - addSize.width();
+ height = PREF_H - addSize.height();
+ }
+ if( VISIBLE( visualSelector ) )
+ height += visualSelector->height();
+ if( VISIBLE( advControls) )
+ {
+ height += advControls->sizeHint().height();
+ }
+ mainSize = QSize( width + addSize.width(), height + addSize.height() );