Permalink
Browse files

Exit cutlist edit mode cleanly when executing a jump point.

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...
1 parent c2a0b85 commit 9b5b7b514408f8b25052ee1c0bebc05e676efc1d @stichnot stichnot committed Feb 25, 2012
@@ -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.
*
@@ -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__);
@@ -3880,7 +3888,7 @@ bool MythPlayer::HandleProgramEditorActions(QStringList &actions,
}
else if (action == "REVERTEXIT")
{
- DisableEdit(false);
+ DisableEdit(0);
refresh = false;
}
else if (action == ACTION_SAVEMAP)
@@ -3890,7 +3898,7 @@ bool MythPlayer::HandleProgramEditorActions(QStringList &actions,
}
else if (action == "EDIT" || action == "SAVEEXIT")
{
- DisableEdit();
+ DisableEdit(1);
refresh = false;
}
else
@@ -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);
@@ -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;
@@ -8808,6 +8808,7 @@ void TV::customEvent(QEvent *e)
}
SetExitPlayer(true, true);
+ mctx->player->DisableEdit(-1);
ReturnPlayerLock(mctx);
}

0 comments on commit 9b5b7b5

Please sign in to comment.