|
@@ -76,20 +76,21 @@ struct PlugLight : MultiLightWidget { |
|
|
|
|
|
|
|
|
struct PortWidget::Internal { |
|
|
struct PortWidget::Internal { |
|
|
ui::Tooltip* tooltip = NULL; |
|
|
ui::Tooltip* tooltip = NULL; |
|
|
|
|
|
PlugLight* plugLight; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PortWidget::PortWidget() { |
|
|
PortWidget::PortWidget() { |
|
|
internal = new Internal; |
|
|
internal = new Internal; |
|
|
plugLight = new PlugLight; |
|
|
|
|
|
|
|
|
internal->plugLight = new PlugLight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
PortWidget::~PortWidget() { |
|
|
PortWidget::~PortWidget() { |
|
|
// HACK: In case onDragDrop() is called but not onLeave() afterwards... |
|
|
// HACK: In case onDragDrop() is called but not onLeave() afterwards... |
|
|
destroyTooltip(); |
|
|
destroyTooltip(); |
|
|
// plugLight is not a child and is thus owned by the PortWidget, so we need to delete it here |
|
|
|
|
|
delete plugLight; |
|
|
|
|
|
// HACK |
|
|
|
|
|
|
|
|
// plugLight is not a child but owned by the PortWidget, so we need to delete it here |
|
|
|
|
|
delete internal->plugLight; |
|
|
|
|
|
// The port shouldn't have any cables when destroyed, but just to make sure. |
|
|
if (module) |
|
|
if (module) |
|
|
APP->scene->rack->clearCablesOnPort(this); |
|
|
APP->scene->rack->clearCablesOnPort(this); |
|
|
delete internal; |
|
|
delete internal; |
|
@@ -113,6 +114,10 @@ engine::PortInfo* PortWidget::getPortInfo() { |
|
|
return module->outputInfos[portId]; |
|
|
return module->outputInfos[portId]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LightWidget* PortWidget::getPlugLight() { |
|
|
|
|
|
return internal->plugLight; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void PortWidget::createTooltip() { |
|
|
void PortWidget::createTooltip() { |
|
|
if (!settings::tooltips) |
|
|
if (!settings::tooltips) |
|
|
return; |
|
|
return; |
|
@@ -145,7 +150,7 @@ void PortWidget::step() { |
|
|
else |
|
|
else |
|
|
values[i] = module->inputs[portId].plugLights[i].getBrightness(); |
|
|
values[i] = module->inputs[portId].plugLights[i].getBrightness(); |
|
|
} |
|
|
} |
|
|
plugLight->setBrightnesses(values); |
|
|
|
|
|
|
|
|
internal->plugLight->setBrightnesses(values); |
|
|
|
|
|
|
|
|
Widget::step(); |
|
|
Widget::step(); |
|
|
} |
|
|
} |
|
|