Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 62 additions & 62 deletions res/skins/Shade/effect_parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,66 @@
Effect: the effect
-->
<Template>
<WidgetGroup>
<Size>e,45</Size>
<Layout>horizontal</Layout>
<Style> WEffect, WPushButton {
font: bold 12px/10px sans-serif;
font-family: "Open Sans";
background-color: transparent;
color: #191F24;
padding-left: 1px;
}
</Style>
<Children>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">1</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">1</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">2</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">2</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">3</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">3</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">4</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">4</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">5</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">5</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">6</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">6</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">7</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">7</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">8</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">8</SetVariable>
</Template>
</Children>
</WidgetGroup>
<WidgetGroup>
<Size>e,45</Size>
<Layout>horizontal</Layout>
<Style> WEffect, WPushButton {
font: bold 12px/10px sans-serif;
font-family: "Open Sans";
background-color: transparent;
color: #191F24;
padding-left: 1px;
}
</Style>
<Children>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">1</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">1</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">2</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">2</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">3</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">3</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">4</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">4</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">5</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">5</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">6</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">6</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">7</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">7</SetVariable>
</Template>
<Template src="skin:effect_parameter_knob.xml">
<SetVariable name="effectparameternum">8</SetVariable>
</Template>
<Template src="skin:effect_parameter_button.xml">
<SetVariable name="effectparameternum">8</SetVariable>
</Template>
</Children>
</WidgetGroup>
</Template>
21 changes: 0 additions & 21 deletions res/skins/Shade/effect_selector.xml

This file was deleted.

75 changes: 39 additions & 36 deletions res/skins/Shade/effect_selector_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,72 @@
-->
<Template>
<WidgetGroup>
<Layout>horizontal</Layout>
<Style> WEffect, WPushButton {
<Layout>horizontal</Layout>
<Style> WEffect, WPushButton {
font: bold 12px/10px sans-serif;
font-family: "Open Sans";
background-color: transparent;
color: #191F24;
padding-left: 1px;
padding-left: 1px;
}
</Style>
<Children>
<PushButton>
</Style>
<Children>
<WidgetGroup>
<Size>4,4</Size>
</WidgetGroup>
<PushButton>
<TooltipId></TooltipId>
<Style></Style>
<NumberStates>2</NumberStates>
<State>
<Number>0</Number>
<Pressed>btn_kill_down.png</Pressed>
<Unpressed>btn_kill.png</Unpressed>
<Number>0</Number>
<Pressed>btn_kill_down.png</Pressed>
<Unpressed>btn_kill.png</Unpressed>
</State>
<State>
<Number>1</Number>
<Pressed>btn_kill_overdown.png</Pressed>
<Unpressed>btn_kill_over.png</Unpressed>
</State>
<Connection>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],enabled</ConfigKey>
<ButtonState>LeftButton</ButtonState>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],enabled</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
</PushButton>
<PushButton>
<Size>20f,20f</Size>
<NumberStates>1</NumberStates>
<State>
<Number>0</Number>
<Pressed>btn_previous_over.png</Pressed>
<Unpressed>btn_previous.png</Unpressed>
</State>
<Connection>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],prev_effect</ConfigKey>
</PushButton>
<PushButton>
<Size>20f,20f</Size>
<NumberStates>1</NumberStates>
<State>
<Number>0</Number>
<Pressed>btn_previous_over.png</Pressed>
<Unpressed>btn_previous.png</Unpressed>
</State>
<Connection>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],prev_effect</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
</PushButton>
</Connection>
</PushButton>
<EffectName>
<Style>
QLabel { qproperty-alignment: AlignCenter; }
</Style>
<Size>110,e</Size>
<EffectRack>1</EffectRack>
<EffectUnit><Variable name="effectunitnum"/></EffectUnit>
<Effect><Variable name="effectnum"/></Effect>
<Elide>middle</Elide>
</EffectName>
<Style>
QLabel { qproperty-alignment: AlignCenter; }
</Style>
<Size>110,e</Size>
<EffectRack>1</EffectRack>
<EffectUnit><Variable name="effectunitnum"/></EffectUnit>
<Effect><Variable name="effectnum"/></Effect>
<Elide>middle</Elide>
</EffectName>
<PushButton>
<Size>20f,20f</Size>
<NumberStates>1</NumberStates>
<State>
<Number>0</Number>
<Pressed>btn_next_over.png</Pressed>
<Unpressed>btn_next.png</Unpressed>
</State>
</State>
<Connection>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],next_effect</ConfigKey>
<ButtonState>LeftButton</ButtonState>
<ConfigKey>[EffectRack1_EffectUnit<Variable name="effectunitnum"/>_Effect<Variable name="effectnum"/>],next_effect</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
</PushButton>
</Children>
Expand Down
54 changes: 35 additions & 19 deletions res/skins/Shade/effectunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<WidgetGroup>
<Pos>0,0</Pos>
<MinimumSize>508,104</MinimumSize>
<MaximumSize>508,104</MaximumSize>
<SizePolicy>f,f</SizePolicy>
<MaximumSize>508,104</MaximumSize>
<SizePolicy>f,f</SizePolicy>
<Children>
<WidgetGroup>
<Pos>1,0</Pos>
Expand All @@ -16,39 +16,55 @@
<BackPath>style/style_bg_effectunit</BackPath>
<Children>
<WidgetGroup>
<Pos>9,5</Pos>
<Size>170,90</Size>
<Layout>vertical</Layout>
<BackPathHighlighted>style/style_bg_effect1_high</BackPathHighlighted>
<Pos>5,5</Pos>
<Size>495,45</Size>
<Layout>horizontal</Layout>
<Style>QGroupBox {
background: url();
background: Url();
}
</Style>
<Children>
<Template src="skin:effect_selector.xml">
<Template src="skin:effect_selector_button.xml">
<SetVariable name="Effect">1</SetVariable>
<SetVariable name="effectnum">1</SetVariable>
</Template>
<Template src="skin:effect_parameters.xml">
<SetVariable name="effectnum">1</SetVariable>
</Template>
<Template src="skin:effect_selector.xml">
<SetVariable name="effectnum">2</SetVariable>
</Template>
</Children>
</WidgetGroup>
<Connection>
<BindProperty>highlight</BindProperty>
<Transform>
<IsEqual>1</IsEqual>
</Transform>
</Connection>
</WidgetGroup>
<WidgetGroup>
<Pos>170,5</Pos>
<Size>300,90</Size>
<Layout>vertical</Layout>
<BackPathHighlighted>style/style_bg_effect2_high</BackPathHighlighted>
<Pos>5,50</Pos>
<Size>495,45</Size>
<Layout>horizontal</Layout>
<Style>QGroupBox {
background: url();
background: Url();
}
</Style>
<Children>
<Template src="skin:effect_parameters.xml">
<SetVariable name="effectnum">1</SetVariable>
</Template>
<Template src="skin:effect_selector_button.xml">
<SetVariable name="Effect">1</SetVariable>
<SetVariable name="effectnum">2</SetVariable>
</Template>
<Template src="skin:effect_parameters.xml">
<SetVariable name="effectnum">2</SetVariable>
</Template>
</Children>
</WidgetGroup>
<Connection>
<BindProperty>highlight</BindProperty>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the whole <Connection> element if it isn't doing anything.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is prepared to take the new CO once your work is merged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, okay. LGTM then as long as it's documented on the wiki. 👍

