[mythtv] [PATCH] Re-try of the LCD channel info patch
Tako Schotanus
quintesse at palacio-cristal.com
Thu Jul 15 18:08:10 EDT 2004
Is this more like it is supposed to be Isaac? Only the timer thread now
updates the LCD while other parts of the code that want the LCD updated
immediately instead of waiting for the timer to fire now just set the
timer to fire within a very short time. Is that sufficient?
I changed the 1 second interval to 1 minute like you suggested, the only
reason why I ever used such a short time in the first place was because
I hadn't expected that calling that function would take such a toll,
Cheers,
-Tako
-------------- next part --------------
Index: tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.186
diff -u -d -r1.186 tv_play.cpp
--- tv_play.cpp 11 Jun 2004 03:16:54 -0000 1.186
+++ tv_play.cpp 15 Jul 2004 21:18:12 -0000
@@ -68,6 +68,7 @@
const int SSLEEP_MAX = sizeof sleep_timer_array / sizeof sleep_timer_array[0];
const int kMuteTimeout = 800;
+const int kLCDTimeout = 60000;
void TV::InitKeys(void)
{
@@ -231,6 +232,9 @@
sleepTimer = new QTimer(this);
connect(sleepTimer, SIGNAL(timeout()), SLOT(SleepEndTimer()));
+
+ lcdTimer = new QTimer(this);
+ connect(lcdTimer, SIGNAL(timeout()), SLOT(LCDEndTimer()));
}
void TV::Init(bool createWindow)
@@ -361,6 +365,13 @@
if (m_db)
delete m_db;
+
+ gContext->GetLCDDevice()->switchToTime();
+ if (lcdTimer)
+ {
+ lcdTimer->stop();
+ delete lcdTimer;
+ }
}
TVState TV::GetState(void)
@@ -495,6 +506,9 @@
changeState = true;
+ gContext->GetLCDDevice()->switchToChannel(rcinfo->chansign, rcinfo->title, rcinfo->subtitle);
+ lcdTimer->start(kLCDTimeout, false);
+
return 1;
}
@@ -749,6 +763,9 @@
internalState = tmpInternalState;
changeState = false;
+ if (internalState == kState_WatchingLiveTV)
+ UpdateLCD();
+
if (recorder)
recorder->FrontendReady();
}
@@ -2191,7 +2208,10 @@
activenvp->Play(1.0, true, false);
if (activenvp == nvp)
+ {
UpdateOSDInput();
+ UpdateLCD();
+ }
}
void TV::ToggleChannelFavorite(void)
@@ -2264,6 +2284,7 @@
if (activenvp == nvp)
{
UpdateOSD();
+ UpdateLCD();
AddPreviousChannel();
}
@@ -2458,6 +2479,7 @@
if (activenvp == nvp)
{
UpdateOSD();
+ UpdateLCD();
AddPreviousChannel();
}
@@ -2597,6 +2619,39 @@
osd_display_time);
}
+void TV::UpdateLCD(void)
+{
+ // Make sure the LCD information gets updated shortly
+ lcdTimer->start(250, true);
+}
+
+void TV::LCDEndTimer(void)
+{
+ if (internalState == kState_WatchingLiveTV)
+ {
+ QString title, subtitle, callsign, dummy;
+ GetChannelInfo(recorder, title, subtitle, dummy, dummy, dummy, dummy, callsign, dummy, dummy, dummy, dummy, dummy);
+ if ((callsign != lcdCallsign) || (title != lcdTitle) || (subtitle != lcdSubtitle))
+ {
+ gContext->GetLCDDevice()->switchToChannel(callsign, title, subtitle);
+ lcdCallsign = callsign;
+ lcdTitle = title;
+ lcdSubtitle = subtitle;
+ }
+ }
+
+ float progress = 0.0;
+ if (activenvp)
+ {
+ QString dummy;
+ int pos = activenvp->calcSliderPos(dummy);
+ progress = (float)pos / 1000;
+ }
+ gContext->GetLCDDevice()->setChannelProgress(progress);
+
+ lcdTimer->start(kLCDTimeout, true);
+}
+
void TV::GetNextProgram(RemoteEncoder *enc, int direction,
QMap<QString, QString> &infoMap)
{
Index: tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.73
diff -u -d -r1.73 tv_play.h
--- tv_play.h 5 Jun 2004 01:20:32 -0000 1.73
+++ tv_play.h 15 Jul 2004 21:18:12 -0000
@@ -101,6 +101,7 @@
void SleepEndTimer(void);
void TreeMenuEntered(OSDListTreeType *tree, OSDGenericTree *item);
void TreeMenuSelected(OSDListTreeType *tree, OSDGenericTree *item);
+ void LCDEndTimer(void);
protected:
void doLoadMenu(void);
@@ -197,6 +198,8 @@
void BuildOSDTreeMenu(void);
void ShowOSDTreeMenu(void);
+ void UpdateLCD(void);
+
int osd_display_time;
bool arrowAccel;
@@ -319,6 +322,9 @@
QTimer *sleepTimer;
char vbimode;
+
+ QTimer *lcdTimer;
+ QString lcdTitle, lcdSubtitle, lcdCallsign;
};
#endif
More information about the mythtv-dev
mailing list