]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.cpp
Qt: fix a leak of telexFrame in Controller
[vlc] / modules / gui / qt4 / components / controller.cpp
index 0f688bef6bc8963dba44b05bb59ada3e1d1e767f..3e03a374084428dfdce9ca32dbaf0940c47614a7 100644 (file)
@@ -46,6 +46,8 @@
 #include <QSignalMapper>
 #include <QTimer>
 
+//#define DEBUG_LAYOUT 1
+
 /**********************************************************************
  * TEH controls
  **********************************************************************/
@@ -143,13 +145,13 @@ void AbstractController::createAndAddWidget( QBoxLayout *controlLayout,
     /* Special case for SPACERS, who aren't QWidgets */
     if( i_type == WIDGET_SPACER )
     {
-        controlLayout->insertSpacing( i_index, 16 );
+        controlLayout->insertSpacing( i_index, 12 );
         return;
     }
 
     if(  i_type == WIDGET_SPACER_EXTEND )
     {
-        controlLayout->insertStretch( i_index, 16 );
+        controlLayout->insertStretch( i_index, 12 );
         return;
     }
 
@@ -287,8 +289,8 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         InputSlider *slider = new InputSlider( Qt::Horizontal, NULL );
 
         /* Update the position when the IM has changed */
-        CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
-                slider, setPosition( float, int, int ) );
+        CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
+                slider, setPosition( float, int64_t, int ) );
         /* And update the IM, when the position has changed */
         CONNECT( slider, sliderDragged( float ),
                  THEMIM->getIM(), sliderUpdate( float ) );
@@ -363,6 +365,7 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
     case RANDOM_BUTTON: {
         NORMAL_BUTTON( RANDOM );
         RANDOMButton->setCheckable( true );
+        RANDOMButton->setChecked( var_GetBool( THEPL, "random" ) );
         CONNECT( THEMIM, randomChanged( bool ),
                  RANDOMButton, setChecked( bool ) );
         }
@@ -378,6 +381,10 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         widget = loopButton;
         }
         break;
+    case INFO_BUTTON: {
+        NORMAL_BUTTON( INFO );
+        }
+        break;
     default:
         msg_Warn( p_intf, "This should not happen %i", button );
         break;
@@ -467,7 +474,7 @@ QFrame *AbstractController::telexFrame()
     /**
      * Telextext QFrame
      **/
-    QFrame *telexFrame = new QFrame;
+    QFrame *telexFrame = new QFrame( this );
     QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
     telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
     CONNECT( THEMIM->getIM(), teletextPossible( bool ),
@@ -547,19 +554,22 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
 {
     /* advanced Controls handling */
     b_advancedVisible = b_advControls;
+#if DEBUG_LAYOUT
+    setStyleSheet( " background: red ");
+#endif
 
     QVBoxLayout *controlLayout = new QVBoxLayout( this );
-    controlLayout->setLayoutMargins( 6, 4, 6, 2, 5 );
+    controlLayout->setContentsMargins( 4, 1, 4, 0 );
     controlLayout->setSpacing( 0 );
     QHBoxLayout *controlLayout1 = new QHBoxLayout;
-    controlLayout1->setSpacing( 0 );
+    controlLayout1->setSpacing( 0 ); controlLayout1->setMargin( 0 );
 
     QString line1 = getSettings()->value( "MainToolbar1", MAIN_TB1_DEFAULT )
                                         .toString();
     parseAndCreate( line1, controlLayout1 );
 
     QHBoxLayout *controlLayout2 = new QHBoxLayout;
-    controlLayout2->setSpacing( 0 );
+    controlLayout2->setSpacing( 0 ); controlLayout2->setMargin( 0 );
     QString line2 = getSettings()->value( "MainToolbar2", MAIN_TB2_DEFAULT )
                                         .toString();
     parseAndCreate( line2, controlLayout2 );
@@ -596,6 +606,10 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
     controlLayout = new QHBoxLayout( this );
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
+#if DEBUG_LAYOUT
+    setStyleSheet( " background: orange ");
+#endif
+
 
     QString line = getSettings()->value( "AdvToolbar", ADV_TB_DEFAULT )
         .toString();
@@ -608,6 +622,9 @@ InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent
     controlLayout = new QHBoxLayout( this );
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
+#if DEBUG_LAYOUT
+    setStyleSheet( " background: green ");
+#endif
 
     QString line = getSettings()->value( "InputToolbar", INPT_TB_DEFAULT ).toString();
     parseAndCreate( line, controlLayout );
@@ -641,7 +658,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
     setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
 
     QVBoxLayout *controlLayout2 = new QVBoxLayout( this );
-    controlLayout2->setLayoutMargins( 4, 6, 4, 2, 5 );
+    controlLayout2->setContentsMargins( 4, 6, 4, 2 );
 
     /* First line */
     InputControlsWidget *inputC = new InputControlsWidget( p_intf, this );
@@ -671,7 +688,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
     /* First Move */
     QRect rect1 = getSettings()->value( "FullScreen/screen" ).toRect();
     QPoint pos1 = getSettings()->value( "FullScreen/pos" ).toPoint();
-    int number =  config_GetInt( p_intf, "qt-fullscreen-screennumber" );
+    int number =  var_InheritInteger( p_intf, "qt-fullscreen-screennumber" );
     if( number == -1 || number > QApplication::desktop()->numScreens() )
         number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
 
@@ -729,7 +746,7 @@ void FullscreenControllerWidget::showFSC()
     }
 
 #if HAVE_TRANSPARENCY
-    setWindowOpacity( config_GetFloat( p_intf, "qt-fs-opacity" )  );
+    setWindowOpacity( var_InheritFloat( p_intf, "qt-fs-opacity" )  );
 #endif
 
     show();