Friday, January 13, 2012

Pitivi: Undo / Redo Functionality (GES Porting)

So, after spending some days "beating around the bush", trying to integrate myself to the project by following the team' s work, getting to understand the backbone of the project' s code, I get deep into my task, the undo/ redo functionality.

Firstly, I thought of checking about the undo/redo philosophy in applications in general, which helped me get what was implemented in Pitivi_0.15, undo/redo with a stack approach: (en gros) Having an undo stack where every action taken by the user is logged and saved, so every time he wants to return to the previous state, the undo stack is popped. For redo also, the current state is being saved into the redo stack, before an undo is being performed. So, if we regretted having "undone", the redo stack is popped and the new current state is pushed to the undo stack.

What helps me a lot in understanding the logic of the undo implementation in pitivi_0.15 is to check the code at this version while the undo is still working. Now, with the new restructurate version of the project though, the undo classes and code are grouped together under a specific /undo folder.

While Thiblahute was helping me to get started with my task, he already gave a patch which enables the undo/redo functionality in the MediaLibrary:;a=commit;h=418f71b3f7805270df760ec10cb5ed0a7027786e

(which had to do with the use of GstDiscovererInfo in the place of PitiviFactory, information that I have but I don't actually understand what it implies, so I should get more informed about it.....Hmm, if there will be things related to that that don' t allow undo to work now).

And now I am looking for the next step which will be the undo in the Timeline.

In order to work better, I am getting used to the debug system, setting breakpoints and even just printing.


  1. Maybe this discussion about undo stack can be helpfull for you: