comparison m-toolbox/classes/@LTPDAprefs/upgradeFromPlist.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % UPGRADEFROMPLIST upgrades the old preference strucure to the new structure.
2 %
3 % Call: prefs = LTPDAprefs.upgradeFromPlist(prefs, pl)
4 %
5 % Parameters:
6 % prefs - preferences object with the new structure
7 % pl - a PLIST with the old preferences object. The old
8 % preferences object must have the key 'LTPDAPREFERENCES'
9 %
10 % Version:
11 % $Id: upgradeFromPlist.m,v 1.1 2010/11/30 17:37:13 ingo Exp $
12 %
13
14 function prefs = upgradeFromPlist(prefs, pl)
15
16 oldprefs = pl.find('LTPDAPREFERENCES');
17
18 disp('*** upgrading preferences ...');
19
20 % update display settings
21 prefs.getDisplayPrefs.setDisplayVerboseLevel(java.lang.Integer(oldprefs.display.verboseLevel));
22 prefs.getDisplayPrefs.setDisplayWrapStrings(java.lang.Integer(oldprefs.display.wrapstrings));
23 prefs.getDisplayPrefs.setDisplayWrapLegendStrings(java.lang.Integer(oldprefs.display.wraplegendstring));
24
25 % update models
26 for kk=1:numel(oldprefs.models.paths)
27 path = oldprefs.models.paths{kk};
28 prefs.getModelsPrefs.addSearchPath(path);
29 end
30
31 % update time prefs
32 prefs.getTimePrefs.setTimeTimezone(oldprefs.time.timezone);
33 prefs.getTimePrefs.setTimestringFormat(oldprefs.time.format);
34
35 % update repository prefs
36 for kk=1:numel(oldprefs.repository.servers)
37 server = oldprefs.repository.servers{kk};
38 prefs.getRepoPrefs.addHostname(server);
39 end
40 prefs.getRepoPrefs.setExpiry(java.lang.Integer(oldprefs.repository.loginExpiry));
41
42 % update external prefs
43 prefs.getExternalPrefs.setDotBinaryPath(oldprefs.external.dotbin);
44 prefs.getExternalPrefs.setDotOutputFormat(oldprefs.external.dotformat);
45
46 % update misc prefs
47 prefs.getMiscPrefs.setDefaultWindow(oldprefs.misc.default_window.type);
48 for kk=1:numel(oldprefs.misc.units)
49 unit = oldprefs.misc.units{kk};
50 prefs.getMiscPrefs.addUnit(unit);
51 end
52
53 oldprefs = [];
54
55 end