[mythtv-users] FF/REW key binding confusion

David Engel dlengel at attbi.com
Mon Jun 16 14:03:44 EDT 2003


On Sun, Jun 15, 2003 at 08:05:11PM -0400, Isaac Richards wrote:
> On Sunday 15 June 2003 01:02 pm, Albert Santoni wrote:
> > I think the developers need to see this. While the quality of MythTV is
> > impressive in many areas, the organization and integration of the
> > keybindings in Myth is going downhill. There are LOTS of little annoying
> > things like this in Myth that are making it harder to use all the modules
> > together successfully.
> > If any of the developers see this, please try to make this a priority.
> 
> Please feel free to submit patches to the mailing lists.

Here's the beginnings of a patch I've started to make the key bindings
better suit my universal remote and Tivo-influenced tastes.  Feel free
to use or ignore it.

The patch does the following:

Adds alternate fast forward and rewind keys which always act as if
stickykeys is turned on.

Eliminates the need to set the fast forward and rewind times to 1
second for stickykeys mode.

Simplifies the code slightly, IMHO, by combining doing_ff and
doing_rew into one variable.

David
-- 
David Engel
dlengel at attbi.com


Index: keys.txt
===================================================================
RCS file: /var/lib/mythcvs/mythtv/keys.txt,v
retrieving revision 1.20
diff -u -r1.20 keys.txt
--- keys.txt	26 May 2003 18:42:22 -0000	1.20
+++ keys.txt	16 Jun 2003 17:33:59 -0000
@@ -38,7 +38,9 @@
 
 - Left arrow to rewind the configured number of seconds.  (default is 5)
 - Right arrow to fast forward the configured number of seconds. (default is 30)
+- > starts fast forward mode as if stickykeys are selected.
+- < starts rewind mods as if stickykeys are selected.
 
 With the stickykeys option selected:
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.63
diff -u -r1.63 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	5 Jun 2003 03:38:48 -0000	1.63
+++ libs/libmythtv/tv_play.cpp	16 Jun 2003 17:34:00 -0000
@@ -658,8 +658,7 @@
     }
 
     paused = false;
-    doing_ff = false;
-    doing_rew = false;
+    doing_ff_rew = 0;
     ff_rew_index = SSPEED_NORMAL;
     ff_rew_scaling = 1.0;
 
@@ -708,8 +707,7 @@
     int keypressed;
 
     stickykeys = gContext->GetNumSetting("StickyKeys");
-    doing_ff = false;
-    doing_rew = false;
+    doing_ff_rew = 0;
     ff_rew_scaling = 1.0;
     ff_rew_index = SSPEED_NORMAL;
 
@@ -734,15 +732,15 @@
         {
             if ((keypressed = nvp->CheckEvents()))
                 ProcessKeypress(keypressed);
-            else if (stickykeys)
+            else if (doing_ff_rew)
             {
-                if (doing_ff)
-                    DoFF();
-                else if (doing_rew)
-                    DoRew();
+                if (doing_ff_rew > 0)
+                    DoFF(1);
+                else
+                    DoRew(1);
                 if (ff_rew_index > SSPEED_NORMAL)
                     usleep(50000);
-            }
+	    }
         }
 
         if (StateIsPlaying(internalState))
@@ -882,61 +880,66 @@
         }
         case 'z': case 'Z':
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoSkipCommercials(1);
             break;
         }
         case 'q': case 'Q':
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoSkipCommercials(-1);
             break;
         }
         case 's': case 'S': case 'p': case 'P': 
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoPause();
             break;
         }
         case wsRight: case 'd': case 'D': case wsF8: 
         {
-            if (stickykeys)
+            if (!stickykeys)
             {
-                if (doing_ff)
-                    ff_rew_index = (++ff_rew_index % SSPEED_MAX);
-                else
-                {
-                    doing_ff = true;
-                    ff_rew_index = SSPEED_NORMAL;
-                }
-            }
-            else
+		doing_ff_rew = 0;
                 ff_rew_index = SSPEED_NORMAL;
-
-            doing_rew = false;
-            DoFF(); 
+		DoFF(fftime); 
+		break;
+            }
+	    // fall through
+        }
+        case '>': case '.':
+        {
+	    if (doing_ff_rew > 0)
+		ff_rew_index = (++ff_rew_index % SSPEED_MAX);
+	    else
+            {
+		doing_ff_rew = 1;
+		ff_rew_index = SSPEED_NORMAL;
+	    }
+            DoFF(1); 
             break;
         }
         case wsLeft: case 'a': case 'A': case wsF5:
         {
-            if (stickykeys)
+            if (!stickykeys)
             {
-                if (doing_rew)
-                    ff_rew_index = (++ff_rew_index % SSPEED_MAX);
-                else
-                {
-                    doing_rew = true;
-                    ff_rew_index = SSPEED_NORMAL;
-                }
-            }
-            else
+		doing_ff_rew = 0;
                 ff_rew_index = SSPEED_NORMAL;
-
-            doing_ff = false;
-            DoRew(); 
+		DoRew(rewtime);
+		break;
+            }
+	    // fall through
+        }
+        case '<': case ',':
+        {
+	    if (doing_ff_rew < 0)
+		ff_rew_index = (++ff_rew_index % SSPEED_MAX);
+	    else
+            {
+		doing_ff_rew = -1;
+		ff_rew_index = SSPEED_NORMAL;
+	    }
+            DoRew(1);
             break;
         }
         case wsPageUp:
