updating_channels_ = false;
}
-void Channels::set_all_channels_conditionally(
+void Channels::enable_channels_conditionally(
function<bool (const shared_ptr<data::SignalBase>)> cond_func)
{
updating_channels_ = true;
assert(sig);
const bool state = cond_func(sig);
- sig->set_enabled(state);
- cb->setChecked(state);
+ if (state) {
+ sig->set_enabled(state);
+ cb->setChecked(state);
+ }
}
updating_channels_ = false;
void Channels::enable_all_logic_channels()
{
- set_all_channels_conditionally([](const shared_ptr<SignalBase> signal)
+ enable_channels_conditionally([](const shared_ptr<SignalBase> signal)
{ return signal->type() == SignalBase::LogicChannel; });
}
void Channels::enable_all_analog_channels()
{
- set_all_channels_conditionally([](const shared_ptr<SignalBase> signal)
+ enable_channels_conditionally([](const shared_ptr<SignalBase> signal)
{ return signal->type() == SignalBase::AnalogChannel; });
}
void Channels::enable_all_named_channels()
{
- set_all_channels_conditionally([](const shared_ptr<SignalBase> signal)
+ enable_channels_conditionally([](const shared_ptr<SignalBase> signal)
{ return signal->name() != signal->internal_name(); });
}
void Channels::enable_all_changing_channels()
{
- set_all_channels_conditionally([](const shared_ptr<SignalBase> signal)
+ enable_channels_conditionally([](const shared_ptr<SignalBase> signal)
{
// Never enable channels without sample data
if (!signal->has_samples())
private:
void set_all_channels(bool set);
- void set_all_channels_conditionally(
+ void enable_channels_conditionally(
function<bool (const shared_ptr<data::SignalBase>)> cond_func);
void populate_group(shared_ptr<sigrok::ChannelGroup> group,