]> sigrok.org Git - pulseview.git/commitdiff
Channels: Break up logic and analog channels into separate grids
authorSoeren Apel <redacted>
Sun, 15 Apr 2018 06:19:42 +0000 (08:19 +0200)
committerSoeren Apel <redacted>
Sun, 15 Apr 2018 06:19:42 +0000 (08:19 +0200)
This way, a named analog channel (e.g. "SDA analog") won't visually disturb
the alignment of the logic channels if there are only ungrouped channels.

To see this change in effect, you may compare using sainsmart_dds120_powerup_scl_analog.sr

pv/popups/channels.cpp

index fdb97728f59fe080506c81ecd9acbae0039f3d6d..cbe9a2a2eb4fd7bd6b0ddb828739381261c5b597 100644 (file)
@@ -100,16 +100,23 @@ Channels::Channels(Session &session, QWidget *parent) :
        }
 
        // Make a vector of the remaining channels
-       vector< shared_ptr<SignalBase> > global_sigs;
+       vector< shared_ptr<SignalBase> > global_analog_sigs, global_logic_sigs;
        for (auto channel : device->channels()) {
                const map<shared_ptr<Channel>, shared_ptr<SignalBase> >::
                        const_iterator iter = signal_map.find(channel);
-               if (iter != signal_map.end())
-                       global_sigs.push_back((*iter).second);
+
+               if (iter != signal_map.end()) {
+                       const shared_ptr<SignalBase> signal = (*iter).second;
+                       if (signal->type() == SignalBase::AnalogChannel)
+                               global_analog_sigs.push_back(signal);
+                       else
+                               global_logic_sigs.push_back(signal);
+               }
        }
 
-       // Create a group
-       populate_group(nullptr, global_sigs);
+       // Create the groups for the ungrouped channels
+       populate_group(nullptr, global_logic_sigs);
+       populate_group(nullptr, global_analog_sigs);
 
        // Create the enable/disable all buttons
        connect(&enable_all_channels_, SIGNAL(clicked()), this, SLOT(enable_all_channels()));