Commit 50810ad7 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Resizing changes. Part 1

      Remove the QDockWidget, this widget is clearly not what we want, since it is a Qt::Tool and stay above the video, it doesn't want to grow in the MI and it doesn't record correctly its size. Moreover, this force the GNOME/Cleanlooks hack that is boring on Xfce, KDE4 and e17.
      Fix the resize when the video is done.
      Fix the qt-start-minimize bug
      Rename a few functions and separate the code functions.
      Simplify a few resize/update call.
parent 7e6486a9
...@@ -58,13 +58,23 @@ static int DoControl( intf_thread_t *, void *, int, va_list ); ...@@ -58,13 +58,23 @@ static int DoControl( intf_thread_t *, void *, int, va_list );
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i ) VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{ {
/* Init */
vlc_mutex_init( p_intf, &lock ); vlc_mutex_init( p_intf, &lock );
p_vout = NULL; p_vout = NULL;
hide(); setMinimumSize( 16, 16 ); hide(); setMinimumSize( 16, 16 );
videoSize.rwidth() = -1;
videoSize.rheight() = -1;
// CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) ); /* Black background is more coherent for a Video Widget IMVHO */
QPalette plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt );
/* The core can ask through a callback to show the video */
CONNECT( this, askVideoWidgetToShow(), this, show() ); CONNECT( this, askVideoWidgetToShow(), this, show() );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); /* The core can ask through a callback to resize the video */
// CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) );
} }
VideoWidget::~VideoWidget() VideoWidget::~VideoWidget()
...@@ -88,11 +98,12 @@ VideoWidget::~VideoWidget() ...@@ -88,11 +98,12 @@ VideoWidget::~VideoWidget()
} }
/** /**
* Request the video to avoid the conflicts * Request the video to avoid the conflicts
**/ **/
void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
unsigned int *pi_width, unsigned int *pi_height ) unsigned int *pi_width, unsigned int *pi_height )
{ {
msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
emit askVideoWidgetToShow(); emit askVideoWidgetToShow();
if( p_vout ) if( p_vout )
{ {
...@@ -104,19 +115,30 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, ...@@ -104,19 +115,30 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
} }
/* Set the Widget to the correct Size */ /* Set the Widget to the correct Size */
/* Function has to be called by the parent
Parent has to care about resizing himself*/
void VideoWidget::SetSizing( unsigned int w, unsigned int h ) void VideoWidget::SetSizing( unsigned int w, unsigned int h )
{ {
resize( w, h ); msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
//updateGeometry(); // Needed for deinterlace videoSize.rwidth() = w;
msg_Dbg( p_intf, "%i %i", sizeHint().height(), sizeHint().width() ); videoSize.rheight() = h;
//emit askResize(); updateGeometry(); // Needed for deinterlace
} }
void VideoWidget::release( void *p_win ) void VideoWidget::release( void *p_win )
{ {
msg_Dbg( p_intf, "Video is non needed anymore" );
p_vout = NULL; p_vout = NULL;
videoSize.rwidth() = 0;
videoSize.rheight() = 0;
hide();
updateGeometry(); // Needed for deinterlace
} }
QSize VideoWidget::sizeHint() const
{
return videoSize;
}
/********************************************************************** /**********************************************************************
* Background Widget. Show a simple image background. Currently, * Background Widget. Show a simple image background. Currently,
......
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include "qt4.hpp" #include "qt4.hpp"
#include "main_interface.hpp"
#include <QWidget> #include <QWidget>
#include <QFrame> #include <QFrame>
...@@ -50,6 +51,8 @@ class QHBoxLayout; ...@@ -50,6 +51,8 @@ class QHBoxLayout;
class VideoWidget : public QFrame class VideoWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
friend class MainInterface;
public: public:
VideoWidget( intf_thread_t * ); VideoWidget( intf_thread_t * );
virtual ~VideoWidget(); virtual ~VideoWidget();
...@@ -59,11 +62,13 @@ public: ...@@ -59,11 +62,13 @@ public:
void release( void * ); void release( void * );
int control( void *, int, va_list ); int control( void *, int, va_list );
virtual QSize sizeHint() const;
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
vout_thread_t *p_vout; vout_thread_t *p_vout;
vlc_mutex_t lock; vlc_mutex_t lock;
QSize videoSize;
signals: signals:
void askVideoWidgetToShow(); void askVideoWidgetToShow();
......
This diff is collapsed.
...@@ -74,14 +74,17 @@ public: ...@@ -74,14 +74,17 @@ public:
unsigned int *pi_height ); unsigned int *pi_height );
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 );
void requestLayoutUpdate();
/* Getters */ /* Getters */
QSystemTrayIcon *getSysTray() { return sysTray; }; QSystemTrayIcon *getSysTray() { return sysTray; };
QMenu *getSysTrayMenu() { return systrayMenu; }; QMenu *getSysTrayMenu() { return systrayMenu; };
int getControlsVisibilityStatus(); int getControlsVisibilityStatus();
/* Sizehint() */ bool b_toUpdate;
#if 0 /* Sizehint() */
QSize sizeHint() const; QSize sizeHint() const;
#endif
protected: protected:
// void resizeEvent( QResizeEvent * ); // void resizeEvent( QResizeEvent * );
void dropEvent( QDropEvent *); void dropEvent( QDropEvent *);
...@@ -102,13 +105,16 @@ private: ...@@ -102,13 +105,16 @@ private:
QProgressBar *pgBar; QProgressBar *pgBar;
void handleMainUi( QSettings* ); void handleMainUi( QSettings* );
void privacy(); void askForPrivacy();
int privacyDialog( QList<ConfigControl *> controls ); int privacyDialog( QList<ConfigControl *> controls );
/* Systray */ /* Systray */
void handleSystray(); void handleSystray();
void createSystray(); void createSystray();
void createStatusBar();
void initSystray();
/* Video */ /* Video */
VideoWidget *videoWidget; VideoWidget *videoWidget;
// QSize savedVideoSize; // QSize savedVideoSize;
......
...@@ -290,7 +290,7 @@ static void Init( intf_thread_t *p_intf ) ...@@ -290,7 +290,7 @@ static void Init( intf_thread_t *p_intf )
* see commits 21610 21622 21654 for reference */ * see commits 21610 21622 21654 for reference */
/* If you don't have a gconftool-2 binary, you should comment this line */ /* If you don't have a gconftool-2 binary, you should comment this line */
QApplication::setDesktopSettingsAware( false ); // QApplication::setDesktopSettingsAware( false );
#endif #endif
/* Start the QApplication here */ /* Start the QApplication here */
...@@ -309,7 +309,8 @@ static void Init( intf_thread_t *p_intf ) ...@@ -309,7 +309,8 @@ static void Init( intf_thread_t *p_intf )
{ {
MainInterface *p_mi = new MainInterface( p_intf ); MainInterface *p_mi = new MainInterface( p_intf );
p_intf->p_sys->p_mi = p_mi; p_intf->p_sys->p_mi = p_mi;
p_mi->show(); /* We don't show it because it is done in the MainInterface constructor
p_mi->show(); */
} }
else else
vlc_thread_ready( p_intf ); vlc_thread_ready( p_intf );
......
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