[vlc-devel] [PATCH 1/2] gui/qt: fix setup of loop-button icon

Filip Roséen filip at videolabs.io
Mon May 30 18:18:05 CEST 2016


Given that NORMAL=0, REPEAT_ALL=1, REPEAT_ONE=3 the previous code would
not always yield the correct state for the loop button during setup.

This patch fixes that issue.
---
 modules/gui/qt/components/controller.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp
index 7acf5c3..5da9acd 100644
--- a/modules/gui/qt/components/controller.cpp
+++ b/modules/gui/qt/components/controller.cpp
@@ -448,8 +448,16 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         setupButton( loopButton );
         loopButton->setToolTip( qtr( "Click to toggle between loop all, loop one and no loop") );
         loopButton->setCheckable( true );
-        int i_state = 2 * var_GetBool( THEPL, "loop" ) + var_GetBool( THEPL, "repeat" );
-        loopButton->updateButtonIcons( i_state );
+
+        { // initialize loop-button icon //
+            int i_state = NORMAL;
+
+            if( var_GetBool( THEPL, "loop" ) )   i_state = REPEAT_ALL;
+            if( var_GetBool( THEPL, "repeat" ) ) i_state = REPEAT_ONE;
+
+            loopButton->updateButtonIcons( i_state );
+        }
+
         CONNECT( THEMIM, repeatLoopChanged( int ), loopButton, updateButtonIcons( int ) );
         CONNECT( loopButton, clicked(), THEMIM, loopRepeatLoopStatus() );
         widget = loopButton;
-- 
2.8.3



More information about the vlc-devel mailing list