Skip to content
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.

Already on GitHub? Sign in to your account

Serato color types #11228

Merged

Conversation

daschuer
Copy link
Member

This PR introduces SeratoStoredTrackColor and SeratoStoredHotcueColor along with the common base class SeratoStoredColor.
With the help of these Types the color conversion should be automatically correct and well documented.
A positive side effect is that CueInfo now always have the displayed color representation.

@daschuer daschuer force-pushed the fix-serato-track-color-reset-on-import_1 branch from cc62391 to 5c9b36e Compare January 29, 2023 17:14
return std::nullopt;
}

return std::optional<RgbColor::optional_t>{SeratoTags::storedToDisplayedTrackColor(*color)};
return pStoredColor->toDisplayedColor();
Copy link
Member

@Holzhaus Holzhaus Jan 31, 2023

Choose a reason for hiding this comment

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

This looks like reintroduces the bug fixed in #11217. This toDisplayedColor() call may return nullopt if the tag color is set to "no color". The SeratoTags::getTrackColor function that it's used in may also return nullopt if no tag contains color information. From the callers perspective, these cases can only be distinguishe if we return the nested optional here.

That said, the function signature still has the nested optional, so the compiler is probably smart enough to figure that out automatically. Anyway, I find that code a bit confusing and would prefer if you made the nesting explicit, as before.

This makes the intention of the function more visible.
Copy link
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

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

Code looks good, tests still pass, thanks.

@Holzhaus Holzhaus merged commit f5be5a7 into mixxxdj:2.3 Feb 2, 2023
@daschuer daschuer deleted the fix-serato-track-color-reset-on-import_1 branch May 4, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants