Ticket #6029: alternate-player.3.patch

File alternate-player.3.patch, 5.4 KB (added by Mark Spieth, 15 years ago)

missing interface corrected

Line 
1Index: mythvideo/mythvideo/videodlg.h
2===================================================================
3--- mythvideo/mythvideo/videodlg.h      (revision 19467)
4+++ mythvideo/mythvideo/videodlg.h      (working copy)
5@@ -57,6 +57,7 @@
6     void SetCurrentNode(MythGenericTree *);
7 
8     void playVideo();
9+    void playVideoAlt();
10     void playVideoWithTrailers();
11     void playTrailer();
12 
13@@ -188,6 +189,7 @@
14     MythUIStateType  *m_userRatingState;
15 
16     class VideoDialogPrivate *m_d;
17+    bool hasAltPlayer;
18 };
19 
20 class VideoListDeathDelay : public QObject
21Index: mythvideo/mythvideo/globalsettings.cpp
22===================================================================
23--- mythvideo/mythvideo/globalsettings.cpp      (revision 19467)
24+++ mythvideo/mythvideo/globalsettings.cpp      (working copy)
25@@ -272,6 +272,18 @@
26     return gc;
27 }
28 
29+HostLineEdit *VideoAlternatePlayer()
30+{
31+    HostLineEdit *gc = new HostLineEdit("VideoAlternatePlayer");
32+    gc->setLabel(QObject::tr("Alternate Player"));
33+    gc->setValue("");
34+    gc->setHelpText(QObject::tr("If, for some reason, the default player "
35+                    "doesn't play a video, you can play it in the alternate "
36+                    "player by hitting the INFO button and selecting 'Watch "
37+                    "In Alternate Player'"));
38+    return gc;
39+};
40+
41 ///////////////////////////////////////////////////////////
42 //// DVD Settings
43 ///////////////////////////////////////////////////////////
44@@ -752,6 +764,7 @@
45     videoplayersettings->setLabel(QObject::tr("Player Settings"));
46     videoplayersettings->addChild(VideoDefaultPlayer());
47     videoplayersettings->addChild(PlayerCommand());
48+    videoplayersettings->addChild(VideoAlternatePlayer());
49     videoplayersettings->addChild(VCDPlayerCommand());
50     addChild(videoplayersettings);
51 }
52Index: mythvideo/mythvideo/videodlg.cpp
53===================================================================
54--- mythvideo/mythvideo/videodlg.cpp    (revision 19467)
55+++ mythvideo/mythvideo/videodlg.cpp    (working copy)
56@@ -701,7 +701,7 @@
57     }
58 
59     void PlayVideo(const QString &filename,
60-            const MetadataListManager &video_list)
61+            const MetadataListManager &video_list, bool wantsAltPlayer = false)
62     {
63         const int WATCHED_WATERMARK = 10000; // Less than this and the chain of
64                                              // videos will not be followed when
65@@ -717,7 +717,10 @@
66         {
67             playing_time.start();
68 
69-            VideoPlayerCommand::PlayerFor(item.get()).Play();
70+            if (wantsAltPlayer)
71+                VideoPlayerCommand::AltPlayerFor(item.get()).Play();
72+            else
73+                VideoPlayerCommand::PlayerFor(item.get()).Play();
74 
75             if (item->ChildID() > 0)
76                 item = video_list.byID(item->ChildID());
77@@ -929,6 +932,8 @@
78 
79     m_popupStack = GetMythMainWindow()->GetStack("popup stack");
80 
81+    hasAltPlayer = gContext->GetSetting("VideoAlternatePlayer") != "";
82+
83     m_d->m_videoList->setCurrentVideoFilter(VideoFilterSettings(true,
84                     lname));
85 
86@@ -1502,6 +1507,8 @@
87     if (node && node->getInt() >= 0)
88     {
89         m_menuPopup->AddButton(tr("Watch This Video"), SLOT(playVideo()));
90+        if (hasAltPlayer)
91+            m_menuPopup->AddButton(tr("Watch This Video In Alternate Player"), SLOT(playVideoAlt()));
92 
93         if (gContext->GetNumSetting("mythvideo.TrailersRandomEnabled", 0))
94         {
95@@ -1809,6 +1816,19 @@
96     VideoPlayerCommand::PlayerFor(metadata->GetTrailer()).Play();
97 }
98 
99+void VideoDialog::playVideoAlt()
100+{
101+    Metadata *metadata = GetMetadata(GetItemCurrent());
102+
103+    if (metadata)
104+        PlayVideo(metadata->Filename(), m_d->m_videoList->getListCache(), true);
105+
106+}
107+
108 void VideoDialog::setParentalLevel(const ParentalLevel::Level &level)
109 {
110     m_d->m_parentalLevel.SetLevel(level);
111Index: mythvideo/mythvideo/playercommand.h
112===================================================================
113--- mythvideo/mythvideo/playercommand.h (revision 19467)
114+++ mythvideo/mythvideo/playercommand.h (working copy)
115@@ -4,6 +4,7 @@
116 class VideoPlayerCommand
117 {
118   public:
119+    static VideoPlayerCommand AltPlayerFor(const class Metadata *item);
120     static VideoPlayerCommand PlayerFor(const class Metadata *item);
121     static VideoPlayerCommand PlayerFor(const QString &filename);
122 
123Index: mythvideo/mythvideo/playercommand.cpp
124===================================================================
125--- mythvideo/mythvideo/playercommand.cpp       (revision 19467)
126+++ mythvideo/mythvideo/playercommand.cpp       (working copy)
127@@ -176,6 +176,21 @@
128         ClearPlayerList();
129     }
130 
131+    void AltPlayerFor(const Metadata *item)
132+    {
133+        QString play_command = gContext->GetSetting("VideoAlternatePlayer");
134+        if (play_command.trimmed().isEmpty())
135+        {
136+            PlayerFor(item);
137+        }
138+        else
139+        {
140+            AddPlayer(play_command, item->Filename(), item->Plot(),
141+                    item->Title(), item->Director(), item->Length(),
142+                    QString::number(item->Year()));
143+        }
144+    }
145+
146     void PlayerFor(const Metadata *item)
147     {
148         if (item)
149@@ -263,6 +278,13 @@
150 
151 ////////////////////////////////////////////////////////////////////////
152 
153+VideoPlayerCommand VideoPlayerCommand::AltPlayerFor(const Metadata *item)
154+{
155+    VideoPlayerCommand ret;
156+    ret.m_d->AltPlayerFor(item);
157+    return ret;
158+}
159+
160 VideoPlayerCommand VideoPlayerCommand::PlayerFor(const Metadata *item)
161 {
162     VideoPlayerCommand ret;