1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-08 11:26:59 +02:00

Qt4 - small fixes... Remove one redondant connect, block the access to the speedSlider if there is no input.

This commit is contained in:
Jean-Baptiste Kempf 2008-02-12 08:33:39 +00:00
parent e1bc46e792
commit 19a891e281
3 changed files with 23 additions and 6 deletions

View File

@ -148,11 +148,11 @@ QSize VideoWidget::sizeHint() const
#define MAX_BG_SIZE 400 #define MAX_BG_SIZE 400
#define MIN_BG_SIZE 64 #define MIN_BG_SIZE 64
BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) : BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
QWidget( NULL ), p_intf( _p_i ) :QWidget( NULL ), p_intf( _p_i )
{ {
/* We should use that one to take the more size it can */ /* We should use that one to take the more size it can */
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); // setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
/* A dark background */ /* A dark background */
setAutoFillBackground( true ); setAutoFillBackground( true );
@ -179,13 +179,20 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
backgroundLayout->setColumnStretch( 2, 1 ); backgroundLayout->setColumnStretch( 2, 1 );
CONNECT( THEMIM->getIM(), artChanged( QString ), this, update( QString ) ); CONNECT( THEMIM->getIM(), artChanged( QString ), this, update( QString ) );
resize( 300, 150 );
} }
BackgroundWidget::~BackgroundWidget() BackgroundWidget::~BackgroundWidget()
{ {
} }
void BackgroundWidget::resizeEvent( QResizeEvent * event )
{
if( event->size().height() <= MIN_BG_SIZE )
label->hide();
else
label->show();
}
void BackgroundWidget::update( QString url ) void BackgroundWidget::update( QString url )
{ {
if( url.isNull() ) if( url.isNull() )
@ -613,7 +620,6 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) ); CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) ); CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
CONNECT( THEMIM->getIM(), statusChanged( int ), this, updateInput() );
updateInput(); updateInput();
} }
@ -828,6 +834,11 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
SpeedControlWidget::~SpeedControlWidget() SpeedControlWidget::~SpeedControlWidget()
{} {}
void SpeedControlWidget::setEnable( bool b_enable )
{
speedSlider->setEnabled( b_enable );
}
void SpeedControlWidget::mouseDoubleClickEvent( QMouseEvent * event ) void SpeedControlWidget::mouseDoubleClickEvent( QMouseEvent * event )
{ {
resetRate(); resetRate();

View File

@ -91,7 +91,7 @@ private:
QLabel *label; QLabel *label;
virtual void contextMenuEvent( QContextMenuEvent *event ); virtual void contextMenuEvent( QContextMenuEvent *event );
intf_thread_t *p_intf; intf_thread_t *p_intf;
virtual void resizeEvent( QResizeEvent * event );
public slots: public slots:
void toggle(){ TOGGLEV( this ); } void toggle(){ TOGGLEV( this ); }
void update( QString ); void update( QString );
@ -252,6 +252,8 @@ protected:
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QSlider *speedSlider; QSlider *speedSlider;
public slots:
void setEnable( bool );
private slots: private slots:
void updateRate( int ); void updateRate( int );
void resetRate(); void resetRate();

View File

@ -904,6 +904,10 @@ void MainInterface::setStatus( int status )
{ {
/* Forward the status to the controls to toggle Play/Pause */ /* Forward the status to the controls to toggle Play/Pause */
controls->setStatus( status ); controls->setStatus( status );
controls->updateInput();
speedControl->setEnable( THEMIM->getIM()->hasInput() );
/* And in the systray for the menu */ /* And in the systray for the menu */
if( sysTray ) if( sysTray )
QVLCMenu::updateSystrayMenu( this, p_intf ); QVLCMenu::updateSystrayMenu( this, p_intf );