Commit 48018aed authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Video Widget cleaning. Corrections of previous commits.

zoom and resize when stop should be fixed. #1652 and #1716
parent ac495caa
...@@ -67,16 +67,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i ) ...@@ -67,16 +67,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{ {
/* Init */ /* Init */
i_vout = 0; i_vout = 0;
hide(); setMinimumSize( 16, 16 );
videoSize.rwidth() = -1; videoSize.rwidth() = -1;
videoSize.rheight() = -1; videoSize.rheight() = -1;
hide();
/* Set the policy to expand in both directions */
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
/* Black background is more coherent for a Video Widget IMVHO */ /* Black background is more coherent for a Video Widget */
QPalette plt = palette(); QPalette plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black ); plt.setColor( QPalette::Window, Qt::black );
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt ); setPalette( plt );
setAutoFillBackground(true);
/* Indicates that the widget wants to draw directly onto the screen.
Widgets with this attribute set do not participate in composition
management */
setAttribute( Qt::WA_PaintOnScreen, true ); setAttribute( Qt::WA_PaintOnScreen, true );
/* The core can ask through a callback to show the video. */ /* The core can ask through a callback to show the video. */
...@@ -85,7 +92,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i ) ...@@ -85,7 +92,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
this, SLOT(SetSizing(unsigned int, unsigned int )), this, SLOT(SetSizing(unsigned int, unsigned int )),
Qt::BlockingQueuedConnection ); Qt::BlockingQueuedConnection );
#else #else
#error This is broken. Fix it with a QEventLoop with a processEvents () #warning This is broken. Fix it with a QEventLoop with a processEvents ()
connect( this, SIGNAL(askVideoWidgetToShow( unsigned int, unsigned int)), connect( this, SIGNAL(askVideoWidgetToShow( unsigned int, unsigned int)),
this, SLOT(SetSizing(unsigned int, unsigned int )) ); this, SLOT(SetSizing(unsigned int, unsigned int )) );
#endif #endif
...@@ -99,10 +106,11 @@ void VideoWidget::paintEvent(QPaintEvent *ev) ...@@ -99,10 +106,11 @@ void VideoWidget::paintEvent(QPaintEvent *ev)
#endif #endif
} }
/* Kill the vout at Destruction */
VideoWidget::~VideoWidget() VideoWidget::~VideoWidget()
{ {
vout_thread_t *p_vout = i_vout vout_thread_t *p_vout = i_vout ?
? (vout_thread_t *)vlc_object_get( i_vout ) : NULL; (vout_thread_t *)vlc_object_get( i_vout ) : NULL;
if( p_vout ) if( p_vout )
{ {
...@@ -134,7 +142,9 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, ...@@ -134,7 +142,9 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
return NULL; return NULL;
} }
i_vout = p_nvout->i_object_id; i_vout = p_nvout->i_object_id;
#ifndef NDEBUG
msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() ); msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
#endif
return ( void* )winId(); return ( void* )winId();
} }
...@@ -156,8 +166,8 @@ void VideoWidget::release( void *p_win ) ...@@ -156,8 +166,8 @@ void VideoWidget::release( void *p_win )
i_vout = 0; i_vout = 0;
videoSize.rwidth() = 0; videoSize.rwidth() = 0;
videoSize.rheight() = 0; videoSize.rheight() = 0;
updateGeometry();
hide(); hide();
updateGeometry(); // Needed for deinterlace
} }
QSize VideoWidget::sizeHint() const QSize VideoWidget::sizeHint() const
......
...@@ -41,26 +41,6 @@ ...@@ -41,26 +41,6 @@
#include <QWidget> #include <QWidget>
#include <QFrame> #include <QFrame>
#define VOLUME_MAX 200
/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
done by trick with setting the opacity of window */
#ifdef WIN32
#define WIN32TRICK
#endif
/* to trying transparency with fullscreen controller on windows enable that */
/* it can be enabled on-non windows systems,
but it will be transparent only with composite manager */
#ifndef WIN32
#define HAVE_TRANSPARENCY 1
#else
#define HAVE_TRANSPARENCY 0
#endif
/* Default value of opacity for FS controller */
#define DEFAULT_OPACITY 0.75
class ResizeEvent; class ResizeEvent;
class QPalette; class QPalette;
class QPixmap; class QPixmap;
...@@ -240,6 +220,24 @@ signals: ...@@ -240,6 +220,24 @@ signals:
void advancedControlsToggled( bool ); void advancedControlsToggled( bool );
}; };
/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
done by trick with setting the opacity of window */
#ifdef WIN32
#define WIN32TRICK
#endif
/* to trying transparency with fullscreen controller on windows enable that */
/* it can be enabled on-non windows systems,
but it will be transparent only with composite manager */
#ifndef WIN32
#define HAVE_TRANSPARENCY 1
#else
#define HAVE_TRANSPARENCY 0
#endif
/* Default value of opacity for FS controller */
#define DEFAULT_OPACITY 0.75
/*********************************** /***********************************
* Fullscreen controller * Fullscreen controller
***********************************/ ***********************************/
...@@ -302,7 +300,7 @@ private: ...@@ -302,7 +300,7 @@ private:
}; };
#define VOLUME_MAX 200
class VolumeClickHandler : public QObject class VolumeClickHandler : public QObject
{ {
public: public:
......
This diff is collapsed.
...@@ -75,9 +75,6 @@ public: ...@@ -75,9 +75,6 @@ public:
void releaseVideo( void * ); void releaseVideo( void * );
int controlVideo( void *p_window, int i_query, va_list args ); int controlVideo( void *p_window, int i_query, va_list args );
#if 0
void requestLayoutUpdate();
#endif
/* Getters */ /* Getters */
QSystemTrayIcon *getSysTray() { return sysTray; }; QSystemTrayIcon *getSysTray() { return sysTray; };
QMenu *getSysTrayMenu() { return systrayMenu; }; QMenu *getSysTrayMenu() { return systrayMenu; };
......
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