Skip to content

Commit

Permalink
handle mode block names in gui
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmales committed Dec 9, 2023
1 parent b532ed9 commit 0d8de59
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gui/widgets/loopCtrl/loopCtrl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ loopCtrl::loopCtrl( std::string & procName,
ui.slider_loop->setup(m_procName, "loop_state", "toggle", "");
ui.slider_loop->setStretch(0,0,10, true, true);

ui.gainCtrl->setup(m_procName, "loop_gain", "Global Gain", -1, -1);
ui.mcCtrl->setup(m_procName, "loop_multcoeff", "Global Mult. Coef.", -1, -1);
ui.gainCtrl->setup(m_procName, "loop_gain", "Gain", -1, -1);
ui.mcCtrl->setup(m_procName, "loop_multcoeff", "Mult. Coef.", -1, -1);
ui.mcCtrl->makeMultCoeffCtrl();

if(m_procName == "loloop") m_gainCtrl = "logainctrl";
Expand Down Expand Up @@ -415,7 +415,7 @@ void loopCtrl::setupBlocks(int nB)
char str[16];
snprintf(str, sizeof(str), "%02d", n);
modeTot += m_modes[n];
m_blockCtrls[n] = new gainCtrl(m_gainCtrl, std::string("block") + str + "_gain", std::string("Block") + str + " Gain", m_modes[n], modeTot);
m_blockCtrls[n] = new gainCtrl(m_gainCtrl, std::string("block") + str + "_gain", "", m_modes[n], modeTot);
ui.horizontalLayout_2->addWidget(m_blockCtrls[n]);
if(m_parent) m_parent->addSubscriber(m_blockCtrls[n]);
}
Expand Down
44 changes: 41 additions & 3 deletions gui/widgets/xWidgets/gainCtrl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,16 @@ void gainCtrl::makeMultCoeffCtrl()

void gainCtrl::subscribe()
{
if(!m_parent) return;
if(!m_parent) return;

if(m_property != "") m_parent->addSubscriberProperty(this, m_device, m_property);
if(m_property != "")
{
m_parent->addSubscriberProperty(this, m_device, m_property);

m_parent->addSubscriber(ui.status);
//m_parent->addSubscriberProperty(this, m_device, m_property + "_name");
}

m_parent->addSubscriber(ui.status);

return;
}
Expand Down Expand Up @@ -234,9 +239,42 @@ void gainCtrl::handleSetProperty( const pcf::IndiProperty & ipRecv)
{
m_target = ipRecv["target"].get<float>();
}

if(m_label == "")
{
m_label = ipRecv.getLabel();

size_t ssp = m_label.find(" Gain");
if(ssp == std::string::npos)
{
ssp = m_label.find(" Mult");
}
if(ssp == std::string::npos)
{
ssp = m_label.find(" Limit");
}

if(ssp == std::string::npos)
{
ui.label->setText(m_label.c_str());
}
else
{
ui.label->setText(m_label.substr(0,ssp).c_str());
}
}
}
}

/*if(ipRecv.getName() == m_property + "_name")
{
if(ipRecv.find("value"))
{
std::cerr << ipRecv["value"].get() << "\n";
ui.label->setText(ipRecv["value"].get().c_str());
}
}*/

updateGUI();

ui.status->handleSetProperty(ipRecv);
Expand Down

0 comments on commit 0d8de59

Please sign in to comment.