diff --git a/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs b/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs index 0a9fe50cbc4..399721001b0 100644 --- a/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs +++ b/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs @@ -137,6 +137,7 @@ private enum Controls private Program previousProgram = null; private bool _immediateSeekIsRelative = true; private int _immediateSeekValue = 10; + private bool _confirmTimeshiftStop = true; private IList listTvChannels; @@ -156,6 +157,7 @@ public override bool Init() { _immediateSeekIsRelative = xmlreader.GetValueAsBool("movieplayer", "immediateskipstepsisrelative", true); _immediateSeekValue = xmlreader.GetValueAsInt("movieplayer", "immediateskipstepsize", 10); + _confirmTimeshiftStop = xmlreader.GetValueAsBool("mytv", "confirmTimeshiftStop", true); } bool bResult = Load(GUIGraphicsContext.GetThemedSkinFile(@"\tvOSD.xml")); return bResult; @@ -288,29 +290,15 @@ public override void OnAction(Action action) case Action.ActionType.ACTION_STOP: { - if (g_Player.IsTimeShifting) + if (g_Player.IsTVRecording) { - Log.Debug("TvOSD: user request to stop"); - GUIDialogPlayStop dlgPlayStop = - (GUIDialogPlayStop)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PLAY_STOP); - if (dlgPlayStop != null) - { - dlgPlayStop.SetHeading(GUILocalizeStrings.Get(605)); - dlgPlayStop.SetLine(1, GUILocalizeStrings.Get(2550)); - dlgPlayStop.SetLine(2, GUILocalizeStrings.Get(2551)); - dlgPlayStop.SetDefaultToStop(false); - dlgPlayStop.DoModal(GetID); - if (dlgPlayStop.IsStopConfirmed) - { - Log.Debug("TvOSD: stop confirmed"); - g_Player.Stop(); - } - } + Log.Debug("TvOSD: stop from recorded TV"); + g_Player.Stop(); } - if (g_Player.IsTVRecording) + if (g_Player.IsTimeShifting && CanStopTimeshifting()) { - Log.Debug("TvOSD: stop from recorded TV"); - g_Player.Stop(); + Log.Debug("TvOSD: stop confirmed"); + g_Player.Stop(); } GUIWindowManager.IsPauseOsdVisible = false; return; @@ -384,6 +372,38 @@ public override void OnAction(Action action) base.OnAction(action); } + private bool CanStopTimeshifting() + { + if (!_confirmTimeshiftStop) + { + // Can always stop timeshift when confirmation is not required + return true; + } + + // Get dialog to ask the user for confirmation + Log.Debug("TvOSD: user request to stop"); + GUIDialogPlayStop dlgPlayStop = + (GUIDialogPlayStop)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PLAY_STOP); + if (dlgPlayStop == null) + { + // Return true to avoid dead end on missing dialog + return true; + } + + dlgPlayStop.SetHeading(GUILocalizeStrings.Get(605)); + dlgPlayStop.SetLine(1, GUILocalizeStrings.Get(2550)); + dlgPlayStop.SetLine(2, GUILocalizeStrings.Get(2551)); + dlgPlayStop.SetDefaultToStop(false); + dlgPlayStop.DoModal(GetID); + if (dlgPlayStop.IsStopConfirmed) + { + Log.Debug("TvOSD: stop confirmed"); + return true; + } + + return false; + } + public override bool OnMessage(GUIMessage message) { switch (message.Message)