From: Soeren Apel Date: Sun, 15 Apr 2018 06:19:42 +0000 (+0200) Subject: Channels: Break up logic and analog channels into separate grids X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3b6c4a1fe75289e56be6bc2a5d1b9e24ccdd1744;p=pulseview.git Channels: Break up logic and analog channels into separate grids 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 --- diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index fdb97728..cbe9a2a2 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -100,16 +100,23 @@ Channels::Channels(Session &session, QWidget *parent) : } // Make a vector of the remaining channels - vector< shared_ptr > global_sigs; + vector< shared_ptr > global_analog_sigs, global_logic_sigs; for (auto channel : device->channels()) { const map, shared_ptr >:: 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 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()));