All pastes #571557 Raw Edit

MythMainWindow::TranslateKeypres

public text v1 · immutable
·published 2007-06-17 05:57 UTC
rendered paste body
Index: mythtv/libs/libmythtv/tv_play.cpp
===================================================================
--- mythtv/libs/libmythtv/tv_play.cpp	(revision 13626)
+++ mythtv/libs/libmythtv/tv_play.cpp	(working copy)
@@ -2186,7 +2186,7 @@
     if (ignoreKeys)
     {
         if (!gContext->GetMainWindow()->TranslateKeyPress(
-                "TV Playback", e, actions))
+                "TV Playback", e, actions, true, QStringList() << "Program Guide"))
         {
             return;
         }
@@ -2264,7 +2264,7 @@
     }
 
     if (!gContext->GetMainWindow()->TranslateKeyPress(
-            "TV Playback", e, actions))
+            "TV Playback", e, actions, true, QStringList() << "Program Guide"))
     {
         return;
     }
Index: mythtv/libs/libmythui/mythmainwindow.cpp
===================================================================
--- mythtv/libs/libmythui/mythmainwindow.cpp	(revision 13626)
+++ mythtv/libs/libmythui/mythmainwindow.cpp	(working copy)
@@ -718,13 +718,28 @@
 
 bool MythMainWindow::TranslateKeyPress(const QString &context,
                                        QKeyEvent *e, QStringList &actions,
-                                       bool allowJumps)
+                                       bool allowJumps,
+                                       const QStringList &excludedJumpDestinations)
 {
     actions.clear();
     int keynum = d->TranslateKeyNum(e);
+    QString destination = "";
+    
+    // Create iterator to retrieve jump destination
+    QMap<int, JumpData*>::Iterator it;
+    it = d->jumpMap.find(keynum);
 
+    // Retrieve jump destination
+    if ( it != d->jumpMap.end())
+    {
+        JumpData *jd = it.data();
+        destination = jd->destination; 
+    }
+
     if (allowJumps && 
-        d->jumpMap.count(keynum) > 0 && d->exitmenucallback == NULL)
+        d->jumpMap.count(keynum) > 0 &&
+        d->exitmenucallback == NULL &&
+        excludedJumpDestinations.contains(destination) == 0)
     {
         d->exitingtomain = true;
         d->exitmenucallback = d->jumpMap[keynum]->callback;
@@ -893,7 +908,6 @@
     }
 }
 
-
 void MythMainWindow::BindJump(const QString &destination, const QString &key)
 {
     /* make sure the jump point exists */
Index: mythtv/libs/libmythui/mythmainwindow.h
===================================================================
--- mythtv/libs/libmythui/mythmainwindow.h	(revision 13626)
+++ mythtv/libs/libmythui/mythmainwindow.h	(working copy)
@@ -62,7 +62,8 @@
     MythScreenStack *GetMainStack();
 
     bool TranslateKeyPress(const QString &context, QKeyEvent *e, 
-                           QStringList &actions, bool allowJumps = true);
+                           QStringList &actions, bool allowJumps = true,
+                           const QStringList &excludedJumpDestinations = QStringList());
 
     void ClearKey(const QString &context, const QString &action);
     void BindKey(const QString &context, const QString &action,