]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.cpp
psz_intf_switch was read-only: remove dead code
[vlc] / modules / gui / qt4 / components / interface_widgets.cpp
index 66b75b364187d2a5e72f24148bd08ccf56450f6a..56987d123b43487a8a74cfa4085b1339e5eeb000 100644 (file)
@@ -67,16 +67,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
 {
     /* Init */
     i_vout = 0;
-    hide(); setMinimumSize( 16, 16 );
     videoSize.rwidth() = -1;
     videoSize.rheight() = -1;
+
+    hide();
+
+    /* Set the policy to expand in both directions */
     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();
-    plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
-    plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
+    plt.setColor( QPalette::Window, Qt::black );
     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 );
 
     /* 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 )
              this, SLOT(SetSizing(unsigned int, unsigned int )),
              Qt::BlockingQueuedConnection );
 #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)),
              this, SLOT(SetSizing(unsigned int, unsigned int )) );
 #endif
@@ -99,23 +106,16 @@ void VideoWidget::paintEvent(QPaintEvent *ev)
 #endif
 }
 
+/* Kill the vout at Destruction */
 VideoWidget::~VideoWidget()
 {
-    vout_thread_t *p_vout = i_vout
-        (vout_thread_t *)vlc_object_get( i_vout ) : NULL;
+    vout_thread_t *p_vout = i_vout ?
+        (vout_thread_t *)vlc_object_get( i_vout ) : NULL;
 
     if( p_vout )
     {
-        if( !p_intf->psz_switch_intf )
-        {
-            if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
-                vout_Control( p_vout, VOUT_REPARENT );
-        }
-        else
-        {
-            if( vout_Control( p_vout, VOUT_REPARENT ) != VLC_SUCCESS )
-                vout_Control( p_vout, VOUT_CLOSE );
-        }
+        if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
+            vout_Control( p_vout, VOUT_REPARENT );
         vlc_object_release( p_vout );
     }
 }
@@ -134,7 +134,9 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
         return NULL;
     }
     i_vout = p_nvout->i_object_id;
+#ifndef NDEBUG
     msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
+#endif
     return ( void* )winId();
 }
 
@@ -156,8 +158,8 @@ void VideoWidget::release( void *p_win )
     i_vout = 0;
     videoSize.rwidth() = 0;
     videoSize.rheight() = 0;
+    updateGeometry();
     hide();
-    updateGeometry(); // Needed for deinterlace
 }
 
 QSize VideoWidget::sizeHint() const
@@ -171,7 +173,7 @@ QSize VideoWidget::sizeHint() const
  **********************************************************************/
 #define ICON_SIZE 128
 #define MAX_BG_SIZE 400
-#define MIN_BG_SIZE 64
+#define MIN_BG_SIZE 128
 
 BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
                  :QWidget( NULL ), p_intf( _p_i )
@@ -181,7 +183,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
 
     /* A dark background */
     setAutoFillBackground( true );
-    plt =  palette();
+    plt = palette();
     plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
     plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
     setPalette( plt );
@@ -336,6 +338,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, bool b_fsCreation = f
     BUTTON_SET_ACT( frameButton, "Fr", qtr( "Frame by frame" ), frame() );
 #endif
 
+    /* Record Button */
     recordButton = new QPushButton;
     setupSmallButton( recordButton );
     advLayout->addWidget( recordButton );
@@ -360,7 +363,14 @@ void AdvControlsWidget::enableInput( bool enable )
     {
         input_item_t *p_item = input_GetItem( THEMIM->getInput() );
         i_input_id = p_item->i_id;
+
+        recordButton->setVisible( var_GetBool( THEMIM->getInput(), "can-record" ) );
+    }
+    else
+    {
+        recordButton->setVisible( false );
     }
+
     ABButton->setEnabled( enable );
     recordButton->setEnabled( enable );
 
@@ -439,15 +449,15 @@ void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
     }
 }
 
-/* FIXME Record function */
 void AdvControlsWidget::record()
 {
     input_thread_t *p_input = THEMIM->getInput();
     if( p_input )
     {
         /* This method won't work fine if the stream can't be cut anywhere */
-        if( var_Type( p_input, "record-toggle" ) == VLC_VAR_VOID )
-            var_TriggerCallback( p_input, "record-toggle" );
+        const bool b_recording = var_GetBool( p_input, "record" );
+        var_SetBool( p_input, "record", !b_recording );
+#if 0
         else
         {
             /* 'record' access-filter is not loaded, we open Save dialog */
@@ -459,6 +469,7 @@ void AdvControlsWidget::record()
             if( psz )
                 THEDP->streamingDialog( NULL, psz, true );
         }
+#endif
     }
 }
 
@@ -830,13 +841,13 @@ void ControlsWidget::setNavigation( int navigation )
     {
         discFrame->hide();
     } else if( navigation == 1 ) {
-        prevSectionButton->setToolTip( qfu( HELP_PCH ) );
-        nextSectionButton->setToolTip( qfu( HELP_NCH ) );
+        prevSectionButton->setToolTip( qtr( HELP_PCH ) );
+        nextSectionButton->setToolTip( qtr( HELP_NCH ) );
         menuButton->show();
         discFrame->show();
     } else {
-        prevSectionButton->setToolTip( qfu( HELP_PCH ) );
-        nextSectionButton->setToolTip( qfu( HELP_NCH ) );
+        prevSectionButton->setToolTip( qtr( HELP_PCH ) );
+        nextSectionButton->setToolTip( qtr( HELP_NCH ) );
         menuButton->hide();
         discFrame->show();
     }
@@ -987,13 +998,14 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
     setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
 
     QGridLayout *fsLayout = new QGridLayout( this );
-    fsLayout->setLayoutMargins( 5, 1, 5, 1, 5 );
+    fsLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
 
     /* First line */
     slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);
+    slider->setMinimumWidth( 220 );
     fsLayout->addWidget( slowerButton, 0, 0 );
-    fsLayout->addWidget( slider, 0, 1, 1, 8 );
-    fsLayout->addWidget( fasterButton, 0, 9 );
+    fsLayout->addWidget( slider, 0, 1, 1, 9 );
+    fsLayout->addWidget( fasterButton, 0, 10 );
 
     fsLayout->addWidget( playButton, 1, 0, 1, 2 );
     fsLayout->addLayout( controlButLayout, 1, 2 );
@@ -1003,8 +1015,9 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
     fsLayout->addWidget( fullscreenButton, 1, 5 );
     fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );
 
-    fsLayout->addWidget( volMuteLabel, 1, 7 );
-    fsLayout->addWidget( volumeSlider, 1, 8, 1, 2 );
+    fsLayout->setColumnStretch( 7, 10 );
+    fsLayout->addWidget( volMuteLabel, 1, 8 );
+    fsLayout->addWidget( volumeSlider, 1, 9, 1, 2 );
 
     /* hiding timer */
     p_hideTimer = new QTimer( this );