This PR adds the last missing integrity test (for our config file hydrogen.conf). But it required some heavy refactoring.
Instead of having just the Preferences singleton to load system-level or user-level settings into, we now adhere to the pattern we already use for e.g. Song and Playlist and provide a load() method to retrieve a Preferences instance without altering anything within Hydrogen, a save() method and saveCopyAs() to store changes, as well as load*, set*, save* routines in CoreActionController, which can be used from e.g. the GUI part.
The MidiMap singleton as killed and is now a member variable of Preferences.
In addition, upgrading the user-level preferences file on startup was dropped as well. It is also kinda redundant since loading it produces an updated version in memory and when quitting Hydrogen this updated version is written to disk anyway.
I also refactored large parts of Preferences::load. Now, it uses the values assigned in the constructor(s) as default ones. This was already done in a lot of places. But not all. Some of the default values did already diverge.
This PR adds the last missing integrity test (for our config file
hydrogen.conf
). But it required some heavy refactoring.Instead of having just the
Preferences
singleton to load system-level or user-level settings into, we now adhere to the pattern we already use for e.g.Song
andPlaylist
and provide aload()
method to retrieve aPreferences
instance without altering anything within Hydrogen, asave()
method andsaveCopyAs()
to store changes, as well asload*
,set*
,save*
routines inCoreActionController
, which can be used from e.g. the GUI part.The
MidiMap
singleton as killed and is now a member variable ofPreferences
.In addition, upgrading the user-level preferences file on startup was dropped as well. It is also kinda redundant since loading it produces an updated version in memory and when quitting Hydrogen this updated version is written to disk anyway.
I also refactored large parts of
Preferences::load
. Now, it uses the values assigned in the constructor(s) as default ones. This was already done in a lot of places. But not all. Some of the default values did already diverge.