-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make the overview-waveform darker for the played portion of the track #1203
Conversation
… as a stronger visual indicator of the current position
Cool idea. Please post screenshots when proposing changes to the GUI. |
Yes, I think skin designers should be able to customize it. Does this make the playhead indicator redundant? |
I would like to stick with the additional playhead indicator (so having both). For some skins it might be enough to use this overlay, but I think not every usecase will fit in that one. My usecase for the overlay was to have a quick view how far the track is if I'm further away from the screen. |
Never looked into the skin stuff before. Any way to get a color with alpha from the skin xml to a QColor? Only saw usages of setNamedColor, that can handle alpha channels only since QT 5.2 We could use a default alpha value, or two Nodes in the skin xml, one for color, one for alpha? |
…form configurable by skin artists
I chose to parse the format that QT5.2 uses for RGBA colors in hex format, which is The Skin-Node is called What do you think about that? |
@@ -134,6 +140,30 @@ void WaveformSignalColors::fallBackDefaultColor() { | |||
fallBackFromSignalColor(); | |||
} | |||
|
|||
QColor WaveformSignalColors::rgbaColorFromString(QString sColorString) { | |||
// Takes a string with format #AARRGGBBAA and returns the corresponding QColor with alpha-channel set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra AA at the end
@@ -134,6 +140,30 @@ void WaveformSignalColors::fallBackDefaultColor() { | |||
fallBackFromSignalColor(); | |||
} | |||
|
|||
QColor WaveformSignalColors::rgbaColorFromString(QString sColorString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be straight forward to move this function to skincontext.h similar to
hasNodeSelectString()
something like
hasNodeSelectColor()
This way all color strings in the skin can benefit from the #AARRGGBB syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go with selectColor()
alone, I think the presence-info is not required in that place, falling back to transparent makes most sense for backwards-compat. And an empty string will be converted to fully transparent by QT.
@@ -55,6 +55,12 @@ bool WaveformSignalColors::setup(const QDomNode &node, const SkinContext& contex | |||
m_playPosColor = m_axesColor; | |||
} | |||
|
|||
m_playedOverlayColor = rgbaColorFromString(context.selectString(node, "PlayedOverlayColor")); | |||
if (!m_playedOverlayColor.isValid()) { | |||
m_playedOverlayColor = QColor(0,0,0,200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment what this color is.
This should also become a const in th anonymous namesace on to of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be using Qt::transparent for backwards-compat.
src/widget/woverview.cpp
Outdated
@@ -338,6 +338,8 @@ void WOverview::paintEvent(QPaintEvent * /*unused*/) { | |||
} | |||
|
|||
painter.drawImage(rect(), m_waveformImageScaled); | |||
// desaturate the scaled waveform-image up to the current play-position by overdrawing semi-transparent black |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the color is now customizable the comment is outdated.
Please skip this line if the color is fully transparent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and we "try" to break lines before column 80.
Then we cannot rely on setNamedColor alone because Mixxx 2.1 will still be using Qt 4. Qt4 does support transparency but it will take a little more code than just calling setNamedColor. |
For that reason I already implemented that parsing logic by hand, using the QT5.2 #AARRGGBB Syntax. Thanks @daschuer for reviewing, will address those comments asap. |
src/widget/woverview.cpp
Outdated
@@ -338,6 +338,8 @@ void WOverview::paintEvent(QPaintEvent * /*unused*/) { | |||
} | |||
|
|||
painter.drawImage(rect(), m_waveformImageScaled); | |||
// desaturate the scaled waveform-image up to the current play-position by overdrawing semi-transparent black | |||
painter.fillRect(0, 0, m_iPos, m_waveformImageScaled.height(), m_signalColors.getPlayedOverlayColor()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only work with horizontal waveform. Please handle the vertical waveform case also. You can use https://github.com/ninomp/mixxx/tree/verticalwaveform_skin for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that hint!
m_playedOverlayColor = QColor(0,0,0,200); | ||
} | ||
m_playedOverlayColor = WSkinColor::getCorrectColor(m_playedOverlayColor).toRgb(); | ||
|
||
m_bgColor.setNamedColor(context.selectString(node, "BgColor")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're at it, could you use the new rgbaColorFromString
function here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Y)
Now working for vertical and horizontal waveforms. Moved color-parsing logic into skincontext.h, made some more colors 'alpha-capable'. |
I can't think of a use case for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, just a few small changes.
src/skin/skincontext.h
Outdated
|
||
QColor color; | ||
QString sColorString = nodeToString(selectElement(node, nodeName)); | ||
if (sColorString.startsWith('#') && sColorString.length() == 9){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: space between )
and {
src/widget/woverview.cpp
Outdated
|
||
// Overlay the played part of the overview-waveform with a skin defined color | ||
QColor playedOverlayColor = m_signalColors.getPlayedOverlayColor(); | ||
if (playedOverlayColor.alpha() > 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: space between )
and {
src/widget/woverview.cpp
Outdated
// Overlay the played part of the overview-waveform with a skin defined color | ||
QColor playedOverlayColor = m_signalColors.getPlayedOverlayColor(); | ||
if (playedOverlayColor.alpha() > 0){ | ||
if (m_orientation == Qt::Vertical){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: space between )
and {
m_playedOverlayColor = Qt::transparent; | ||
} | ||
|
||
m_bgColor = context.selectColor(node, "BgColor"); | ||
if (!m_bgColor.isValid()) { | ||
m_bgColor = QColor(0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have changed this in #1208, but could you change this from QColor(0, 0, 0)
to Qt::transparent
to restore backwards compatibility with old skins?
should be fixed now |
LGTM! 👍 @daschuer, ready for merge? |
failing travis is a timeout I think. ready to merge from my perspective |
I can see the Cue mark in the screens, but just to be sure: HotCue marks are layed on top of this, right? |
Cooooool! nice skin you have there ;) |
It was your amazing work in Tango that made me implement that ;) Its nice to have that small Deck section without (for me) unneeded stuff. But the play pos wasnt that clear I thought. Would really like to see that in Tango therefore. |
My pleasure! Very nice to feel that it works out as intended.
Wasn't 100% happy with that either. Once this is merged I am -like billions of mixxxers I suppose |
So |
Yes, thats it. |
Bamm!! |
Thank you for this PR. It LGTM. Before merge wee need your permission |
Already did that Back in #587 :) |
Ah sorry, of cause you did. |
… as a stronger visual indicator of the current position
aiming to fix lp:1328748
Actually that change set is only one single line of code. I don't have any experience with qt painting and perfomance measures. So please feel free to comment.
I am thinking about making the color configurable for skin artists. What do you think about that?