8000 Fix order of filter parameters is random, #4262 by low-batt · Pull Request #4263 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix order of filter parameters is random, #4262 #4263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

A 10000 lready on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

low-batt
Copy link
Contributor

This commit will:

  • Add a new struct FilterParameters that holds parameters in a KeyValuePairs object
  • Change FilterPreset to use the new struct to preserve the order of parameters specified in the filter definition

This insures the order of the UI controls displayed to the user representing the filter parameters remains consistent.


Description:

This commit will:
- Add a new struct FilterParameters that holds parameters in a
  KeyValuePairs object
- Change FilterPreset to use the new struct to preserve the order of
  parameters specified in the filter definition

This insures the order of the UI controls displayed to the user
representing the filter parameters remains consistent.
@low-batt low-batt linked an issue Mar 11, 2023 that may be closed by this pull request
1 task
/// instead of a Swift dictionary to hold the name to `FilterParameter` mapping. The order of the parameters dictates the order
/// of the UI controls displayed to the user. A dictionary **must not** be used as that would cause the UI controls representing the
/// parameters to appear in random order.
struct FilterParameters {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we create a new struct for this? I think we can directly use KeyValuePairs<String, FilterParameter> for FilterPreset.params. For the .get() method, we can implement in the extension of KeyValuePairs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to make it really clear how filter parameters must be contained to avoid people using dictionaries. I'll go ahead and simplify and use KeyValuePairs inline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not possible to implement the get method as an extension to KeyValuePairs because the Key generic parameter is not defined as being equatable. No matter. The approach I used is totally and completely wrong. I missed that there is already a paramOrder. But is it optional and missing from several presets. I'm closing this PR and opening a new one that uses the existing system for ordering parameters.

@low-batt
Copy link
Contributor Author

Replaced by PR #4407.

@low-batt low-batt closed this May 10, 2023
@low-batt low-batt removed a link to an issue May 10, 2023
1 task
@uiryuu uiryuu deleted the fix-4262 branch May 11, 2023 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0