xbmc/xbmc — pull request #2738 by Montellese (2013-05-12 10:42:11+00:00)
Title: settings: move dependency handling into CSettingsManager and fix videoscreen settings

This is an attempt to fix the problems with the videoscreen settings popup and switching between windowed and fullscreen mode.

To make sure that all settings depending on the value of another setting are always up-to-date I have moved the logic to handle those dependencies from CGUIWindowSettingsCategory to CSettingsManager. Initially I thought the dependencies would only affect the GUI controls (enabled/disabled etc) but they can also affect the value of another setting so handling this in CSettingsManager makes more sense. It also means that we should probably move the tag out of the tag and directly into the tag but that can still be done later.

To be able to react to changes of the enabled status or if the list of possible options of a setting has changed I added the OnSettingPropertyChanged() callback to ISettingCallback but I'm not completely happy with this. I don't want to "abuse" the OnSettingChanged() callback if the value hasn't changed but I don't like the additional OnSettingPropertyChanged() callback either :-/

Furthermore I have moved the logic to retrieve the list of dynamic options (those which are determined during runtime with a registered method implementation outside of the settings system) into CSettingInt/String so that the rest of XBMC doesn't really have to know about the registered methods etc. Right now there are GetOptions() and UpdateDynamicOptions() (because a change of options may lead to a change of the setting's value). I first tried to provide a single GetOptions() method but the problem is that the options pre-defined in settings.xml use string IDs for localization whereas the dynamic options use already localized strings.

Last but not least I have extended the logic to handle changes to videoscreen.foo settings to not show a prompt when changing from/to windowed mode as suggested by @jmarshallnz. Furthermore thanks to the automatic dependency handling in CSettingsManager all the videoscreen.foo settings should always be in sync i.e. changing videoscreen.screenmode will automatically affect the values of videoscreen.screen and videoscreen.resolution (and vice versa but that was already present before).

I'd be grateful if the people which are constantly encountering the "Do you want to keep this resolution?" prompt could test this and report back. In some cases (especially if using backslash to toggle fullscreen/windowed mode) it might be that the videoscreen.foo settings in guisettings.xml have become "corrupt" (happened to @MartijnKaijser) so in case you still run into problems please always provide the values of videoscreen.screen/resolution/screenmode from your guisettings.xml file as well. Thanks.

PS: Thanks to some of the refactoring I managed to eliminate the inclusion of "settings/Setting.h" (which pulls in a few other settings system internal classes) in settings/Settings.h (which is included everywhere) so now there should be quite a bit less re-compilation if anything inside the settings system is changed.