[Kdenlive-devel] [RFC] m_doIt member variable in QUndoCommand subclasses

jb jb at kdenlive.org
Sat Apr 4 22:45:56 UTC 2009


On Saturday 04 April 2009 19:25:00 Ray Lehtiniemi wrote:
>
>  a - the m_doIt variable serves an obvious purpose
>  b - the m_doIt variable serves no purpose whatsoever
>  c - the m_doIt variable seems useless, but actually appears to
>      be working around some kind of bug elsewhere in the system
>
>
> does anybody have a problem with me killing the m_doIt variable for all
> type b commands?  can anyone explain the purpose of m_doIt in the type c
> commands?

Killing the type b commands is ok, the m_doIt variable is always set to true 
when used.

In the type c commands, the m_doIt variable is used to skip the first redo of 
the command. For example, when resizing a clip:

Let's say we have a clip that starts at 5 seconds and we resize it to start at 
10 seconds. The resize operation has 2 parts: 

1) resize the clip in the GUI (the ClipItem)
2) resize the clip in the MLT playlist (in renderer.cpp)

When the user resizes the clip in Timeline, only resize operation 2) must be 
performed, because operation 1) was performed directly in the QGraphicsView by 
the user. So we perform operation 2) (the MLT resize, see customtrackview.cpp 
line 2379), then create the resizeclipcommand with m_doIt = false.

The aim of m_doIt is that when setting it to false, the first occurence (the 
redo) of the function when it is pushed on the QUndoStack is not executed.

But when undoing and redoing, it is executed.

Hope it is understandable... the logic was copied from the previous version of 
Kdenlive, maybe there is a better way to manage that... 

regards
jb






More information about the Kdenlive mailing list