Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/MP1-4194-BUG-Stop_Timesh…
Browse files Browse the repository at this point in the history
…ifting_dialog_shows_up_with_option_disabled_when_Info_screen_is_open'
  • Loading branch information
Sebastiii committed Sep 13, 2013
2 parents f825687 + 018e5ce commit f215b9f
Showing 1 changed file with 40 additions and 20 deletions.
60 changes: 40 additions & 20 deletions TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f215b9f

Please sign in to comment.