@@ -980,7 +983,7 @@
 
         default: 
         {
-            if (doing_ff || doing_rew)
+            if (doing_ff_rew)
             {
                 switch (keypressed)
                 {
@@ -996,8 +999,7 @@
                     case wsNine:  case '9': ff_rew_index = SSPEED_FAST_6; break;
 
                     default:
-                       doing_ff = false;
-                       doing_rew = false;
+                       doing_ff_rew = 0;
                        was_doing_ff_rew = true;
                        break;
                 }
@@ -1314,7 +1316,7 @@
     }
 }
 
-void TV::DoFF(void)
+void TV::DoFF(int time)
 {
     bool slidertype = false;
     if (internalState == kState_WatchingLiveTV)
@@ -1327,14 +1329,14 @@
     if (activenvp == nvp)
     {
         QString desc = "";
-        int pos = calcSliderPos((int)(fftime * ff_rew_scaling), desc);
+        int pos = calcSliderPos((int)(time * ff_rew_scaling), desc);
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->FastForward(fftime * ff_rew_scaling);
+    activenvp->FastForward(time * ff_rew_scaling);
 }
 
-void TV::DoRew(void)
+void TV::DoRew(int time)
 {
     bool slidertype = false;
     if (internalState == kState_WatchingLiveTV)
@@ -1347,11 +1349,11 @@
     if (activenvp == nvp)
     {
         QString desc = "";
-        int pos = calcSliderPos(0 - (int)(rewtime * ff_rew_scaling), desc);
+        int pos = calcSliderPos(0 - (int)(time * ff_rew_scaling), desc);
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->Rewind(rewtime * ff_rew_scaling);
+    activenvp->Rewind(time * ff_rew_scaling);
 }
 
 void TV::DoJumpAhead(void)
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.30
diff -u -r1.30 tv_play.h
--- libs/libmythtv/tv_play.h	23 Apr 2003 21:15:18 -0000	1.30
+++ libs/libmythtv/tv_play.h	16 Jun 2003 17:34:00 -0000
@@ -105,8 +105,8 @@
 
     void DoInfo(void);
     void DoPause(void);
-    void DoFF(void);
-    void DoRew(void);
+    void DoFF(int time);
+    void DoRew(int time);
     void DoJumpAhead(void);
     void DoJumpBack(void);
     void DoSkipCommercials(int direction);
@@ -168,8 +168,7 @@
     int fftime;
     int rewtime;
     int stickykeys;
-    bool doing_ff;
-    bool doing_rew;
+    int doing_ff_rew;
     int ff_rew_index;
     float ff_rew_scaling;
 
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.65
diff -u -r1.65 globalsettings.cpp
--- programs/mythfrontend/globalsettings.cpp	9 Jun 2003 23:55:02 -0000	1.65
+++ programs/mythfrontend/globalsettings.cpp	16 Jun 2003 17:34:00 -0000
@@ -242,9 +242,9 @@
         setLabel("Sticky keys");
         setValue(false);
         setHelpText("If this is set, fast forward and rewind continue after the key is released, until "
-                    "the key is pressed again.  If enabled, set FastForwardAmount "
-                    "and RewindAmount to one second.");
+                    "the key is pressed again.  The alternate fast forward and rewind keys always behave "
+		    "this way.");
     };
 };
 


More information about the mythtv-users mailing list