Ticket #8045: videomenu_display_patch

File videomenu_display_patch, 2.2 KB (added by John Harvey <john.p.harvey@…>, 14 years ago)
Line 
1Index: mythtv/libs/libmythui/mythmainwindow.cpp
2===================================================================
3--- mythtv/libs/libmythui/mythmainwindow.cpp    (revision 23523)
4+++ mythtv/libs/libmythui/mythmainwindow.cpp    (working copy)
5@@ -1134,7 +1134,7 @@
6             d->exitmenucallback = NULL;
7             callback();
8         }
9-        else if (d->exitmenumediadevicecallback)
10+        if (d->exitmenumediadevicecallback)
11         {
12             void (*callback)(MythMediaDevice*) = d->exitmenumediadevicecallback;
13             MythMediaDevice * mediadevice = d->mediadeviceforcallback;
14@@ -1450,6 +1450,19 @@
15     }
16 }
17 
18+void MythMainWindow::CallMediaDeviceOnJumpTo(const QString &destination, void (*fn)(MythMediaDevice* mediadevice), MythMediaDevice *device)
19+{
20+    if (DestinationExists(destination))
21+    {
22+        d->exitmenumediadevicecallback = fn;
23+       d->mediadeviceforcallback = device;
24+       JumpTo(destination);
25+    }  else
26+    {
27+        fn(device);
28+    }
29+}
30+
31 bool MythMainWindow::DestinationExists(const QString& destination) const
32 {
33     return (d->destinationMap.count(destination) > 0) ? true : false;
34Index: mythtv/libs/libmythui/mythmainwindow.h
35===================================================================
36--- mythtv/libs/libmythui/mythmainwindow.h      (revision 23523)
37+++ mythtv/libs/libmythui/mythmainwindow.h      (working copy)
38@@ -73,7 +73,9 @@
39 
40     void JumpTo(const QString &destination, bool pop = true);
41     bool DestinationExists(const QString &destination) const;
42-
43+    void CallMediaDeviceOnJumpTo(const QString &destination,
44+                                void (*fn)(MythMediaDevice* mediadevice) ,
45+                                MythMediaDevice *);
46     bool IsExitingToMain(void) const;
47 
48     static MythMainWindow *getMainWindow(const bool useDB = true);
49Index: mythtv/libs/libmyth/mythmediamonitor.cpp
50===================================================================
51--- mythtv/libs/libmyth/mythmediamonitor.cpp    (revision 23523)
52+++ mythtv/libs/libmyth/mythmediamonitor.cpp    (working copy)
53@@ -650,8 +650,7 @@
54     int selected = 0;
55 
56 
57-    GetMythMainWindow()->JumpTo("Main Menu");
58-    handlers.at(selected).callback(pMedia);
59+    GetMythMainWindow()->CallMediaDeviceOnJumpTo("Main Menu",handlers.at(selected).callback, pMedia);
60 }
61 
62 // Signal handler.