Commit 5b7b930e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: fix main_interface sizing part 2

Close #3408 (blocker)
Close #3245 (blocker)
parent a88ba452
...@@ -176,11 +176,9 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h ) ...@@ -176,11 +176,9 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
{ {
if (reparentable->windowState() & Qt::WindowFullScreen ) if (reparentable->windowState() & Qt::WindowFullScreen )
return; return;
msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
videoSize.setWidth( w );
videoSize.setHeight( h );
if( !isVisible() ) show(); if( !isVisible() ) show();
updateGeometry(); // Needed for deinterlace resize( w, h );
emit sizeChanged( w, h );
videoSync(); videoSync();
} }
...@@ -266,17 +264,10 @@ void VideoWidget::release( void ) ...@@ -266,17 +264,10 @@ void VideoWidget::release( void )
delete reparentable; delete reparentable;
reparentable = NULL; reparentable = NULL;
videoSize = QSize();
updateGeometry(); updateGeometry();
hide(); hide();
} }
QSize VideoWidget::sizeHint() const
{
return videoSize;
}
/********************************************************************** /**********************************************************************
* Background Widget. Show a simple image background. Currently, * Background Widget. Show a simple image background. Currently,
* it's album art if present or cone. * it's album art if present or cone.
......
...@@ -58,13 +58,10 @@ public: ...@@ -58,13 +58,10 @@ public:
VideoWidget( intf_thread_t * ); VideoWidget( intf_thread_t * );
virtual ~VideoWidget(); virtual ~VideoWidget();
WId request( int *, int *, WId request( int *, int *, unsigned int *, unsigned int *, bool );
unsigned int *, unsigned int *, bool );
void release( void ); void release( void );
int control( void *, int, va_list ); int control( void *, int, va_list );
virtual QSize sizeHint() const;
protected: protected:
virtual QPaintEngine *paintEngine() const virtual QPaintEngine *paintEngine() const
{ {
...@@ -74,12 +71,12 @@ protected: ...@@ -74,12 +71,12 @@ protected:
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QSize videoSize;
QWidget *reparentable; QWidget *reparentable;
QLayout *layout; QLayout *layout;
signals: signals:
void keyPressed( QKeyEvent * ); void keyPressed( QKeyEvent * );
void sizeChanged( int, int );
public slots: public slots:
void SetSizing( unsigned int, unsigned int ); void SetSizing( unsigned int, unsigned int );
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#include <vlc_keys.h> /* Wheel event */ #include <vlc_keys.h> /* Wheel event */
#include <vlc_vout_display.h> /* vout_thread_t and VOUT_ events */ #include <vlc_vout_display.h> /* vout_thread_t and VOUT_ events */
// #define DEBUG_INTF #define DEBUG_INTF
/* Callback prototypes */ /* Callback prototypes */
static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
...@@ -218,6 +218,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -218,6 +218,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
CONNECT( this, askVideoToResize( unsigned int, unsigned int ), CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
videoWidget, SetSizing( unsigned int, unsigned int ) ); videoWidget, SetSizing( unsigned int, unsigned int ) );
CONNECT( videoWidget, sizeChanged( int, int ),
this, resizeStack( int, int ) );
CONNECT( this, askVideoSetFullScreen( bool ), CONNECT( this, askVideoSetFullScreen( bool ),
videoWidget, SetFullScreen( bool ) ); videoWidget, SetFullScreen( bool ) );
CONNECT( videoWidget, keyPressed( QKeyEvent * ), CONNECT( videoWidget, keyPressed( QKeyEvent * ),
...@@ -560,6 +562,7 @@ QSize MainInterface::sizeHint() const ...@@ -560,6 +562,7 @@ QSize MainInterface::sizeHint() const
*/ */
void MainInterface::doComponentsUpdate() void MainInterface::doComponentsUpdate()
{ {
#if 0
if( isFullScreen() || isMaximized() ) return; if( isFullScreen() || isMaximized() ) return;
// msg_Warn( p_intf, "Updating the geometry" ); // msg_Warn( p_intf, "Updating the geometry" );
...@@ -574,6 +577,7 @@ void MainInterface::doComponentsUpdate() ...@@ -574,6 +577,7 @@ void MainInterface::doComponentsUpdate()
//resize( sizeHint() ); //resize( sizeHint() );
//adjustSize() ; /* This is not needed, but might help in the future */ //adjustSize() ; /* This is not needed, but might help in the future */
#endif
} }
void MainInterface::debug() void MainInterface::debug()
...@@ -589,16 +593,12 @@ void MainInterface::debug() ...@@ -589,16 +593,12 @@ void MainInterface::debug()
msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() ); msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() );
msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() ); msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() );
//msg_Dbg( p_intf, "maximumsize: %i - %i", maximumSize().height(), maximumSize().width() ); msg_Dbg( p_intf, "maximumsize: %i - %i", maximumSize().height(), maximumSize().width() );
msg_Dbg( p_intf, "minimumsize: %i - %i", minimumSize().height(), minimumSize().width() );
msg_Dbg( p_intf, "Stack size: %i - %i", stackCentralW->size().height(), stackCentralW->size().width() ); msg_Dbg( p_intf, "Stack size: %i - %i", stackCentralW->size().height(), stackCentralW->size().width() );
msg_Dbg( p_intf, "Stack minimumSize(): %i - %i", stackCentralW->minimumHeight(), stackCentralW->minimumWidth() ); msg_Dbg( p_intf, "Stack sizeHint: %i - %i", stackCentralW->sizeHint().height(), stackCentralW->sizeHint().width() );
msg_Dbg( p_intf, "Central minimumsize: %i - %i", centralWidget()->minimumSize().height(), centralWidget()->minimumSize().width() );
msg_Dbg( p_intf, "Central size: %i - %i", centralWidget()->size().height(), centralWidget()->size().width() ); msg_Dbg( p_intf, "Central size: %i - %i", centralWidget()->size().height(), centralWidget()->size().width() );
msg_Dbg( p_intf, "Menu minimumsize: %i - %i", menuBar()->minimumSize().height(), menuBar()->minimumSize().width() );
msg_Dbg( p_intf, "Input size: %i - %i", inputC->size().height(), inputC->size().width() );
msg_Dbg( p_intf, "Status minimumsize: %i - %i", statusBar()->minimumSize().height(), statusBar()->minimumSize().width() );
msg_Dbg( p_intf, "minimumsize: %i - %i", minimumSize().height(), minimumSize().width() );
msg_Dbg( p_intf, "bg Size: %i - %i", bgWidget->size().height(), bgWidget->size().width() ); msg_Dbg( p_intf, "bg Size: %i - %i", bgWidget->size().height(), bgWidget->size().width() );
/*if( videoWidget && videoWidget->isVisible() ) /*if( videoWidget && videoWidget->isVisible() )
...@@ -717,10 +717,6 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y, ...@@ -717,10 +717,6 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
/* Consider the video active now */ /* Consider the video active now */
showVideo(); showVideo();
stackCentralW->resize( *pi_width, *pi_height );
emit askUpdate();
} }
} }
...@@ -749,8 +745,6 @@ void MainInterface::releaseVideoSlot( void ) ...@@ -749,8 +745,6 @@ void MainInterface::releaseVideoSlot( void )
/* Asynchronous call from WindowControl function */ /* Asynchronous call from WindowControl function */
int MainInterface::controlVideo( int i_query, va_list args ) int MainInterface::controlVideo( int i_query, va_list args )
{ {
/* Debug to check if VOUT_WINDOW_SET_SIZE is called, because this is broken now */
msg_Warn( p_intf, "Control Video: %i", i_query );
switch( i_query ) switch( i_query )
{ {
case VOUT_WINDOW_SET_SIZE: case VOUT_WINDOW_SET_SIZE:
...@@ -758,8 +752,7 @@ int MainInterface::controlVideo( int i_query, va_list args ) ...@@ -758,8 +752,7 @@ int MainInterface::controlVideo( int i_query, va_list args )
unsigned int i_width = va_arg( args, unsigned int ); unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int ); unsigned int i_height = va_arg( args, unsigned int );
emit askVideoToResize( i_width, i_height ); emit askVideoToResize( i_width, i_height );
emit askUpdate(); return VLC_SUCCESS;
return VLC_EGENERIC;
} }
case VOUT_WINDOW_SET_STATE: case VOUT_WINDOW_SET_STATE:
{ {
...@@ -1283,6 +1276,7 @@ void MainInterface::toggleFullScreen( void ) ...@@ -1283,6 +1276,7 @@ void MainInterface::toggleFullScreen( void )
{ {
showNormal(); showNormal();
emit askUpdate(); // Needed if video was launched after the F11 emit askUpdate(); // Needed if video was launched after the F11
//FIXMe
emit fullscreenInterfaceToggled( false ); emit fullscreenInterfaceToggled( false );
} }
else else
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#endif #endif
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QStackedWidget>
class QSettings; class QSettings;
class QCloseEvent; class QCloseEvent;
...@@ -53,7 +54,6 @@ class SpeedControlWidget; ...@@ -53,7 +54,6 @@ class SpeedControlWidget;
class QVBoxLayout; class QVBoxLayout;
class QMenu; class QMenu;
class QSize; class QSize;
class QStackedWidget;
enum { enum {
CONTROLS_VISIBLE = 0x1, CONTROLS_VISIBLE = 0x1,
...@@ -211,6 +211,11 @@ private slots: ...@@ -211,6 +211,11 @@ private slots:
void showBuffering( float ); void showBuffering( float );
void resizeStack( int w, int h ) {
resize( size() - stackCentralW->size() + QSize( w, h ) );
debug(); }
signals: signals:
void askGetVideo( WId *p_id, int *pi_x, int *pi_y, void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
unsigned *pi_width, unsigned *pi_height ); unsigned *pi_width, unsigned *pi_height );
......
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