View Issue Details

IDProjectCategoryView StatusLast Update
0018449MMW 5Extensions frameworkpublic2024-07-07 12:22
Reporterdrakinite Assigned To 
PriorityurgentSeverityminorReproducibilityN/A
Status closedResolutionreopened 
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 MMW 5 Add Skin Options shortcut in View menu 
related to 0018506 closeddrakinite MMW 5 Skin string tweaks 
related to 0021064 feedbackpetr MMW 5 New types of skin_options needed (checkbox, number edit box) 
related to 0021066 closeddrakinite MMW 5 Incorrect value stored in persistent.json for skin option 

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

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

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)

peke

2021-12-18 01:35

developer   ~0066405

Verified 2528

no issues found.

zvezdan

2024-07-07 12:19

updater   ~0076255

"radio_(formatted version of title)" is not very good way to store options of radio buttons, for the similar reason mentioned in 2). What if I change the title in the updated version of skin?

"(type)_(variable)" format is fine, but it cannot be implemented on radio, because you made it in such way that one radio option could change several Less variables. Which is fine sometimes, but why not having the same for dropdowns as well? Maybe it could be useful for some skins if each option in a dropdown could change multiple Less variables.

However, I have another thing on my mind. What if I have a radio group that change only one value? In such case, the radio group could be treated similarly to the current implementation of dropdown and we could have something like this:
        {
            "type": "radio",
            "title": "Album Artwork",
            "variable": "@albumArtwork",
            "default": "2",
            "options": {
                "1": "Hide",
                "2": "Show if exists",
                "3": "Show always"
            }
        }

In that case, the persistent.json will have stored the values for radios using a Less variable name, independently of their titles. And you could keep the existing syntax for cases when some skin needs to change multiple variables with each radio option.