[Kdenlive-devel] review patch: document loading and validation

Alberto Villa villa.alberto at gmail.com
Tue Jun 9 23:44:42 UTC 2009


hi list!

jb, i've started writing the long time awaited (at least by mads and me :) 
validation function, but i ended up rewriting a bit of the document loading 
and conversion parts
i'd be happy to commit this attached patch, but since the changes are not 
that little, i'd like you (and mads, maybe) to review it (it's a recursive 
patch, kompare suggested or you'll get crazy)

among small fixes, here's what i changed

kdenlivedoc.cpp:
- when loading a document, check immediately if it fails, so that errors are 
now easier to handle. also, share the new document creation part (when 
failing or when creating a new project)
- instead of just converting the document to the newest version, validate it

documentconvert.cpp -> documentvalidator.cpp:
- doConvert()/upgrade() is now called in validate(), which upgrades the file 
to the newest version and checks if everything is all right (and fixes things 
when needed and possible). it's just started (the patch was growing too 
much), but it should be able to guarantee that a quite easy but corrupted 
project (a user on irc had this problem last week) will be loaded. at the 
moment it checks the elements created with an empty project (eg. manually 
deleting all the tracks from the file used to HARD-FREEZE my system, now 
they're created when missing - without attributes yet, i'll add them, as 
commented out in the source), but it will be able to check cross references 
and more
- the upgrade() function now works with incremental changes, so updating the 
project file version requires only adding an "if" at the end of the function: 
no code duplication, no way to break old things (the idea is that the old code 
should stay untouched)

the tests i've made (with random/old/corrupted documents) showed no 
regression, some little things are better, and, as said, one hard freeze 
already disappeared. if you like the patch i'll commit it, and will go on with 
the validation tool making it serious

regards
-- 
Alberto Villa <villa.alberto at gmail.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: document_loading_and_validation-svn3507.diff.zip
Type: application/zip
Size: 19235 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdenlive/attachments/20090610/e15ca4ee/attachment.zip>


More information about the Kdenlive mailing list