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

Add support for 1200 px CAA thumbnail size #833

Merged
merged 1 commit into from Feb 9, 2018
Merged

Conversation

zas
Copy link
Collaborator

@zas zas commented Feb 9, 2018

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

Add support for 1200 px CAA thumbnail size

Problem

  • 1200px thumbnails aren't supported
  • size was stored as index in the combo box, compatibility issue
  • items were set in .ui, not dynamically built
  • QtDesigner doesn't support setting user data to QComboBox items

Solution

  • add 1200 px thumbnail choice
  • compatibility preserved using a trick: any value between 0 and 2 is old way, new way uses -1 and values >= 250
  • safe default if value is outside range is read from config file
  • fallback on smaller thumbnails if desired size isn't available

Action

Review & test

- size was stored as index in the combo box
- items were set in .ui, not dynamically built
- QtDesigner doesn't support setting user data to QComboBox items
- compatibility preserved using a trick: any value between 0 and 2 is old way, new way uses -1 and values >= 250
- safe default if value is outside range is read from config file
- fallback on smaller thumbnails if desired size isn't available
@zas zas requested review from samj1912 and mwiencek February 9, 2018 10:29
self.ui.cb_image_size.addItem(_(item.label), userData=item_id)

size = config.setting["caa_image_size"]
if size in _CAA_SIZE_COMPAT:
Copy link
Collaborator

@samj1912 samj1912 Feb 9, 2018

Choose a reason for hiding this comment

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

Rather than introducing this, wouldn't it be better to just have a upgrade hook?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was to avoid an upgrade hook. I pondered both approaches, and this one is much simpler and reliable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just feel that this more of a compat issue with picard versions and should be kept in upgrade hooks, it makes it easier to track config errors. This approach adds unrelated code to the view IMHO.

Also, why are plugin hooks unreliable or this approach more reliable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mostly because upgrade hooks don't work well when someone switch between versions, this code would handle a switch, or even a buggy entry.
This is perfectly possible to do with an upgrade hook though, feel free to propose a patch.

Copy link
Collaborator

@samj1912 samj1912 left a comment

Choose a reason for hiding this comment

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

LGTM apart from my comment above.

@zas zas merged commit 4968ec3 into metabrainz:master Feb 9, 2018
@zas zas deleted the caa_1200 branch February 9, 2018 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants