X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fpopups%2Fchannels.cpp;h=ce023a8ffdd622d908731cd41c724d4ac3634d91;hb=9cca8508357758b6ee68f25c998bf4de8822df14;hp=99e6376aeb5aa70351494de00238645125b061b5;hpb=5b35d18ccf2e5a8949d1b4b37d06bf527480e547;p=pulseview.git diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index 99e6376a..ce023a8f 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -19,9 +19,12 @@ #include +#include #include +#include #include #include +#include #include #include "channels.hpp" @@ -55,12 +58,12 @@ Channels::Channels(Session &session, QWidget *parent) : Popup(parent), session_(session), updating_channels_(false), - enable_all_channels_(tr("Enable All"), this), - disable_all_channels_(tr("Disable All"), this), - enable_all_logic_channels_(tr("Enable only logic"), this), - enable_all_analog_channels_(tr("Enable only analog"), this), - enable_all_named_channels_(tr("Enable only named"), this), - enable_all_changing_channels_(tr("Enable only changing"), this), + enable_all_channels_(tr("All"), this), + disable_all_channels_(tr("All"), this), + enable_all_logic_channels_(tr("Logic"), this), + enable_all_analog_channels_(tr("Analog"), this), + enable_all_named_channels_(tr("Named"), this), + enable_all_changing_channels_(tr("Changing"), this), check_box_mapper_(this) { // Create the layout @@ -98,16 +101,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())); @@ -118,20 +128,17 @@ Channels::Channels(Session &session, QWidget *parent) : connect(&enable_all_changing_channels_, SIGNAL(clicked()), this, SLOT(enable_all_changing_channels())); - enable_all_channels_.setFlat(true); - disable_all_channels_.setFlat(true); - enable_all_logic_channels_.setFlat(true); - enable_all_analog_channels_.setFlat(true); - enable_all_named_channels_.setFlat(true); - enable_all_changing_channels_.setFlat(true); - - buttons_bar_.addWidget(&enable_all_channels_); + QLabel *label1 = new QLabel(tr("Disable: ")); + buttons_bar_.addWidget(label1); buttons_bar_.addWidget(&disable_all_channels_); + QLabel *label2 = new QLabel(tr("Enable: ")); + buttons_bar_.addWidget(label2); + buttons_bar_.addWidget(&enable_all_channels_); buttons_bar_.addWidget(&enable_all_logic_channels_); buttons_bar_.addWidget(&enable_all_analog_channels_); buttons_bar_.addWidget(&enable_all_named_channels_); buttons_bar_.addWidget(&enable_all_changing_channels_); - buttons_bar_.addStretch(1); + buttons_bar_.addStretch(); layout_.addRow(&buttons_bar_); @@ -316,6 +323,10 @@ void Channels::enable_all_changing_channels() { set_all_channels_conditionally([](const shared_ptr signal) { + // Never enable channels without sample data + if (!signal->has_samples()) + return false; + // Non-logic channels are considered to always have a signal if (signal->type() != SignalBase::LogicChannel) return true;