Skip to content

Commit

Permalink
Added a <RequiresStem> node to stem WidgetGroups and only parse these…
Browse files Browse the repository at this point in the history
… WidgetGroup if STEM is enabled
  • Loading branch information
JoergAtGithub committed Sep 21, 2024
1 parent 79e36cc commit 802cbd5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions res/skins/LateNight/waveform.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<SizePolicy>me,me</SizePolicy>
<Children>
<WidgetGroup>
<RequiresStem>true</RequiresStem>
<ObjectName>StemControls</ObjectName>
<Layout>vertical</Layout>
<SizePolicy>max,me</SizePolicy>
Expand Down
31 changes: 19 additions & 12 deletions res/skins/LateNight/waveforms_container.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,31 @@
<SizePolicy>me,min</SizePolicy>
<Children>

<Template src="skins:LateNight/controls/button_2state_persist.xml">
<SetVariable name="TooltipId">show_stem_controls</SetVariable>
<SetVariable name="ObjectName">StemControlsToggle</SetVariable>
<SetVariable name="Size">26f,52f</SetVariable>
<SetVariable name="BtnSize"></SetVariable>
<SetVariable name="ConfigKey">[Skin],show_stem_controls</SetVariable>
</Template>
<WidgetGroup>
<RequiresStem>true</RequiresStem>
<Layout>vertical</Layout>
<SizePolicy>min,min</SizePolicy>
<Children>
<Template src="skins:LateNight/controls/button_2state_persist.xml">
<SetVariable name="TooltipId">show_stem_controls</SetVariable>
<SetVariable name="ObjectName">StemControlsToggle</SetVariable>
<SetVariable name="Size">26f,52f</SetVariable>
<SetVariable name="BtnSize"></SetVariable>
<SetVariable name="ConfigKey">[Skin],show_stem_controls</SetVariable>
</Template>
</Children>
</WidgetGroup>

<WidgetGroup>
<WidgetGroup>
<Layout>vertical</Layout>
<Size>100me,40me</Size>
<Children>
<Children>

<WidgetGroup>
<Layout>horizontal</Layout>
<WidgetGroup>
<Layout>horizontal</Layout>
<SizePolicy>me,me</SizePolicy>
<Children>
<Template src="skins:LateNight/waveform.xml">
<Template src="skins:LateNight/waveform.xml">
<SetVariable name="ChanNum">3</SetVariable>
<SetVariable name="SignalColor"><Variable name="SignalColor_34"/></SetVariable>
<SetVariable name="BgColorWaveform"><Variable name="BgColorWaveform_34"/></SetVariable>
Expand Down
10 changes: 10 additions & 0 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ void LegacySkinParser::parseChildren(
}

QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
#ifndef __STEM__
if (requiresStem(node)) {
return nullptr;
}
#endif
WWidgetGroup* pGroup = new WWidgetGroup(m_pParent);
setupBaseWidget(node, pGroup);
setupWidget(node, pGroup->toQWidget());
Expand Down Expand Up @@ -2577,3 +2582,8 @@ QString LegacySkinParser::stylesheetAbsIconPaths(QString& style) {
style.replace("url(skins:", "url(" + m_pConfig->getResourcePath() + "skins/");
return style.replace("url(skin:", "url(" + m_pContext->getSkinBasePath());
}

bool LegacySkinParser::requiresStem(const QDomElement& node) {
QDomElement requiresStemNode = node.firstChildElement("RequiresStem");
return !requiresStemNode.isNull() && requiresStemNode.text() == "true";
}
1 change: 1 addition & 0 deletions src/skin/legacy/legacyskinparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class LegacySkinParser : public QObject, public SkinParser {

QString parseLaunchImageStyle(const QDomNode& node);
QString stylesheetAbsIconPaths(QString& style);
bool requiresStem(const QDomElement& node);
void parseChildren(const QDomElement& node, WWidgetGroup* pGroup);

UserSettingsPointer m_pConfig;
Expand Down

0 comments on commit 802cbd5

Please sign in to comment.