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

Fixes #6398: Colour of Master bus on FX Mixer retains when switching project #6421

Merged
merged 12 commits into from
Nov 13, 2023

Conversation

spechtstatt
Copy link
Contributor

@spechtstatt spechtstatt commented Jun 1, 2022

Fixes #6398

@LmmsBot
Copy link

LmmsBot commented Jun 1, 2022

🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩

macOS

Windows

🤖
{"platform_name_to_artifacts": {"macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://output.circle-artifacts.com/output/job/7a2d0730-7048-4264-bea2-3e134d323f53/artifacts/0/lmms-1.3.0-alpha.1.221+g8fe731fc9-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17739?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/leo0sa49xlkmwv2c/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44118529"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/kcwdgvxx7cnjafo3/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44118529"}]}, "commit_sha": "6d8d0a587cccd58a02137f95e3193032f92c4db9"}

@DomClark DomClark linked an issue Jun 2, 2022 that may be closed by this pull request
@Monospace-V
Copy link
Contributor

Can't replicate in any way. Seems fixed.

@zonkmachine
Copy link
Member

Merge?

@spechtstatt spechtstatt changed the title Colour of Master bus on FX Mixer retains when switching project #6398 Fixes #6398: Colour of Master bus on FX Mixer retains when switching project Jun 6, 2022
Copy link
Contributor

@JohannesLorenz JohannesLorenz left a comment

Choose a reason for hiding this comment

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

The changes are OK. However, looking at the comment about m_hasColor in the header, it's suggested to use std::optional. Indeed, m_hasColor is always used together with m_hasColor, so (instead of using std::optional) we could remove m_hasColor and instead use QColor::isValid(), which returns false after using the default CTOR? This should reduce future errors, where m_hasColor and QColor::isValid() are not in sync.

@Spekular
Copy link
Member

Spekular commented Jun 6, 2022

Optional should be available by now though, I believe we already bumped to the required C++ version.

@JohannesLorenz
Copy link
Contributor

Optional should be available by now though, I believe we already bumped to the required C++ version.

True, but the we have redundant information in std::optional and QColor about validity.

@PhysSong
Copy link
Member

Optional should be available by now though, I believe we already bumped to the required C++ version.

True, but the we have redundant information in std::optional and QColor about validity.

I don't think two validity information represent the same thing. Invalid QColor may mean not only we haven't set a value yet, but also we set it to an invalid value manually for some reason.

@PhysSong PhysSong closed this Jun 18, 2022
@PhysSong PhysSong reopened this Jun 18, 2022
@JohannesLorenz
Copy link
Contributor

I think they are equivalent in our current code. Do you see any use case in our code where an invalid MixerChannel::m_color and a not-set MixerChannel::m_color should be handled differently?

@PhysSong
Copy link
Member

Do you see any use case in our code where an invalid MixerChannel::m_color and a not-set MixerChannel::m_color should be handled differently?

No for now, but if we allow setting colors by name, for example, m_color might be set to an invalid color. In that case, however, it might be good to treat invalid colors as not set.

@Spekular
Copy link
Member

In my opinion, a single (possibly invalid) member of type QColor doesn't imply that having no color is an acceptable state. An optional makes it clear that we expect there to be situations where there's no color, and it's not necessarily an error.

@JohannesLorenz
Copy link
Contributor

In my opinion, a single (possibly invalid) member of type QColor doesn't imply that having no color is an acceptable state. An optional makes it clear that we expect there to be situations where there's no color, and it's not necessarily an error.

Look like the team is for using std::optional then. @spechtstatt do you think you could fix that? It's the last comment of this PR which has to be resolved. Alternatively, someone else could code it for you.

@DomClark
Copy link
Member

I feel like the switch to std::optional is a bit out of scope for what is otherwise a tiny change. There's a bunch of other modernisation to be done across the codebase, and I think it would fit better there. If the author is happy to add it here, then I won't object, but I think it's overcomplicating things to require it here.

@spechtstatt
Copy link
Contributor Author

spechtstatt commented Jun 19, 2022

Well - I am somehow with @DomClark in that it may be too much for this tiny bug fix but I tried anyway :-)

Not sure if I made it right though. Especially when calling the color selection dialog.

@JohannesLorenz
Copy link
Contributor

@spechtstatt The use of std::optional looks correct, but shouldn't it replace m_hasColor?

@spechtstatt
Copy link
Contributor Author

Ok - I see - somehow like the Nullables in C#.

Yes - makes sense.

@PhysSong
Copy link
Member

@spechtstatt It seems like somehow changed tabs to spaces.

@spechtstatt
Copy link
Contributor Author

Oh sorry.

I switched my Computer recently and I probably forgot to change it in the qt creator settings.

@PhysSong
Copy link
Member

PhysSong commented Jul 2, 2022

@spechtstatt The use of std::optional looks correct, but shouldn't it replace m_hasColor?

@spechtstatt Could you address that with the indentation fixes(revert to tabs)?

@spechtstatt
Copy link
Contributor Author

Yes of course.

Copy link
Contributor

@JohannesLorenz JohannesLorenz left a comment

Choose a reason for hiding this comment

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

Only minor and very easy-to-solve comments. Feel free to ignore.

Copy link
Contributor

@allejok96 allejok96 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 except for one warning during build

@spechtstatt spechtstatt force-pushed the bugfix/mixer-master-color branch from 6d8d0a5 to 3e37381 Compare September 30, 2022 15:49
Copy link
Contributor

@allejok96 allejok96 left a comment

Choose a reason for hiding this comment

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

Confused by the commit log, but it builds fine and my comments seem to be fixed. Haven't test run tho.

Copy link
Contributor

@JohannesLorenz JohannesLorenz left a comment

Choose a reason for hiding this comment

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

Tested. Bug is fixed an no regressions.

@JohannesLorenz
Copy link
Contributor

2 code reviews + 1 test review passed. Suggesting merge.

@DomClark DomClark self-requested a review October 1, 2022 20:52
@spechtstatt
Copy link
Contributor Author

@allejok96: you mean the commit message? Yes: I was repeating the issue title again like in the first commit which was probably not the best idea.

@JohannesLorenz
Copy link
Contributor

@spechtstatt There is still one outstanding comment from PhysSong. Can you please try to fix it (or tell us if someone else should fix it)?

@spechtstatt
Copy link
Contributor Author

@JohannesLorenz: not sure how to fix this - any suggestions?

Copy link
Contributor

@Veratil Veratil left a comment

Choose a reason for hiding this comment

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

Code style fixes and then we can merge :)

@JohannesLorenz
Copy link
Contributor

@spechtstatt Do you plan to continue this PR (solving the last open comments), or is it necessary that someone of the other devs takes over your PR?

@spechtstatt
Copy link
Contributor Author

Hi Johannes,

unfortunately, I currently have no time to work on the PR and this will continue for a while.

So, yes. I would be happy if someone could take over.

Co-authored-by: Kevin Zander <[email protected]>
@JohannesLorenz
Copy link
Contributor

According to Veratil and Dom, this can now be merged, so I will merge it now.

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.

Colour of Master bus on FX Mixer retains when switching project
10 participants