Skip to content

Commit

Permalink
Simplify the set-bookmark-at-playback-exit logic. Refs #7994
Browse files Browse the repository at this point in the history
  • Loading branch information
stichnot committed Apr 12, 2012
1 parent 0ba379a commit 6d2dce1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
20 changes: 11 additions & 9 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -3188,9 +3188,12 @@ void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx,
SetExitPlayer(true, true);
}

void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark)
void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark)
{
bool bookmark_it = bookmark && IsBookmarkAllowed(ctx);
bool bm_basic =
(bookmark == kBookmarkAlways ||
(bookmark == kBookmarkAuto && db_playback_exit_prompt == 2));
bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx);
ctx->LockDeletePlayer(__FILE__, line);
if (ctx->player)
{
Expand Down Expand Up @@ -3264,7 +3267,7 @@ void TV::HandleEndOfPlaybackTimerEvent(void)
if (mctx == ctx)
{
endOfRecording = true;
PrepareToExitPlayer(mctx, __LINE__, false);
PrepareToExitPlayer(mctx, __LINE__);
SetExitPlayer(true, true);
}
}
Expand Down Expand Up @@ -4216,7 +4219,7 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
}
else if (has_action(ACTION_STOP, actions))
{
PrepareToExitPlayer(ctx, __LINE__, false);
PrepareToExitPlayer(ctx, __LINE__);
SetExitPlayer(true, true);
}
else if (has_action(ACTION_EXITSHOWNOPROMPTS, actions))
Expand Down Expand Up @@ -4272,7 +4275,7 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
ShowOSDStopWatchingRecording(ctx);
return handled;
}
PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2);
PrepareToExitPlayer(ctx, __LINE__);
requestDelete = false;
do_exit = true;
}
Expand Down Expand Up @@ -8915,8 +8918,7 @@ void TV::customEvent(QEvent *e)
for (uint i = 0; mctx && (i < player.size()); i++)
{
PlayerContext *ctx = GetPlayer(mctx, i);
PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 ||
db_playback_exit_prompt == 2);
PrepareToExitPlayer(ctx, __LINE__);
}

SetExitPlayer(true, true);
Expand Down Expand Up @@ -10068,7 +10070,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action)
DoTogglePause(actx, true);
else if (action == ACTION_STOP)
{
PrepareToExitPlayer(actx, __LINE__, false);
PrepareToExitPlayer(actx, __LINE__);
SetExitPlayer(true, true);
}
else if (action == ACTION_JUMPFFWD)
Expand Down Expand Up @@ -12319,7 +12321,7 @@ bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
}
else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok)
{
PrepareToExitPlayer(ctx, __LINE__);
PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways);
SetExitPlayer(true, true);
}
else if (action == "KEEPWATCHING" && !near_end)
Expand Down
7 changes: 6 additions & 1 deletion mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -312,8 +312,13 @@ class MTV_PUBLIC TV : public QObject
void setUnderNetworkControl(bool setting) { underNetworkControl = setting; }
void PrepToSwitchToRecordedProgram(PlayerContext*,
const ProgramInfo &);
enum BookmarkAction {
kBookmarkAlways,
kBookmarkNever,
kBookmarkAuto // set iff db_playback_exit_prompt==2
};
void PrepareToExitPlayer(PlayerContext*, int line,
bool bookmark = true);
BookmarkAction bookmark = kBookmarkAuto);
void SetExitPlayer(bool set_it, bool wants_to);

bool RequestNextRecorder(PlayerContext *, bool);
Expand Down

0 comments on commit 6d2dce1

Please sign in to comment.