Skip to content

Commit

Permalink
Update pin connector button's tooltip when channel count changes
Browse files Browse the repository at this point in the history
  • Loading branch information
messmerd committed Dec 15, 2024
1 parent 414e7c9 commit a56520f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/EffectView.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public slots:
Knob * m_gate;
QMdiSubWindow * m_subWindow;
EffectControlDialog * m_controlView;
QPushButton* m_pinConnectorButton = nullptr;
PluginPinConnectorView* m_pinConnectorView = nullptr;

bool m_dragging;
Expand Down
19 changes: 11 additions & 8 deletions src/gui/EffectView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
{
auto ctls_btn = new QPushButton(embed::getIconPixmap("trackop", 20, 20), "", this);
ctls_btn->setToolTip(tr("Controls"));
QFont f = ctls_btn->font();
ctls_btn->setFont(adjustedToPixelSize(f, DEFAULT_FONT_SIZE));
ctls_btn->setGeometry(144, 12, 28, 28);
connect( ctls_btn, SIGNAL(clicked()),
this, SLOT(editControls()));
Expand Down Expand Up @@ -126,12 +124,17 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :

if (auto pc = effect()->pinConnector())
{
auto pcButton = new QPushButton(embed::getIconPixmap("tool", 20, 20), "", this);
pcButton->setToolTip(tr("Pin connector\n%1").arg(pc->getChannelCountText()));
QFont f = pcButton->font();
pcButton->setFont(adjustedToPixelSize(f, DEFAULT_FONT_SIZE));
pcButton->setGeometry(144 + 32, 12, 28, 28);
connect(pcButton, &QPushButton::clicked, this, &EffectView::editPinConnector);
constexpr auto formatString = "Pin connector\n%1";

m_pinConnectorButton = new QPushButton(embed::getIconPixmap("tool", 20, 20), "", this);
m_pinConnectorButton->setToolTip(tr(formatString).arg(pc->getChannelCountText()));

connect(pc, &PluginPinConnector::propertiesChanged, [=, this]() {
m_pinConnectorButton->setToolTip(tr(formatString).arg(effect()->pinConnector()->getChannelCountText()));
});

m_pinConnectorButton->setGeometry(144 + 32, 12, 28, 28);
connect(m_pinConnectorButton, &QPushButton::clicked, this, &EffectView::editPinConnector);
}

m_opacityEffect = new QGraphicsOpacityEffect(this);
Expand Down

0 comments on commit a56520f

Please sign in to comment.