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

Better widget image scaling support. #426

Merged
merged 8 commits into from
Dec 15, 2014
Merged

Better widget image scaling support. #426

merged 8 commits into from
Dec 15, 2014

Conversation

rryan
Copy link
Member

@rryan rryan commented Dec 9, 2014

  • Add STRETCH_ASPECT and FIXED DrawModes.
  • Guard (almost) all setFixedSize calls in widgets on FIXED DrawMode.
  • Remove WStatusLight SizeMode since it was added to allow side-stepping setFixedSize calls.
  • Remove pixmap fall-back for SVGs when rendering with a source rectangle (i.e. VU meters). I finally got this working with QSvgRenderer.
  • De-dupe logic in Paintable::draw methods so they all funnel through one handler -- drawInternal.
  • Use floating point for rectangle calculations in WVuMeter instead of integers.
  • SkinContext helper for extracting scalemode.
  • Support for "scalemode" attribute on (almost) all widget images.

The only remaining widget that doesn't have scalemode support and still calls setFixedSize is WSpinny -- which uses QImage's instead of Paintables.

Fixes quantization glitches in SVG rendering.
* Remove pixmap-rendering for rendering SVG with a source rectangle. I
  added this hack when I was adding SVG support because I didn't have
  time to figure out the problems it caused for VU meters.
* Adds a FIXED and STRETCH_ASPECT DrawMode to Paintable.
* Remove WStatusLight SizeMode as DrawMode is more general and covers
  its use cases.
* Only call QWidget::setFixedSize if the DrawMode is FIXED.
* Use FIXED as default DrawMode for most widgets for backwards
  compatibility.
* Switch most Paintable::draw() calls to rectangle targets instead
  of (x,y) points. This allows the DrawMode to do the right behavior
  based on the mode.
rryan referenced this pull request Dec 9, 2014
* Scale WSliderComposed handle to the width or height of the widget.
* Update Deere slider handles to look more like classic Deere -- still
  missing the dropshadow.

Raster handles are usually custom-built to be the same width/height as
the slider so this should not affect most existing skins.
Paintable::DrawMode SkinContext::selectScaleMode(
const QDomElement& element,
Paintable::DrawMode defaultDrawMode) const {
QString drawModeStr = selectAttributeString(
Copy link
Member

Choose a reason for hiding this comment

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

what's our policy on case-sensitivity of xml attributes? I've been hacking things to be case insensitive but I think this is still case-sensitive. I'm happy to choose one or the other but we should be consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

DrawModeFromString doesn't care -- I prefer to have the XML match the code though.

Copy link
Member

Choose a reason for hiding this comment

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

that feels like a leaky abstraction. skin designers shouldn't need to know anything about QT

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, DrawMode is a Mixxx thing -- not Qt.

I agree though -- but that ship has sailed... since our new UI system is essentially a giant pile of QLayouts -- you kind of have to know about how Qt does layout .. which means understanding sizemodes, sizeincrements, minimumsize, maximumsize, etc. and how they interact.

@ywwg
Copy link
Member

ywwg commented Dec 9, 2014

did you test this with latenight to see if the crossfader is fixed?

@rryan
Copy link
Member Author

rryan commented Dec 9, 2014

did you test this with latenight to see if the crossfader is fixed?

I couldn't reproduce that issue -- I didn't see any cropping of the crossfader slider or handle in LateNight in the current master. Do you have to change the skin?

A better question may be -- why is LateNight's slider handle taller than the slider by 3 pixels?

@ywwg
Copy link
Member

ywwg commented Dec 9, 2014

why is LateNight's slider handle taller than the slider by 2 pixels?

because life is not perfect :). I'll check against this branch and fix the pixmap if it's still wrong. (It would be Nice to replace the pngs with svgs but that's low on the list)

@rryan
Copy link
Member Author

rryan commented Dec 15, 2014

Let's launch and iterate on this one .. I'm sure issues with it will come up but I think the direction is right.

rryan added a commit that referenced this pull request Dec 15, 2014
Better widget image scaling support.
@rryan rryan merged commit 98ccf88 into mixxxdj:master Dec 15, 2014
@ywwg
Copy link
Member

ywwg commented Dec 15, 2014

np. I fixed LateNight so the pixmaps lined up. The reason the slider wasn't the same width as the knob was the knob has a drop shadow that makes it off-center.

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