Announcement

Collapse
No announcement yet.

Plugin configuration?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plugin configuration?

    Hey Dave,

    I was wondering what your thoughts were on how you want to implement this... Should each plugin specify its own configuration screen UI or should CarFrontEnd provide some generic UI? How should the data be stored?

  • #2
    Each plugin should handle it's own UI for it's configuration. As far as the configuration data, while you are not restricted to it there are methods in CarFrontEndAPI/PluginManager.h that allow you to save and retrieve configuration information. Currently you can store anything in there that NSDictionary can write to the file system.

    Code:
    #pragma mark Plugin Preferences methods
    @protocol PluginPreferences
    
    // Returns the current preferences for the given plugin.
    //  This is based on the value returned by the -name method of the plugin, so
    //      it is critical not to share names with other plugins.
    - (NSDictionary *) preferencesForPlugin: (id <CarFrontEndProtocol>) plugin;
    
    // Stores the given preferences dictionary.
    //  The structure of the dictionary is completely arbitrary from CFE's point
    //      of view and completely in the Plugin's control.
    //  This is based on the value returned by the -name method of the plugin, so
    //      it is critical not to share names with other plugins.
    - (void) savePreferences: (NSDictionary *) pluginPreferences
                  forPlugin: (id <CarFrontEndProtocol>) plugin;
    
    @end
    Here is a rough example:
    Code:
    - (void) savePrefs: (id) sender {
        NSMutableDictionary    *prefs = [[pluginManager preferencesForPlugin:self] mutableCopyWithZone:NULL];
    
        ...
    
        [pluginManager savePreferences:prefs forPlugin:self];
    }
    Let me know if you need more details.

    -dave
    My pathetic worklog.
    CarFrontEnd (now it's own sub-forum!!!!)

    Comment


    • #3
      Thanks, I'll take a closer look at it soon.

      Comment

      Working...
      X