Commit 4b94daab authored by Clément Stenac's avatar Clément Stenac

Do not hide the video widget, as it causes some sizing trouble, just resize it

parent 2ec741cc
...@@ -70,6 +70,7 @@ static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a ) ...@@ -70,6 +70,7 @@ static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a )
bool embeddedPlaylistWasActive; bool embeddedPlaylistWasActive;
bool videoIsActive; bool videoIsActive;
QSize savedVideoSize;
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
...@@ -179,14 +180,13 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -179,14 +180,13 @@ void MainInterface::handleMainUi( QSettings *settings )
/* Set initial size */ /* Set initial size */
resize ( PREF_W, PREF_H ); resize ( PREF_W, PREF_H );
addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
if( videoEmbeddedFlag ) if( videoEmbeddedFlag )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
videoWidget->widgetSize = QSize( PREF_W, 1 ); videoWidget->widgetSize = QSize( 1, 1 );
videoWidget->resize( videoWidget->widgetSize ); videoWidget->resize( videoWidget->widgetSize );
videoWidget->hide();
ui.vboxLayout->insertWidget( 0, videoWidget ); ui.vboxLayout->insertWidget( 0, videoWidget );
p_intf->pf_request_window = ::DoRequest; p_intf->pf_request_window = ::DoRequest;
...@@ -195,10 +195,10 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -195,10 +195,10 @@ void MainInterface::handleMainUi( QSettings *settings )
if( config_GetInt( p_intf, "qt-always-video" )) if( config_GetInt( p_intf, "qt-always-video" ))
{ {
// bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
// bgWidget->widgetSize = settings->value( "backgroundSize", bgWidget->widgetSize = settings->value( "backgroundSize",
// QSize( 200, 200 ) ).toSize(); QSize( 200, 200 ) ).toSize();
// ui.vboxLayout->insertWidget( 0, bgWidget ); ui.vboxLayout->insertWidget( 0, bgWidget );
} }
} }
// visualSelector = new VisualSelector( p_intf ); // visualSelector = new VisualSelector( p_intf );
...@@ -242,6 +242,7 @@ void MainInterface::calculateInterfaceSize() ...@@ -242,6 +242,7 @@ void MainInterface::calculateInterfaceSize()
width = PREF_W - addSize.width(); width = PREF_W - addSize.width();
height = PREF_H - addSize.height(); height = PREF_H - addSize.height();
} }
fprintf( stderr, "Setting to %ix%i\n", width + addSize.width() , height + addSize.height() );
mainSize.setWidth( width + addSize.width() ); mainSize.setWidth( width + addSize.width() );
mainSize.setHeight( height + addSize.height() ); mainSize.setHeight( height + addSize.height() );
} }
...@@ -254,12 +255,11 @@ void MainInterface::resizeEvent( QResizeEvent *e ) ...@@ -254,12 +255,11 @@ void MainInterface::resizeEvent( QResizeEvent *e )
* Height : Only passed to the only visible child * Height : Only passed to the only visible child
*/ */
if( videoWidget ) if( videoWidget )
{
if( videoIsActive )
{ {
videoWidget->widgetSize.setWidth( e->size().width() - videoWidget->widgetSize.setWidth( e->size().width() -
addSize.width() ); addSize.width() );
if( videoIsActive && videoWidget->widgetSize.height() > 1 )
{
videoWidget->widgetSize.setHeight( e->size().height() - videoWidget->widgetSize.setHeight( e->size().height() -
addSize.height() ); addSize.height() );
videoWidget->updateGeometry(); videoWidget->updateGeometry();
...@@ -303,7 +303,6 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -303,7 +303,6 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
{ {
bgWidget->hide(); bgWidget->hide();
} }
videoWidget->show();
videoWidget->widgetSize = QSize( *pi_width, *pi_height ); videoWidget->widgetSize = QSize( *pi_width, *pi_height );
videoWidget->updateGeometry(); /// FIXME: Needed ? videoWidget->updateGeometry(); /// FIXME: Needed ?
need_components_update = true; need_components_update = true;
...@@ -314,9 +313,8 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -314,9 +313,8 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
void MainInterface::releaseVideo( void *p_win ) void MainInterface::releaseVideo( void *p_win )
{ {
videoWidget->release( p_win ); videoWidget->release( p_win );
videoWidget->hide(); videoWidget->widgetSize = QSize( 0, 0 );
// videoWidget->widgetSize = QSize( 1, 1 ); videoWidget->resize( videoWidget->widgetSize );
// videoWidget->updateGeometry();
if( embeddedPlaylistWasActive ) if( embeddedPlaylistWasActive )
playlistWidget->show(); playlistWidget->show();
...@@ -379,8 +377,6 @@ void MainInterface::playlist() ...@@ -379,8 +377,6 @@ void MainInterface::playlist()
PlaylistDialog::killInstance(); PlaylistDialog::killInstance();
playlistWidget = new PlaylistWidget( p_intf ); playlistWidget = new PlaylistWidget( p_intf );
ui.vboxLayout->insertWidget( 0, playlistWidget ); ui.vboxLayout->insertWidget( 0, playlistWidget );
fprintf( stderr, "BUG ! Do not set size if it has already been changed\n" );
playlistWidget->widgetSize = settings->value( "playlistSize", playlistWidget->widgetSize = settings->value( "playlistSize",
QSize( 650, 310 ) ).toSize(); QSize( 650, 310 ) ).toSize();
playlistWidget->hide(); playlistWidget->hide();
...@@ -392,7 +388,9 @@ void MainInterface::playlist() ...@@ -392,7 +388,9 @@ void MainInterface::playlist()
playlistWidget->hide(); playlistWidget->hide();
if( videoIsActive ) if( videoIsActive )
{ {
videoWidget->show(); videoWidget->widgetSize = savedVideoSize;
videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry();
} }
} }
else else
...@@ -400,7 +398,12 @@ void MainInterface::playlist() ...@@ -400,7 +398,12 @@ void MainInterface::playlist()
fprintf( stderr, "showing playlist\n" ); fprintf( stderr, "showing playlist\n" );
playlistWidget->show(); playlistWidget->show();
if( videoIsActive ) if( videoIsActive )
videoWidget->hide(); {
savedVideoSize = videoWidget->widgetSize;
videoWidget->widgetSize.setHeight( 0 );
videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry();
}
} }
calculateInterfaceSize(); calculateInterfaceSize();
......
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