Skip to content

Commit

Permalink
TV: Add a Stop action.
Browse files Browse the repository at this point in the history
Primarily driven by the need for a clean exit action for the http
interface.
  • Loading branch information
Mark Kendall committed May 4, 2011
1 parent e4c5909 commit bad5f2e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
23 changes: 12 additions & 11 deletions mythtv/libs/libmythtv/tv_actions.h
@@ -1,18 +1,19 @@
#ifndef TV_ACTIONS_H
#define TV_ACTIONS_H

#define ACTION_PLAYBACK "PLAYBACK"
#define ACTION_DAYLEFT "DAYLEFT"
#define ACTION_DAYRIGHT "DAYRIGHT"
#define ACTION_PAGELEFT "PAGELEFT"
#define ACTION_PAGERIGHT "PAGERIGHT"
#define ACTION_PLAYBACK "PLAYBACK"
#define ACTION_STOP "STOPPLAYBACK"
#define ACTION_DAYLEFT "DAYLEFT"
#define ACTION_DAYRIGHT "DAYRIGHT"
#define ACTION_PAGELEFT "PAGELEFT"
#define ACTION_PAGERIGHT "PAGERIGHT"
#define ACTION_TOGGLEPGORDER "TOGGLEEPGORDER"
#define ACTION_CLEAROSD "CLEAROSD"
#define ACTION_PAUSE "PAUSE"
#define ACTION_CHANNELUP "CHANNELUP"
#define ACTION_CHANNELDOWN "CHANNELDOWN"
#define ACTION_SEEKRWND "SEEKRWND"
#define ACTION_SEEKFFWD "SEEKFFWD"
#define ACTION_CLEAROSD "CLEAROSD"
#define ACTION_PAUSE "PAUSE"
#define ACTION_CHANNELUP "CHANNELUP"
#define ACTION_CHANNELDOWN "CHANNELDOWN"
#define ACTION_SEEKRWND "SEEKRWND"
#define ACTION_SEEKFFWD "SEEKFFWD"

#define ACTION_TOGGLESTUDIOLEVELS "TOGGLESTUDIOLEVELS"
#define ACTION_TOGGLEUPMIX "TOGGLEUPMIX"
Expand Down
25 changes: 16 additions & 9 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -431,6 +431,8 @@ void TV::InitKeys(void)
{
REG_KEY("TV Frontend", ACTION_PLAYBACK, QT_TRANSLATE_NOOP("MythControls",
"Play Program"), "P");
REG_KEY("TV Frontend", ACTION_STOP, QT_TRANSLATE_NOOP("MythControls",
"Stop Program"), "");
REG_KEY("TV Frontend", ACTION_TOGGLERECORD, QT_TRANSLATE_NOOP("MythControls",
"Toggle recording status of current program"), "R");
REG_KEY("TV Frontend", ACTION_DAYLEFT, QT_TRANSLATE_NOOP("MythControls",
Expand Down Expand Up @@ -3850,6 +3852,11 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
}
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
}
else if (has_action(ACTION_STOP, actions))
{
PrepareToExitPlayer(ctx, __LINE__, false);
SetExitPlayer(true, true);
}
else if (has_action(ACTION_EXITSHOWNOPROMPTS, actions))
{
requestDelete = false;
Expand Down Expand Up @@ -9399,6 +9406,11 @@ void TV::OSDDialogEvent(int result, QString text, QString action)
; // exit dialog
else if (HandleTrackAction(actx, action))
;
else if (action == ACTION_STOP)
{
PrepareToExitPlayer(actx, __LINE__, false);
SetExitPlayer(true, true);
}
else if (action.startsWith("DEINTERLACER"))
HandleDeinterlacer(actx, action);
else if (action == "TOGGLEMANUALZOOM")
Expand Down Expand Up @@ -11326,11 +11338,11 @@ void TV::ShowOSDStopWatchingRecording(PlayerContext *ctx)
osd->DialogAddButton(tr("Save this position and go to the menu"),
"DIALOG_VIDEOEXIT_SAVEPOSITIONANDEXIT_0");
osd->DialogAddButton(tr("Do not save, just exit to the menu"),
"DIALOG_VIDEOEXIT_JUSTEXIT_0");
ACTION_STOP);
}
else
osd->DialogAddButton(tr("Exit %1").arg(videotype),
"DIALOG_VIDEOEXIT_JUSTEXIT_0");
ACTION_STOP);

if (IsDeleteAllowed(ctx))
osd->DialogAddButton(tr("Delete this recording"),
Expand Down Expand Up @@ -11439,7 +11451,7 @@ void TV::ShowOSDPromptDeleteRecording(PlayerContext *ctx, QString title,
osd->DialogAddButton(tr("Delete it"),
"DIALOG_VIDEOEXIT_JUSTDELETE_0");
osd->DialogAddButton(tr("Save it so I can watch it again"),
"DIALOG_VIDEOEXIT_JUSTEXIT_0", false, true);
ACTION_STOP, false, true);
}
else
{
Expand All @@ -11448,7 +11460,7 @@ void TV::ShowOSDPromptDeleteRecording(PlayerContext *ctx, QString title,
osd->DialogAddButton(tr("Yes, delete it"),
"DIALOG_VIDEOEXIT_JUSTDELETE_0");
osd->DialogAddButton(tr("No, keep it, I changed my mind"),
"DIALOG_VIDEOEXIT_JUSTEXIT_0", false, true);
ACTION_STOP, false, true);
if (!paused)
osd->DialogBack("", "DIALOG_PLAY_0_0", true);
}
Expand Down Expand Up @@ -11500,11 +11512,6 @@ bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
{
DoTogglePause(ctx, true);
}
else/* (action == "JUSTEXIT")*/
{
PrepareToExitPlayer(ctx, __LINE__, false);
SetExitPlayer(true, true);
}

return hide;
}
Expand Down

0 comments on commit bad5f2e

Please sign in to comment.