Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 338f52ca authored by Nicolas Carion's avatar Nicolas Carion

[Timeline2][Model] Make undoing logging optional

parent 7a18aed3
......@@ -322,7 +322,7 @@ bool TimelineModel::requestClipMove(int cid, int tid, int position, Fun &undo, F
return operation();
}
bool TimelineModel::requestClipMove(int cid, int tid, int position)
bool TimelineModel::requestClipMove(int cid, int tid, int position, bool logUndo)
{
Q_ASSERT(m_allClips.count(cid) > 0);
if (m_groups->getRootId(cid) != cid) {
......@@ -332,16 +332,17 @@ bool TimelineModel::requestClipMove(int cid, int tid, int position)
int delta_pos = position - m_allClips[cid]->getPosition();
return requestGroupMove(gid, delta_track, delta_pos);
}
qDebug()<<"clip move in model"<<cid<<tid<<position;
std::function<bool (void)> undo = [](){return true;};
std::function<bool (void)> redo = [](){return true;};
bool res = requestClipMove(cid, tid, position, undo, redo);
if (res) {
if (res && logUndo) {
PUSH_UNDO(undo, redo, i18n("Move clip"));
}
return res;
}
bool TimelineModel::requestGroupMove(int gid, int delta_track, int delta_pos)
bool TimelineModel::requestGroupMove(int gid, int delta_track, int delta_pos, bool logUndo)
{
std::function<bool (void)> undo = [](){return true;};
std::function<bool (void)> redo = [](){return true;};
......@@ -372,7 +373,9 @@ bool TimelineModel::requestGroupMove(int gid, int delta_track, int delta_pos)
return false;
}
}
PUSH_UNDO(undo, redo, i18n("Move group"));
if (logUndo) {
PUSH_UNDO(undo, redo, i18n("Move group"));
}
return true;
}
......
......@@ -146,8 +146,9 @@ public:
@param cid is the ID of the clip
@param tid is the ID of the target track
@param position is the position where we want to move
@param logUndo if set to true, an undo object is created
*/
bool requestClipMove(int cid, int tid, int position);
bool requestClipMove(int cid, int tid, int position, bool logUndo = true);
protected:
/* Same function, but accumulates undo and redo, and doesn't check for group*/
bool requestClipMove(int cid, int tid, int position, Fun &undo, Fun &redo);
......@@ -158,8 +159,9 @@ public:
If the clips in the group are not in inserted in a track yet, they get inserted for the first time.
@param delta_track is the delta applied to the track index
@param tid is the requested position change
@param logUndo if set to true, an undo object is created
*/
bool requestGroupMove(int gid, int delta_track, int delta_pos);
bool requestGroupMove(int gid, int delta_track, int delta_pos, bool logUndo = true);
/* @brief Change the duration of a clip
Returns true on success. If it fails, nothing is modified.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment