[mythtv] [PATCH] Show guide on entering Live TV

Kevin Kuphal kuphal at dls.net
Fri Aug 6 01:32:02 EDT 2004


Isaac Richards wrote:

>On Thursday 05 August 2004 11:58 pm, Kevin Kuphal wrote:
>  
>
>>This patch (much cleaner from my previous attempt at this) adds an
>>option to the Guide settings to automatically show the guide when
>>entering Live TV.
>>
>>For me this addresses the issue that if I'm going to watch live TV, I
>>need to know what is on first and since I cannot tune channels from the
>>Programing Guide used for scheduling, I find myself constantly entering
>>the guide after selecting Watch TV to find out what is on and select
>>something to watch.
>>    
>>
>
>Won't work if someone's changed their keybindings, though.
>  
>
Thanks for pointing this out.  Attached is updated patch that reads the 
keybindings and creates the appropriate event.

Kevin
-------------- next part --------------
Index: mythtv/libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.198
diff -n -u -r1.198 tv_play.cpp
--- mythtv/libs/libmythtv/tv_play.cpp	1 Aug 2004 16:17:30 -0000	1.198
+++ mythtv/libs/libmythtv/tv_play.cpp	6 Aug 2004 05:29:24 -0000
@@ -1027,6 +1027,28 @@
     paused = false;
     QKeyEvent *keypressed;
 
+    if (gContext->GetNumSetting("WatchTVGuide", 0))
+    {
+        QString thequery = QString("SELECT keylist FROM keybindings WHERE "
+                                   "context = \"TV Playback\" AND action = \"GUIDE\" AND "
+                                   "hostname = \"%1\";")
+                                  .arg(gContext->GetHostName());
+
+        QSqlQuery query = m_db->db()->exec(thequery);
+
+        if (query.isActive() && query.numRowsAffected() > 0)
+        {
+            query.next();
+
+            QKeySequence keyseq(query.value(0).toString());
+
+            int keynum = keyseq[0];
+            keynum &= ~Qt::UNICODE_ACCEL;
+   
+            keyList.prepend(new QKeyEvent(QEvent::KeyPress, keynum, 0, 0));
+        }
+    }
+
     stickykeys = gContext->GetNumSetting("StickyKeys");
     ff_rew_repos = gContext->GetNumSetting("FFRewRepos", 1);
     ff_rew_reverse = gContext->GetNumSetting("FFRewReverse", 1);
Index: mythtv/programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.181
diff -n -u -r1.181 globalsettings.cpp
--- mythtv/programs/mythfrontend/globalsettings.cpp	23 Jul 2004 17:08:50 -0000	1.181
+++ mythtv/programs/mythfrontend/globalsettings.cpp	6 Aug 2004 05:29:33 -0000
@@ -2383,6 +2383,17 @@
     };
 };
 
+class WatchTVGuide: public CheckBoxSetting, public GlobalSetting {
+public:
+    WatchTVGuide():
+        GlobalSetting("WatchTVGuide") {
+        setLabel(QObject::tr("Shows Program Guide when starting Live TV"));
+        setHelpText(QObject::tr("This starts the program guide immediately "
+             "upon starting to watch Live TV."));
+        setValue(false);
+    };
+};
+
 MainGeneralSettings::MainGeneralSettings()
 {
     AudioSettings *audio = new AudioSettings();
@@ -2551,6 +2562,7 @@
     epg->addChild(new EPGScrollType());
     epg->addChild(new EPGShowChannelIcon());
     epg->addChild(new EPGShowFavorites());
+    epg->addChild(new WatchTVGuide());
     epg->addChild(new EPGChanDisplay());
     epg->addChild(new EPGTimeDisplay());
     addChild(epg);


More information about the mythtv-dev mailing list