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

Fix data flow #43

Closed
wants to merge 2 commits into from
Closed

Fix data flow #43

wants to merge 2 commits into from

Conversation

uklotzde
Copy link

Only the actual rating drives the signal, not the (temporary) visual number of stars.

@github-actions github-actions bot added the ui label May 19, 2023
return 0;
}

return star;
}

void WStarRating::mouseReleaseEvent(QMouseEvent* /*unused*/) {
emit ratingChanged(m_starRating.starCount());
slotSetRating(m_visualStarRating.starCount());
Copy link
Owner

Choose a reason for hiding this comment

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

This feels wrong: we now store the stars without confirmation, as if it was an update from the owner/mediator. IMO it was correct before: emit the change (don't store it) and wait for the owner to confirm/reject/reset.

Copy link
Owner

Choose a reason for hiding this comment

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

Result of this implementation is that you can now set stars in the rating widget of an empty deck.

Comment on lines +57 to +59
m_starCount = starCount;
resetVisualRating();
emit ratingChanged(starCount);
Copy link
Owner

@ronso0 ronso0 May 19, 2023

Choose a reason for hiding this comment

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

shouldn't this be updateVisualrating()?
Also, emitting the signal again with the value we may just received doesn't make sense to me. What for?
It seems emit is required here only because you use slotSetRating instead of emit in mouseReleaseEvent.

@ronso0
Copy link
Owner

ronso0 commented May 19, 2023

Thank you for the cleanup/renaming and the StarRating helpers.
Though, I don't agree with / understand some of the changes. See comments above.

@coveralls

This comment was marked as outdated.

@uklotzde
Copy link
Author

I revisited the code again, but couldn't come up with a consistent solution. You round trip argument doesn't hold, since the mouse release event explicitly sets a new value implicitly.

Intermediate, temporary changes when hovering with the mouse over the widget should not be emitted.

Giving up, not wasting my time with this convoluted legacy code. Probably better to wait for QML. Since I don't use this feature I cannot even test it properly.

@ronso0
Copy link
Owner

ronso0 commented May 20, 2023

Okay then, thanks for your time anyway!

Intermediate, temporary changes when hovering with the mouse over the widget should not be emitted.

Exactly, just the clicked star count is emitted. Imagining the signals are very slow, on LeaveEvent the rating is reset to the previously confirmed value. Then the return signal from BaseTrackPlayer (or DlgTrackInfo) sets (or clears) the visual rating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants