[Qgis-developer] Project files from old revision of QGIS

Magnus Homann magnus at homann.se
Tue Dec 25 13:57:43 EST 2007


Hello all,
There has not been any effort of reading QGIS project files from older 
revision and keeping the data from the old project. Until now. :-)

In the branch 'rev-up' I have started work in that direction. A system 
for detecting which version the project file was written in, a warning 
dialog and a framework for 'upgrading' project files are included.

https://svn.qgis.org/repos/qgis/branches/qgis_rev-up

The idea is that any developer that seomhow changes the stuff written 
into the project file, also must write a transformation function if 
applicable. He/She should at least make sure that missing information in 
the project file is handled by a reasonable default.

Three cases:
1) Completetly new funtionality is added to QGIS, and a reasonable 
default value exist. E.g: A new angular renderer storing the field for 
determining angle, can be handled by a reasonable default (off).

2) Some new funtionality is added to QGIS, and it is either dependant on 
older settings, and/or have many settings that are related. This can be 
handled by cleverly specifying defaults or by using a transform function.

3) Changes in storing functionality that has existed (from user 
perspective). E.g: The way SRS/Coorindatetransform are stored have 
chnaged. Transform of data from old project files SHOULD be written.

I have with the help of trial and error(s!) done some work in the areas 
I discovered; coordinate transforms and legend settings 
(visible/inOverview). I hope the developers who changed the way this is 
stored can take a look and see if I have missed something.

IMPORTANT: When you change format of project file, please write a 
transform. My examples should guide you, it's not very hard.

The transformation work in series, so we have one from 0.8.1 to 0.9.0 
and then from 0.9.0 to 0.9.1 and so on. Reading a 0.8.1 project from a 
0.9.2 QGIS will run (if needed) three transform functions.

The relevant file to edit is

.../src/core/qgsprojectfile.cpp

Questions? I can help you! I think this is important. :-)

-- 
Magnus Homann




More information about the Qgis-developer mailing list