remove WTrackText class, use WTrackProperty or WLabel#12004
remove WTrackText class, use WTrackProperty or WLabel#12004daschuer merged 2 commits intomixxxdj:2.4from
Conversation
f5a5f2b to
dec47ea
Compare
dec47ea to
a68fb79
Compare
| 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.
as rightfully pointed out by clazy.
| WLabel::setup(node, context); | |
| WTrackProperty::setup(node, context); |
There was a problem hiding this comment.
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.
How can we let clazy know about it?
There was a problem hiding this comment.
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.
Thanks! Was on mobile so looking this up was rather cumbersome.
Fixed.
There was a problem hiding this comment.
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.
No, that would have been too easy.
WtrackText is just the Text widget and it's designed for two scenarios:
- if there's a
Textdefined that string is displayed (basically the same as WLabel) - if there's a
Groupdefined 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(ignoreTextnode)- invalid group: empty
- valid group:
Propertydefined: show that (empty if property is invalid)- no
Propertynode: show track info
- if
Textis 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.
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.
Ha, done!
Test for skin regression without the skin migration commit f29580c
There was a problem hiding this comment.
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) : |
|
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
WTrackTextinherit fromWTrackProperty(diff was only thesetup()), then realized that theTextwidget was actually aWLabelwith a fixed text and the ability to read aGroupto show 'track info' #12004 (comment)Now,
WTrackTextis removed entirely. When parsing aTextwidget node LegacySkinParser decides right away whether to construct aWLabelor aWTrackProperty:Groupis defined (orChannel, legacy) useWTrackProperty(ignoreTextnode)WLabelOutcome:
Both
TextandTrackPropertywork as before, just without the code duplication ofWTrackText.