[PATCH] Unexpected Behaviour in preference window.

Dirk Hohndel dirk at hohndel.org
Mon Apr 7 13:22:57 PDT 2014


On Mon, 2014-04-07 at 19:12 +0200, Gehad wrote:
> Some fields in the preference window are not restored correctly, This 
> patch fixes them.
> I am not sure if the commit message is clear enough or not.

I slightly rephrased it and accepted the patch.

Of course there is still a somewhat bigger problem.
The way we deal with preferences is a complete mess.

For some preferences, we have defaults set in subsurfacestartup.c:

struct preferences default_prefs = {
	.units = SI_UNITS,
	.unit_system = METRIC,
	.pp_graphs = {
		.po2 = false,
		.pn2 = false,
		.phe = false,
		.po2_threshold = 1.6,
		.pn2_threshold = 4.0,
		.phe_threshold = 13.0,
	},
...

For other preferences, we define default values when using them, e.g.
animation_speed:

in qt-ui/profile/animationfunctions.cpp:

int msecs = s.value("animation_speed", 500).toInt();

Sometimes we check the prefs variable, e.g., prefs.units.length, yet for
others we call s.value (settings.value) from random spots of the code
(see anumation_speed example above).

I'd really like to have a prefs variable that tracks the currently
active prefs and only reference that anywhere in the code. The only
place that should mess with s.value should be preferences.cpp

/D



More information about the subsurface mailing list