Skip to content

Commit

Permalink
Exit cutlist edit mode cleanly when executing a jump point.
Browse files Browse the repository at this point in the history
When the user executes a jump point in the middle of an editing
session, make sure the edit session closes cleanly.  The work is not
explicitly saved, but the auto-save state is retained in the database
so that it will be auto-loaded next time the user edits that program.

This makes a slight modification to the MythPlayer class and therefore
the binary version is bumped, so be sure to do everything that
entails.

Refs #7939.
  • Loading branch information
stichnot committed Feb 25, 2012
1 parent c2a0b85 commit 9b5b7b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20120223-1"
#define MYTH_BINARY_VERSION "0.25.20120224-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
18 changes: 13 additions & 5 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -3764,17 +3764,25 @@ bool MythPlayer::EnableEdit(void)
return deleteMap.IsEditing();
}

void MythPlayer::DisableEdit(bool save)
/** \fn MythPlayer::DisableEdit(int)
* \brief Leave cutlist edit mode, saving work in 1 of 3 ways.
*
* \param howToSave If 1, save all changes. If 0, discard all
* changes. If -1, do not explicitly save changes but leave
* auto-save information intact in the database.
*/
void MythPlayer::DisableEdit(int howToSave)
{
QMutexLocker locker(&osdLock);
if (!osd)
return;

deleteMap.SetEditing(false, osd);
if (!save)
if (howToSave == 0)
deleteMap.LoadMap(totalFrames);
// Unconditionally save to remove temporary marks from the DB.
deleteMap.SaveMap(totalFrames);
if (howToSave >= 0)
deleteMap.SaveMap(totalFrames);
deleteMap.TrackerReset(framesPlayed, totalFrames);
deleteMap.SetFileEditing(false);
player_ctx->LockPlayingInfo(__FILE__, __LINE__);
Expand Down Expand Up @@ -3880,7 +3888,7 @@ bool MythPlayer::HandleProgramEditorActions(QStringList &actions,
}
else if (action == "REVERTEXIT")
{
DisableEdit(false);
DisableEdit(0);
refresh = false;
}
else if (action == ACTION_SAVEMAP)
Expand All @@ -3890,7 +3898,7 @@ bool MythPlayer::HandleProgramEditorActions(QStringList &actions,
}
else if (action == "EDIT" || action == "SAVEEXIT")
{
DisableEdit();
DisableEdit(1);
refresh = false;
}
else
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -442,7 +442,7 @@ class MTV_PUBLIC MythPlayer
bool EnableEdit(void);
bool HandleProgramEditorActions(QStringList &actions, long long frame = -1);
bool GetEditMode(void) { return deleteMap.IsEditing(); }
void DisableEdit(bool save = true);
void DisableEdit(int howToSave);
bool IsInDelete(uint64_t frame);
uint64_t GetNearestMark(uint64_t frame, bool right);
bool IsTemporaryMark(uint64_t frame);
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -3691,7 +3691,7 @@ bool TV::ProcessKeypress(PlayerContext *actx, QKeyEvent *e)
{
actx->LockDeletePlayer(__FILE__, __LINE__);
if (actx->player)
actx->player->DisableEdit(false);
actx->player->DisableEdit(0);
actx->UnlockDeletePlayer(__FILE__, __LINE__);
}
handled = true;
Expand Down Expand Up @@ -8808,6 +8808,7 @@ void TV::customEvent(QEvent *e)
}

SetExitPlayer(true, true);
mctx->player->DisableEdit(-1);
ReturnPlayerLock(mctx);
}

Expand Down

0 comments on commit 9b5b7b5

Please sign in to comment.