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 );
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{
/* Init */
vlc_mutex_init( p_intf, &lock );
p_vout = NULL;
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() );
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()
......@@ -93,6 +103,7 @@ VideoWidget::~VideoWidget()
void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
unsigned int *pi_width, unsigned int *pi_height )
{
msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
emit askVideoWidgetToShow();
if( p_vout )
{
......@@ -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 */
/* Function has to be called by the parent
Parent has to care about resizing himself*/
void VideoWidget::SetSizing( unsigned int w, unsigned int h )
{
resize( w, h );
//updateGeometry(); // Needed for deinterlace
msg_Dbg( p_intf, "%i %i", sizeHint().height(), sizeHint().width() );
//emit askResize();
msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
videoSize.rwidth() = w;
videoSize.rheight() = h;
updateGeometry(); // Needed for deinterlace
}
void VideoWidget::release( void *p_win )
{
msg_Dbg( p_intf, "Video is non needed anymore" );
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,
......
......@@ -32,9 +32,10 @@
#include <vlc/vlc.h>
#include <vlc_interface.h>
#include <vlc_aout.h>
#include "qt4.hpp"
#include "main_interface.hpp"
#include <QWidget>
#include <QFrame>
......@@ -50,6 +51,8 @@ class QHBoxLayout;
class VideoWidget : public QFrame
{
Q_OBJECT
friend class MainInterface;
public:
VideoWidget( intf_thread_t * );
virtual ~VideoWidget();
......@@ -59,11 +62,13 @@ public:
void release( void * );
int control( void *, int, va_list );
virtual QSize sizeHint() const;
private:
intf_thread_t *p_intf;
vout_thread_t *p_vout;
vlc_mutex_t lock;
QSize videoSize;
signals:
void askVideoWidgetToShow();
......
This diff is collapsed.
......@@ -74,14 +74,17 @@ public:
unsigned int *pi_height );
void releaseVideo( void * );
int controlVideo( void *p_window, int i_query, va_list args );
void requestLayoutUpdate();
/* Getters */
QSystemTrayIcon *getSysTray() { return sysTray; };
QMenu *getSysTrayMenu() { return systrayMenu; };
int getControlsVisibilityStatus();
/* Sizehint() */
bool b_toUpdate;
#if 0 /* Sizehint() */
QSize sizeHint() const;
#endif
protected:
// void resizeEvent( QResizeEvent * );
void dropEvent( QDropEvent *);
......@@ -102,13 +105,16 @@ private:
QProgressBar *pgBar;
void handleMainUi( QSettings* );
void privacy();
void askForPrivacy();
int privacyDialog( QList<ConfigControl *> controls );
/* Systray */
void handleSystray();
void createSystray();
void createStatusBar();
void initSystray();
/* Video */
VideoWidget *videoWidget;
// QSize savedVideoSize;
......
......@@ -290,7 +290,7 @@ static void Init( intf_thread_t *p_intf )
* see commits 21610 21622 21654 for reference */
/* If you don't have a gconftool-2 binary, you should comment this line */
QApplication::setDesktopSettingsAware( false );
// QApplication::setDesktopSettingsAware( false );
#endif
/* Start the QApplication here */
......@@ -309,7 +309,8 @@ static void Init( intf_thread_t *p_intf )
{
MainInterface *p_mi = new MainInterface( p_intf );
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
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