View Issue Details

IDProjectCategoryView StatusLast Update
0018449MediaMonkey 5Extensions frameworkpublic2021-11-06 23:29
Reporterdrakinite Assigned To 
PriorityurgentSeverityminorReproducibilityN/A
Status resolvedResolutionreopened 
Product Version5.0.2 
Target Version5.0.2Fixed in Version5.0.2 
Summary0018449: Enable skin options via info.json so skin developers don't have to write code
DescriptionAs most skin designers are not developers, it does not make much sense to force them to write code in order to make their skins configurable. We should add the option to generate configuration panels from a "skin_options" attribute in their info.json. Should carry an array with each configurable attribute.

Example JSON:

{
    "skin_options": [
        {
            "type": "color",
            "title": "Text color",
            "variable": "@textColor",
            "default": "#ffffff"
        },
        {
            "type": "color",
            "title": "Highlight color",
            "variable": "warningColor",
            "default": "white"
        },
        {
            "type": "dropdown",
            "title": "Font size",
            "variable": "@baseFontSize",
            "default": "11",
            "options": [
                "9",
                "11",
                "13"
            ]
        },
        {
            "type": "dropdown",
            "title": "Font size (2nd example)",
            "variable": "@baseFontSize",
            "default": "11",
            "options": {
                "9": "Small",
                "11": "Medium",
                "13": "Large"
            }
        },
        {
            "type": "radio",
            "default": "compactEnabled",
            "title": "Compact mode",
            "options": {
                "compactEnabled": {
                    "title": "Enable Compact Mode",
                    "variables": {
                        "baseFontSize": "12px",
                        "waveformHeight": "24px",
                        "baseIconSize": "22px"
                    }
                },
                "compactDisabled": {
                    "title": "Disable Compact Mode",
                    "variables": {
                        "baseFontSize": null,
                        "waveformHeight": null,
                        "baseIconSize": null
                    }
                }
            }
        }
    ]
}
TagsNo tags attached.
Fixed in build2517

Relationships

related to 0017880 closeddrakinite Addons (external) Material Design Compact: Add compact mode in a setting accessible in the View submenu 
related to 0018483 closeddrakinite MediaMonkey 5 Add Skin Options shortcut in View menu 
related to 0018506 closeddrakinite MediaMonkey 5 Skin string tweaks 

Activities

drakinite

2021-10-21 15:46

developer   ~0065376

Note: When writing documentation on this feature, we/I need to explain how to rectify a crash in the case of an invalid LESS variable.
1) either delete persistent.json or delete the problematic string inside the customLESS.values array
2) delete the problematic precompiledLESS file in the temp directory

drakinite

2021-10-26 01:39

developer   ~0065501

Last edited: 2021-10-26 01:41

View 2 revisions

Added feature in 2512, along with:
- Improved app load time.
- Changed Monkey Groove to have an automatic config panel instead of a config.html and config.js.
Same commit as in 0017880.

drakinite

2021-10-30 16:57

developer   ~0065583

Last edited: 2021-10-30 17:01

View 2 revisions

Feedback from TIV73 (https://www.mediamonkey.com/forum/viewtopic.php?f=27&t=100488):

1) Skins with info.json config panels should show up in the "configurable" addons section. Clicking the gear should open the skin config panel through the same method as 0018483
2) "Modified options are persisted as n_[type] (like 3_color, 2_radio, etc.) in persistent.json, which could lead to inconsistent values if the order of elements is changed after their value has been set. I wanted to highlight it since it happened to me when I set up the options, and it could lead to issues and inconsistend behavior down the road if addon authors change the layout customization settings in future updates."
3) "I would love to see an option to either pick up the default values directly from a less file, or make it possible to remove a stored value if the user clicks the reset changes button instead of assigning a static default value.

Consider the following use case: A user tries out different skin color settings, but decides that they ultimately like the default value best, so they click the reset changes button.
Some time later, the addon author finds out that the default value is hard to read in some places and pushes an update that changes the default in the their info.js and less files.
The user installs the update, but since the reset changes button sets a static value instead of removing the option alltogether they will not get the new default."

Currently unsure how best to implement 2; requesting feedback from TIV73.

drakinite

2021-11-06 23:27

developer   ~0065792

Fixed in 2517.
1) Autogenerated config panels now show up in the same place as regular config panels, and open on app install.
2) Options are now saved according to the following pattern:
For radio:
  radio_(formatted version of title), e.g. for CodeMonkey: radio_active_tab_background
For all others:
  (type)_(variable), e.g. for Monkey Groove: color_@warningColor
3) Saving skin options now "flushes" old customLESS values (New, optional third parameter to setLessValues)