zinnschlag/openmw — pull request #1311 by graffy76 (2014-04-19 01:32:53+00:00)
Title: Changes to user settings

Ok, here's what I've got...

So far as I can tell, this implementation works pretty well. I've reduced a lot of code, but the model is fragmented due to a design decision I made when refactoring to simplify certain issues. Sirherrbatka will, hopefully, take that on when he gets done with QSettings.

-------
Current features:
-------

1. Signal / slot linkage to editor (e.g., changing the window size auto-updates the editor views like it should)

2. Simplified definition of internal user settings (see UserSettings::buildSettingModelDefaults for examples)

3. A greatly enhanced method of chaining settings together (what I call "proxy settings") This is the mechanism in "Window Settings" that connected the "Width" & "Height" line edits to the "Pre-Defined" combobox, such that changes in one affect the other(s). Should there be a need to implement one-way chaining (read-only or write-only), that should be a simple matter. Also, it should be possible to chain settings in series as it is, though I'm sure it'll break if you try that - I've not tested it. Anyway, the code that makes it work is in CSMSettings::Connector.

Take a look at the "Proxy Selection Test" demo to see how it works. To disable the demo, comment out the entire last block of code.

4. Currently only LineEdit, TextArea, ComboBox, Radiobutton, and CheckBox are supported. Multiple value settings *are* supported, however.

5. Setting properties may be enumerated to facilitate future 3rd party dev scripts for addons

--------
Future improvements (in no particular order):
--------

1. Call views for the widgets they contiain (radiobutton, checkbox, combobox, etc. instead of "multibool, singletext"

2. Unify the model with a QAbstractItemModel that uses QSettings to load config files. This will also facilitate loading scripts for 3rd party dev addons

3. Implement "range" widgets (slider, spin box, etc)

4. Add a "debug" mode to enable live viewing of the setting model in a tree view (partial code is in place, commented out). This would probably be useful when 3rd party devs start scripting the user settings for their addons.