Force a category for the Settings of a Plugin
This task is an improvement thought up after some remarks in this forum thread
A Plugin can use the Qt.labs.settings
method to store its settings, which are then incorporated into the .ini/.prefs file of MuseScore. These settings are namespaced by the
category property of that object.
If a developer does not set the category property of the Settings object in his/her plugin, those settings are included in the main MuseScore group within that file. This means it is likely that a plugin could also overwrite the actual settings from MuseScore itself if a name collision occurs.
The proposition is the following:
1. A plugin has no Settings -> nothing to do
2. A plugin has Settings and specified a category -> nothing to do
3. A plugin has Settings but didn't specify a category -> autogenerate one based off of the pluginName
A sidethought for situation 2. Would we want to block plugins from changing the MuseScore settings at all? If a plugin explicitly defines the MuseScore category, it could still lead to collisions…
Sidenote 2: I haven't tested if multiple Settings objects can be used within one plugin. If so it could be useful for a plugin to explicitly read out Settings in the MuseScore namespace. However I think that there is no way to provide read-only access via a Settings object.
In that case (if the need should arrive) it might be better to add a
string MS::getSetting(string key) function allowing the readonly access.