-
-
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
remove WTrackText class, use WTrackProperty or WLabel #12004
Conversation
f5a5f2b
to
dec47ea
Compare
dec47ea
to
a68fb79
Compare
src/widget/wtracktext.cpp
Outdated
m_pTrackMenu->popup(event->globalPos()); | ||
} | ||
void WTrackText::setup(const QDomNode& node, const SkinContext& context) { | ||
WLabel::setup(node, context); |
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.
as rightfully pointed out by clazy.
WLabel::setup(node, context); | |
WTrackProperty::setup(node, context); |
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.
nope, false positive: we do exactly not want that setup which parses the widget context for Property
node since WTrackText is explicitly trackInfo not some specific tag.
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.
How can we let clazy know about it?
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.
See https://github.com/KDE/clazy/blob/master/README.md#reducing-warning-noise
Feel free to reformulate the comment.
WLabel::setup(node, context); | |
// we do exactly not want that setup which parses the widget context | |
// for Property node since WTrackText is explicitly trackInfo not some specific tag. | |
WLabel::setup(node, context); // clazy:exclude=skipped-base-method |
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! Was on mobile so looking this up was rather cumbersome.
Fixed.
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 understand. In that case the base class would handle track loading, dnd & context menu events, and it would be of no practical use (no text is displayed, much like WTrackWidgetGroup
).
The derived classes would only need to define setup
, updateLabel
and mouseDoubleClickEvent
.
Actually, with this PR, we could deprecate WTrackText
(just migrate to WTrackProperty in the official skins) and the outcome would be the same, though I didn't consider that since in the first place because WTrackText is probably used in custom skins.
If I would have thought of that, I'd also had been obvious that we can drop WTrackText and use WTrackProperty with just a few changes in legacyskinloader 🤦♂️
See last commit.
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.
No, that would have been too easy.
WtrackText is just the Text
widget and it's designed for two scenarios:
- if there's a
Text
defined that string is displayed (basically the same as WLabel) - if there's a
Group
defined it shows "track info" (artist &/ title / file name) (and ignoresText
, if defined)
I think my proposal from above can be implemented in legacyskinparser:
- if a
Group
(orChannel
, legacy) is defined useWTrackProperty
(ignoreText
node)- invalid group: empty
- valid group:
Property
defined: show that (empty if property is invalid)- no
Property
node: show track info
- if
Text
is defined simply useWLabel
Outcome:
WTrackProperty + WLabel, drop WTrackText class
I'll take a look. If the changes are too cumbersome I propose to merge this PR as a first step.
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.
Sure... I don't understand all of what you're saying because I'm not familiar enough with the skin system so I can't really form a well informed opinion.
This PR doesn't worsen the code in anyway, so sure we can merge now and do the rest later.
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.
Ha, done!
Test for skin regression without the skin migration commit f29580c
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.
Testing without f29580c:
- all knob labels and fixed deck labels should be okay
- the only place where Text was used from 'track info' are all preview decks and samplers Shade
a68fb79
to
ceb7754
Compare
ceb7754
to
d1ba96d
Compare
I updated the PR description. |
I'm not sufficiently familiar with QMetaProperty, I need some help with moving the the property checks to |
Yes it should be possible. Take a look here: Not sure if everything is accessible though but the code in may store the ID WTrackProperty::setup() and than use it in WTrackProperty::updateLabel via (Untested) :
|
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.
The code looks and works good, by the way. Just give a hint when I should press merge.
Thanks. I'm (briefly) looking into the property topic right now. Either I find a solution with your hints in the next hour, or not. |
I'll give up regarding consolidating the property checks. What I had in mind was doing the Ready to be merged. |
Btw I'd squash the first two commits if you agree. |
Yes, go ahead. |
53413b6
to
c18e41f
Compare
Done, ready for merge. |
c18e41f
to
e3e547b
Compare
e3e547b
to
c4b6161
Compare
Thank you. |
Oh, I forgot to remove the now unused files. |
reduce code duplication / maintenance
Update
First, I made
WTrackText
inherit fromWTrackProperty
(diff was only thesetup()
), then realized that theText
widget was actually aWLabel
with a fixed text and the ability to read aGroup
to show 'track info' #12004 (comment)Now,
WTrackText
is removed entirely. When parsing aText
widget node LegacySkinParser decides right away whether to construct aWLabel
or aWTrackProperty
:Group
is defined (orChannel
, legacy) useWTrackProperty
(ignoreText
node)WLabel
Outcome:
Both
Text
andTrackProperty
work as before, just without the code duplication ofWTrackText
.