]> sigrok.org Git - pulseview.git/commitdiff
Channel popup: Don't disable channels when clicking the enable buttons
authorSoeren Apel <redacted>
Tue, 17 Jul 2018 20:09:51 +0000 (22:09 +0200)
committerUwe Hermann <redacted>
Sat, 21 Jul 2018 16:57:21 +0000 (18:57 +0200)
pv/popups/channels.cpp
pv/popups/channels.hpp

index ce023a8ffdd622d908731cd41c724d4ac3634d91..ffe42fd8ea21717444c6294d5d3d89758d18189f 100644 (file)
@@ -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<bool (const shared_ptr<data::SignalBase>)> 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<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())
index e486768f001e4ad76edef29eb1549d39cde8c79b..344d21a824e7bb79e27bc28f0f44054e78d6b24c 100644 (file)
@@ -71,7 +71,7 @@ public:
 
 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,