bgWidget = NULL;
videoWidget = NULL;
playlistWidget = NULL;
+ videoRoleWidget = NULL;
#ifndef HAVE_MAEMO
sysTray = NULL;
#endif
CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
this, destroyPopupMenu() );
+ minWidthHolder = new QWidget;
+ minWidthHolder->setMinimumWidth(
+ __MAX( menuBar()->sizeHint().width() + 30, 400 ) );
+ mainLayout->addWidget( minWidthHolder );
+
/*********************************
* Create the Systray Management *
*********************************/
/* resize to previously saved main window size if appicable */
//FIXME remove.
- if( b_keep_size )
+ /*if( b_keep_size )
{
if( i_visualmode )
resize( mainVideoSize );
else
resize( mainBasedSize );
- }
+ }*/
/* Playlist */
int i_plVis = settings->value( "playlist-visible", 0 ).toInt();
/* Final sizing and showing */
setVisible( !b_hideAfterCreation );
- setMinimumWidth( __MAX( controls->sizeHint().width(),
- menuBar()->sizeHint().width() ) + 30 );
-
/* Switch to minimal view if needed, must be called after the show() */
if( i_visualmode )
toggleMinimalView( true );
+ else
+ showTab();
}
MainInterface::~MainInterface()
{
/* Unsure we hide the videoWidget before destroying it */
- if( stackCentralOldWidget == playlistWidget )
- showBg();
+ //showTab( PLAYLIST_TAB );
/* Save playlist state */
if( playlistWidget )
mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
/* */
- stackCentralW = new QStackedWidget( main );
+ stackCentralW = new QVLCStackedWidget( main );
/* Bg Cone */
bgWidget = new BackgroundWidget( p_intf );
stackCentralW->addWidget( bgWidget );
+ videoRoleWidget = bgWidget;
/* And video Outputs */
if( b_videoEmbedded )
/* Create the CONTROLS Widget */
controls = new ControlsWidget( p_intf,
settings->value( "adv-controls", false ).toBool(), this );
+
CONNECT( controls, advancedControlsToggled( bool ),
this, adaptGeometry() );
CONNECT( controls, sizeChanged(),
*/
void MainInterface::adaptGeometry()
{
- resize( sizeHint() );
+ //resize( sizeHint() );
#ifdef DEBUG_INTF
debug();
#endif
}
-inline void MainInterface::showVideo() { showTab( videoWidget ); }
-inline void MainInterface::showBg() { showTab( bgWidget ); }
-
-inline void MainInterface::showTab( QWidget *widget )
+inline void MainInterface::showTab( StackTab tab )
{
-#ifdef DEBUG_INTF
- msg_Warn( p_intf, "Old stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
-#endif
- stackCentralOldWidget = stackCentralW->currentWidget();
- stackCentralW->setCurrentWidget( widget );
+ if( tab == PLAYLIST_TAB && !b_plDocked ) return;
-#ifdef DEBUG_INTF
- msg_Warn( p_intf, "State change %i", stackCentralW->currentIndex() );
- msg_Warn( p_intf, "New stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
-#endif
-}
+ QWidget *widget;
+ switch ( tab )
+ {
+ case PLAYLIST_TAB: widget = playlistWidget; break;
+ case VIDEO_TAB: widget = videoRoleWidget; break;
+ case CURRENT_TAB: widget = stackCentralW->currentWidget(); break;
+ }
-inline void MainInterface::restoreStackOldWidget()
-{
-#ifdef DEBUG_INTF
- msg_Warn( p_intf, "New stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
-#endif
- QWidget *wTemp = stackCentralW->currentWidget();
+ stackCentralW->setCurrentWidget( widget );
- stackCentralW->setCurrentWidget( stackCentralOldWidget );
+ // Go into compact mode if needed (stackCentralW hidden)
+ if( widget == bgWidget && !b_keep_size && controls->isVisible() && !isFullScreen() )
+ {
+ resize( 0, 0 );
+ }
- stackCentralOldWidget = wTemp;
-#ifdef DEBUG_INTF
- msg_Warn( p_intf, "Debug %i %i",stackCentralW->indexOf( wTemp ), stackCentralW->indexOf( stackCentralW->currentWidget() ) );
-#endif
+ /* TODO Alternatively, for compact mode the best thing would be to setSizeConstraint
+ on layout, but sadly, we can only constrain the whole size, while we should
+ constrain height only */
+ /*if( widget == bgWidget && !b_keep_size && controls->isVisible() && !isFullScreen() )
+ {
+ stackCentralW->hide();
+ layout()->setSizeConstraint( QLayout::SetFixedSize );
+ }
+ else
+ {
+ layout()->setSizeConstraint( QLayout::SetDefaultConstraint );
+ setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX );
+ stackCentralW->show();
+ }*/
}
void MainInterface::destroyPopupMenu()
/* ask videoWidget to show */
videoWidget->SetSizing( *pi_width, *pi_height );
+ videoRoleWidget = videoWidget;
/* Consider the video active now */
- showVideo();
+ showTab( VIDEO_TAB );
}
}
/* Function that is CONNECTED to the previous emit */
void MainInterface::releaseVideoSlot( void )
{
- videoWidget->release();
+ videoRoleWidget = bgWidget;
- restoreStackOldWidget();
+ showTab( b_plDocked && playlistVisible ? PLAYLIST_TAB : VIDEO_TAB );
- /* We don't want to have a blank video to popup */
- stackCentralOldWidget = bgWidget;
+ videoWidget->release();
}
/* Asynchronous call from WindowControl function */
if( b_plDocked )
{
- /* Playlist is not visible, show it */
- if( stackCentralW->currentWidget() != playlistWidget )
- {
- playlistWidget->forceShow();
- showTab( playlistWidget );
- }
- else /* Hide it! */
- {
- restoreStackOldWidget();
- stackCentralW->updateGeometry();
- // HACK: So it doesn't limit the stackWidget minimumSize
- playlistWidget->forceHide();
- }
+ showTab( stackCentralW->currentWidget() != playlistWidget ?
+ PLAYLIST_TAB : VIDEO_TAB );
playlistVisible = ( stackCentralW->currentWidget() == playlistWidget );
}
else
if( !playlistWidget ) return; /* Playlist wasn't created yet */
if( !p_docked )
{
+ showTab( VIDEO_TAB );
stackCentralW->removeWidget( playlistWidget );
playlistWidget->setWindowFlags( Qt::Window );
QVLCTools::restoreWidgetPosition( p_intf, "Playlist",
playlistWidget, QSize( 600, 300 ) );
playlistWidget->show();
- restoreStackOldWidget();
}
else
{
playlistWidget->setWindowFlags( Qt::Widget ); // Probably a Qt bug here
// It would be logical that QStackWidget::addWidget reset the flags...
stackCentralW->addWidget( playlistWidget );
- stackCentralW->setCurrentWidget( playlistWidget );
+ showTab( PLAYLIST_TAB );
}
+ playlistVisible = true;
}
/*
*/
void MainInterface::toggleMinimalView( bool b_switch )
{
- if( i_visualmode == 0 )
- { /* NORMAL MODE then */
- if( !videoWidget || stackCentralW->currentWidget() != videoWidget )
- {
- showBg();
- }
- else
- {
- /* If video is visible, then toggle the status of bgWidget */
- //FIXME
- //bgWasVisible = !bgWasVisible;
- /* if( stackCentralOldState == BACK G_TAB )
- stackCentralOldState = HID DEN_TAB;
- else
- stackCentralOldState = BACK G_TAB;
-
- */
- }
- }
-
menuBar()->setVisible( !b_switch );
controls->setVisible( !b_switch );
statusBar()->setVisible( !b_switch );
inputC->setVisible( !b_switch );
+ minWidthHolder->setVisible( !b_switch );
+
+ // Go to compact mode and back if needed
+ showTab();
emit minimalViewToggled( b_switch );
}
showFullScreen();
emit fullscreenInterfaceToggled( true );
}
+ showTab();
}
/*****************************************************************************