blob: 9d2121ff24e88bc749c16308ba4028ee392da9df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <QtDebug>
#include "widget/weffectchain.h"
#include "effects/effectsmanager.h"
#include "widget/effectwidgetutils.h"
WEffectChain::WEffectChain(QWidget* pParent, EffectsManager* pEffectsManager)
: WLabel(pParent),
m_pEffectsManager(pEffectsManager) {
chainUpdated();
}
void WEffectChain::setup(const QDomNode& node, const SkinContext& context) {
WLabel::setup(node, context);
// EffectWidgetUtils propagates NULLs so this is all safe.
EffectRackPointer pRack = EffectWidgetUtils::getEffectRackFromNode(
node, context, m_pEffectsManager);
EffectChainSlotPointer pChainSlot = EffectWidgetUtils::getEffectChainSlotFromNode(
node, context, pRack);
if (pChainSlot) {
setEffectChainSlot(pChainSlot);
} else {
SKIN_WARNING(node, context)
<< "EffectChain node could not attach to effect chain slot.";
}
}
void WEffectChain::setEffectChainSlot(EffectChainSlotPointer pEffectChainSlot) {
if (pEffectChainSlot) {
m_pEffectChainSlot = pEffectChainSlot;
connect(pEffectChainSlot.data(),
&EffectChainSlot::updated,
this,
&WEffectChain::chainUpdated);
chainUpdated();
}
}
void WEffectChain::chainUpdated() {
QString name = tr("None");
QString description = tr("No effect chain loaded.");
if (m_pEffectChainSlot) {
EffectChainPointer pChain = m_pEffectChainSlot->getEffectChain();
if (pChain) {
name = pChain->name();
description = pChain->description();
}
}
setText(name);
setBaseTooltip(description);
}
|