2006-01-11, 09:07 PM
Just before christmas I mentioned in a post that was going to provide guidelines for developing plugins. As part of this, I want to address a couple of common problems, by implementing a few minor changes.
Iâm trying to minimize disruptions to existing plugins, so the changes I propose allow for compatibility with the existing methods.
I've not got too much time I can commit to this, so appologize if this doesnt go as far as some might hope...providing an ultimately flexible perfect skinning engine could be a project by itself, let alone trying to implement the other GB-PVR features and provide user support at the same time. :eek:
Anyway, two initial changes I'm looking at are:
1) Using the default skin.xml files
A common cause of problems is using a plugin with a skin that does not explicitly provide support for that plugin. This problem occurs because the plugin is expecting to find its supporting skin files (skin.xml and image files etc), but they are not contained with in the active skin.
Iâm proposing a change will take advantage of the fact that all plugins support the default (blue) skin. Iâm intending to change the SkinHelper to automatically fall back to using these resource files in the default skin if theyâre not available in the active skin.
This change will only affect things explicitly defined in the pluginâs skin xml file(s). Things that are inherited from the BaseSkin.xml will continue to be loaded from the active skin. This means that buttons will still have the correct appearance for the current skin, and the background image will be correct.
I intend to implement support for this functionality through the use of an additional constructor to SkinHelper. The existing constructor to SkinHelper did not provide all the information that would be required to implement this.
To use this new functionality, the plugin developer would create a SkinHelper instance using:
private SkinHelper skinHelper;
â¦
string pluginName = âTV Guideâ; // â¦also the skin subdirectory
string skinFileName = âskin.xmlâ; // note the missing path
skinHelper = new SkinHelper(pluginName, skinFileName);
Behind the scenes the skin helper will determine the correct path and load the XML file. If the XML file cannot be found in the active skin directory, itâll fall back to using the default one in the blue directory.
ISettings
Iâm adding a new interface called ISettings which plugins should implement. It is being added for two main purposes.
1) The first of these reasons is to provide a mechanism for dynamically changing the skin without restarting the application. GB-PVR will call the pluginâs ISettings.Reload() method when the plugin needs to reload there settings. In response to this, the plugin should reinitialize their SkinHelper instance, and reload and settings it requires.
2) This new ISettings interface will also be used to allow settings to be changed directly within the application, rather than having to use the Config app. Using this interface, plugins will expose a list of settings they support, each with a name, type, and their current values. A likely list of types includes:
⢠String, free text
⢠String, select from plugin specified list
⢠Boolean
⢠Number, with minimum and maximum values
To use this new settings information, there will be a new system configuration screen within GB-PVR. Itâll allow the user to view the list of plugins with settings. On selecting a plugin the user will see a list of settings the plugin supports and the current values, which were obtained by GB-PVR calling ISettings.getAllSettings(). On selecting a setting, the user will be able to edit the setting (using a screen based on the setting type). If the user changes the value, ISettings.setSetting(â¦) will be called.
Thoughts? Comments?
Iâm trying to minimize disruptions to existing plugins, so the changes I propose allow for compatibility with the existing methods.
I've not got too much time I can commit to this, so appologize if this doesnt go as far as some might hope...providing an ultimately flexible perfect skinning engine could be a project by itself, let alone trying to implement the other GB-PVR features and provide user support at the same time. :eek:
Anyway, two initial changes I'm looking at are:
1) Using the default skin.xml files
A common cause of problems is using a plugin with a skin that does not explicitly provide support for that plugin. This problem occurs because the plugin is expecting to find its supporting skin files (skin.xml and image files etc), but they are not contained with in the active skin.
Iâm proposing a change will take advantage of the fact that all plugins support the default (blue) skin. Iâm intending to change the SkinHelper to automatically fall back to using these resource files in the default skin if theyâre not available in the active skin.
This change will only affect things explicitly defined in the pluginâs skin xml file(s). Things that are inherited from the BaseSkin.xml will continue to be loaded from the active skin. This means that buttons will still have the correct appearance for the current skin, and the background image will be correct.
I intend to implement support for this functionality through the use of an additional constructor to SkinHelper. The existing constructor to SkinHelper did not provide all the information that would be required to implement this.
To use this new functionality, the plugin developer would create a SkinHelper instance using:
private SkinHelper skinHelper;
â¦
string pluginName = âTV Guideâ; // â¦also the skin subdirectory
string skinFileName = âskin.xmlâ; // note the missing path
skinHelper = new SkinHelper(pluginName, skinFileName);
Behind the scenes the skin helper will determine the correct path and load the XML file. If the XML file cannot be found in the active skin directory, itâll fall back to using the default one in the blue directory.
ISettings
Iâm adding a new interface called ISettings which plugins should implement. It is being added for two main purposes.
1) The first of these reasons is to provide a mechanism for dynamically changing the skin without restarting the application. GB-PVR will call the pluginâs ISettings.Reload() method when the plugin needs to reload there settings. In response to this, the plugin should reinitialize their SkinHelper instance, and reload and settings it requires.
2) This new ISettings interface will also be used to allow settings to be changed directly within the application, rather than having to use the Config app. Using this interface, plugins will expose a list of settings they support, each with a name, type, and their current values. A likely list of types includes:
⢠String, free text
⢠String, select from plugin specified list
⢠Boolean
⢠Number, with minimum and maximum values
To use this new settings information, there will be a new system configuration screen within GB-PVR. Itâll allow the user to view the list of plugins with settings. On selecting a plugin the user will see a list of settings the plugin supports and the current values, which were obtained by GB-PVR calling ISettings.getAllSettings(). On selecting a setting, the user will be able to edit the setting (using a screen based on the setting type). If the user changes the value, ISettings.setSetting(â¦) will be called.
Thoughts? Comments?