From: Soeren Apel Date: Tue, 17 Jul 2018 20:09:51 +0000 (+0200) Subject: Channel popup: Don't disable channels when clicking the enable buttons X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7ceb2376de956f72e2055467efe0a16a68da4bd8;p=pulseview.git Channel popup: Don't disable channels when clicking the enable buttons --- diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index ce023a8f..ffe42fd8 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -163,7 +163,7 @@ void Channels::set_all_channels(bool set) updating_channels_ = false; } -void Channels::set_all_channels_conditionally( +void Channels::enable_channels_conditionally( function)> cond_func) { updating_channels_ = true; @@ -174,8 +174,10 @@ void Channels::set_all_channels_conditionally( 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; @@ -303,25 +305,25 @@ void Channels::disable_all_channels() void Channels::enable_all_logic_channels() { - set_all_channels_conditionally([](const shared_ptr signal) + enable_channels_conditionally([](const shared_ptr signal) { return signal->type() == SignalBase::LogicChannel; }); } void Channels::enable_all_analog_channels() { - set_all_channels_conditionally([](const shared_ptr signal) + enable_channels_conditionally([](const shared_ptr signal) { return signal->type() == SignalBase::AnalogChannel; }); } void Channels::enable_all_named_channels() { - set_all_channels_conditionally([](const shared_ptr signal) + enable_channels_conditionally([](const shared_ptr signal) { return signal->name() != signal->internal_name(); }); } void Channels::enable_all_changing_channels() { - set_all_channels_conditionally([](const shared_ptr signal) + enable_channels_conditionally([](const shared_ptr signal) { // Never enable channels without sample data if (!signal->has_samples()) diff --git a/pv/popups/channels.hpp b/pv/popups/channels.hpp index e486768f..344d21a8 100644 --- a/pv/popups/channels.hpp +++ b/pv/popups/channels.hpp @@ -71,7 +71,7 @@ public: private: void set_all_channels(bool set); - void set_all_channels_conditionally( + void enable_channels_conditionally( function)> cond_func); void populate_group(shared_ptr group,