[mythtv] [PATCH] OSD Position Updating

David Engel dlengel at attbi.com
Tue Sep 30 23:58:54 EDT 2003


This patch changes the OSD handling to always update the OSD position
text when applicable instead of only doing so when playback is paused.
Admittedly, this isn't terribly important, but does add some nice eye
candy and visual feedback, IMHO.

David
-- 
David Engel
dlengel at attbi.com

Index: libs/libmythtv/osd.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/osd.cpp,v
retrieving revision 1.79
diff -u -r1.79 osd.cpp
--- libs/libmythtv/osd.cpp	2 Sep 2003 22:45:10 -0000	1.79
+++ libs/libmythtv/osd.cpp	30 Sep 2003 22:47:16 -0000
@@ -1617,11 +1617,6 @@
     return NULL;
 }
 
-bool OSD::Visible(void)
-{
-    return m_setsvisible;
-}
-
 OSDSet *OSD::GetSet(const QString &text)
 {
     OSDSet *ret = NULL;
Index: libs/libmythtv/osd.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/osd.h,v
retrieving revision 1.45
diff -u -r1.45 osd.h
--- libs/libmythtv/osd.h	2 Sep 2003 22:45:10 -0000	1.45
+++ libs/libmythtv/osd.h	30 Sep 2003 22:47:16 -0000
@@ -61,7 +61,7 @@
     void UpdatePause(int position, QString slidertext);
     void EndPause(void);
 
-    bool Visible(void);
+    bool Visible(void) { return m_setsvisible; };
 
     void HideSet(const QString &name);
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.105
diff -u -r1.105 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	26 Sep 2003 21:32:19 -0000	1.105
+++ libs/libmythtv/tv_play.cpp	30 Sep 2003 22:47:17 -0000
@@ -699,7 +699,8 @@
     ff_rew_index = SSPEED_NORMAL;
     speed_index = 0;
 
-    int pausecheck = 0;
+    int updatecheck = 0;
+    update_osd_pos = false;
 
     channelqueued = false;
     channelKeys[0] = channelKeys[1] = channelKeys[2] = channelKeys[3] = ' ';
@@ -774,18 +775,23 @@
             exitPlayer = false;
         }
 
-        if (internalState == kState_WatchingLiveTV || 
-            internalState == kState_WatchingRecording)
+	if (++updatecheck >= 20)
         {
-            pausecheck++;
-            if (paused && !(pausecheck % 20))
-            {
+	    if (osd->Visible() && update_osd_pos &&
+		(internalState == kState_WatchingLiveTV ||
+		 internalState == kState_WatchingRecording ||
+		 internalState == kState_WatchingPreRecorded))
+	    {
                 QString desc = "";
                 int pos = nvp->calcSliderPos(0, desc);
                 osd->UpdatePause(pos, desc);
-                pausecheck = 0;
             }
+	    updatecheck = 0;
+        }
 
+        if (internalState == kState_WatchingLiveTV || 
+            internalState == kState_WatchingRecording)
+        {
             if (channelqueued && nvp->GetOSD() && !osd->Visible())
             {
                 ChannelCommit();
@@ -1309,6 +1315,7 @@
         QString desc = "";
         int pos = nvp->calcSliderPos(0, desc);
         osd->StartPause(pos, false, tr("Position"), desc, osd_display_time);
+	update_osd_pos = true;
     }
 }
 
@@ -1329,6 +1336,7 @@
         bool slidertype = (internalState == kState_WatchingLiveTV);
         int disptime = (mesg == tr("Paused")) ? -1 : 2;
         osd->StartPause(pos, slidertype, mesg, desc, disptime);
+	update_osd_pos = true;
     }
 
     bool res;
@@ -1528,6 +1536,7 @@
         QString desc = tr("Searching...");
         int pos = nvp->calcSliderPos(0, dummy);
         osd->StartPause(pos, slidertype, tr("Skip"), desc, 6);
+	update_osd_pos = false;
     }
 
     activenvp->SkipCommercials(direction);
@@ -2013,7 +2022,10 @@
     QString text = QString(tr("Brightness %1 %")).arg(brightness);
 
     if (osd)
+    {
         osd->StartPause(brightness * 10, true, tr("Adjust Picture"), text, 5);
+	update_osd_pos = false;
+    }
 }
 
 void TV::ChangeContrast(bool up)
@@ -2023,7 +2035,10 @@
     QString text = QString(tr("Contrast %1 %")).arg(contrast);
 
     if (osd)
+    {
         osd->StartPause(contrast * 10, true, tr("Adjust Picture"), text, 5);
+	update_osd_pos = false;
+    }
 }
 
 void TV::ChangeColour(bool up)
@@ -2033,7 +2048,10 @@
     QString text = QString(tr("Colour %1 %")).arg(colour);
 
     if (osd)
+    {
         osd->StartPause(colour * 10, true, tr("Adjust Picture"), text, 5);
+	update_osd_pos = false;
+    }
 }
 
 void TV::ChangeHue(bool up)
@@ -2043,7 +2061,10 @@
     QString text = QString(tr("Hue %1 %")).arg(colour);
 
     if (osd)
+    {
         osd->StartPause(colour * 10, true, tr("Adjust Picture"), text, 5);
+	update_osd_pos = false;
+    }
 }
 
 void TV::ChangeVolume(bool up)
@@ -2060,7 +2081,10 @@
     QString text = QString(tr("Volume %1 %")).arg(curvol);
 
     if (osd && !browsemode)
+    {
         osd->StartPause(curvol * 10, true, tr("Adjust Volume"), text, 5);
+	update_osd_pos = false;
+    }
 }
 
 void TV::ToggleMute(void)
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.45
diff -u -r1.45 tv_play.h
--- libs/libmythtv/tv_play.h	25 Aug 2003 19:20:20 -0000	1.45
+++ libs/libmythtv/tv_play.h	30 Sep 2003 22:47:17 -0000
@@ -191,6 +191,7 @@
     int speed_index;
 
     OSD *osd;
+    bool update_osd_pos;
 
     NuppelVideoPlayer *nvp;
     NuppelVideoPlayer *pipnvp;


More information about the mythtv-dev mailing list