[vlc-devel] [PATCH] hotkeys: added OSD messages for loop and random toggle

John French jdaviesf7 at gmail.com
Fri Feb 15 19:35:27 CET 2013


Resolves ticket #7933
---
 modules/control/hotkeys.c | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 42e3ba0..4bb5047 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -163,22 +163,47 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
         /* Playlist actions (including audio) */
         case ACTIONID_LOOP:
+        {
             /* Toggle Normal -> Loop -> Repeat -> Normal ... */
+            char *mode;
             if( var_GetBool( p_playlist, "repeat" ) )
+            {
                 var_SetBool( p_playlist, "repeat", false );
-            else
-            if( var_GetBool( p_playlist, "loop" ) )
+                mode = "Off";
+            }
+            else if( var_GetBool( p_playlist, "loop" ) )
             { /* FIXME: this is not atomic, we should use a real tristate */
                 var_SetBool( p_playlist, "loop", false );
                 var_SetBool( p_playlist, "repeat", true );
+                mode = "One";
             }
             else
+            {
                 var_SetBool( p_playlist, "loop", true );
+                mode = "All";
+            }
+            DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                            _("Loop %s"), _(mode) );
             break;
+        }
 
         case ACTIONID_RANDOM:
-            var_ToggleBool( p_playlist, "random" );
+        {
+            char *state;
+            if( var_GetBool( p_playlist, "random" ) )
+            {
+                var_SetBool( p_playlist, "random", false );
+                state = "On";
+            }
+            else
+            {
+                var_SetBool( p_playlist, "random", true );
+                state = "Off";
+            }
+            DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                            _("Random %s"), _(state) );
             break;
+        }
 
         case ACTIONID_NEXT:
             DisplayMessage( p_vout, _("Next") );
-- 
1.8.1.3




More information about the vlc-devel mailing list