<Transform>
<IsEqual>2</IsEqual>
</Transform>
</Connection>
</WidgetGroup>
</Children>
</WidgetGroup>
</Children>
Expand Down
Binary file added res/skins/Shade/style/style_bg_effect1_high.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/skins/Shade/style/style_bg_effect2_high.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 11 additions & 9 deletions src/skin/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,25 +610,19 @@ QWidget* LegacySkinParser::parseSplitter(const QDomElement& node) {
return pSplitter;
}

QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
WWidgetGroup* pGroup = new WWidgetGroup(m_pParent);
commonWidgetSetup(node, pGroup);
pGroup->setup(node, *m_pContext);
pGroup->Init();

void LegacySkinParser::parseChildren(
const QDomElement& node,
WWidgetGroup* pGroup) {
QDomNode childrenNode = m_pContext->selectNode(node, "Children");

QWidget* pOldParent = m_pParent;
m_pParent = pGroup;

if (!childrenNode.isNull()) {
// Descend children
QDomNodeList children = childrenNode.childNodes();
for (int i = 0; i < children.count(); ++i) {
QDomNode node = children.at(i);
if (node.isElement()) {
QList<QWidget*> children = parseNode(node.toElement());

foreach (QWidget* pChild, children) {
if (pChild == NULL) {
continue;
Expand All @@ -639,6 +633,14 @@ QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
}
}
m_pParent = pOldParent;
}

QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
WWidgetGroup* pGroup = new WWidgetGroup(m_pParent);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why don't you use unique_ptr? It's generally considered bad practice to use naked new

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We must not mix smart pointers with the Qt object tree, which manages the widget lifetime just right.

This widget is added to the object tree here:
https://github.com/mixxxdj/mixxx/pull/1068/files/9b7ac9a01c34812922b73f48ec328eba820b0433#diff-c2c84548a4801a7ca8649f1095e0bf36L601

Some time ago we have tested the object tree performance versus smart pointer solutions.
The object tree has won.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks I didn't know about that

commonWidgetSetup(node, pGroup);
pGroup->setup(node, *m_pContext);
pGroup->Init();
parseChildren(node, pGroup);
return pGroup;
}

Expand Down
Loading