]> sigrok.org Git - pulseview.git/blobdiff - pv/popups/probes.cpp
Update for 'probe_group' -> 'channel_group' rename in libsigrok.
[pulseview.git] / pv / popups / probes.cpp
index 3fffec310fa79378c233a333aa27f52349accd66..2e1e59249b746b3cc86adc50a1e9e6b2af4708f0 100644 (file)
 
 #include <map>
 
+#include <boost/foreach.hpp>
+
+#include <QCheckBox>
 #include <QFormLayout>
 #include <QGridLayout>
+#include <QLabel>
 
 #include "probes.h"
 
+#include <pv/device/devinst.h>
 #include <pv/prop/binding/deviceoptions.h>
 #include <pv/sigsession.h>
 #include <pv/view/signal.h>
@@ -44,17 +49,17 @@ namespace popups {
 Probes::Probes(SigSession &session, QWidget *parent) :
        Popup(parent),
        _session(session),
-       _layout(this),
        _updating_probes(false),
-       _probes_bar(this),
-       _enable_all_probes(this),
-       _disable_all_probes(this),
+       _enable_all_probes(tr("Enable All"), this),
+       _disable_all_probes(tr("Disable All"), this),
        _check_box_mapper(this)
 {
        // Create the layout
        setLayout(&_layout);
 
-       sr_dev_inst *const sdi = _session.get_device();
+       shared_ptr<device::DevInst> dev_inst = _session.get_device();
+       assert(dev_inst);
+       const sr_dev_inst *const sdi = dev_inst->dev_inst();
        assert(sdi);
 
        // Collect a set of signals
@@ -63,11 +68,11 @@ Probes::Probes(SigSession &session, QWidget *parent) :
        BOOST_FOREACH(const shared_ptr<Signal> &sig, sigs)
                signal_map[sig->probe()] = sig;
 
-       // Populate probe groups
-       for (const GSList *g = sdi->probe_groups; g; g = g->next)
+       // Populate channel groups
+       for (const GSList *g = sdi->channel_groups; g; g = g->next)
        {
-               const sr_probe_group *const group =
-                       (const sr_probe_group*)g->data;
+               const sr_channel_group *const group =
+                       (const sr_channel_group*)g->data;
                assert(group);
 
                // Make a set of signals, and removed this signals from the
@@ -111,13 +116,14 @@ Probes::Probes(SigSession &session, QWidget *parent) :
        connect(&_disable_all_probes, SIGNAL(clicked()),
                this, SLOT(disable_all_probes()));
 
-       _enable_all_probes.setText(tr("Enable All"));
-       _probes_bar.addWidget(&_enable_all_probes);
+       _enable_all_probes.setFlat(true);
+       _disable_all_probes.setFlat(true);
 
-       _disable_all_probes.setText(tr("Disable All"));
-       _probes_bar.addWidget(&_disable_all_probes);
+       _buttons_bar.addWidget(&_enable_all_probes);
+       _buttons_bar.addWidget(&_disable_all_probes);
+       _buttons_bar.addStretch(1);
 
-       _layout.addRow(&_probes_bar);
+       _layout.addRow(&_buttons_bar);
 
        // Connect the check-box signal mapper
        connect(&_check_box_mapper, SIGNAL(mapped(QWidget*)),
@@ -142,7 +148,7 @@ void Probes::set_all_probes(bool set)
        _updating_probes = false;
 }
 
-void Probes::populate_group(const sr_probe_group *group,
+void Probes::populate_group(const sr_channel_group *group,
        const vector< shared_ptr<pv::view::Signal> > sigs)
 {
        using pv::prop::binding::DeviceOptions;
@@ -161,12 +167,12 @@ void Probes::populate_group(const sr_probe_group *group,
                _layout.addRow(new QLabel(
                        QString("<h3>%1</h3>").arg(group->name)));
 
-       // Create the probe group grid
+       // Create the channel group grid
        QGridLayout *const probe_grid =
-               create_probe_group_grid(sigs);
+               create_channel_group_grid(sigs);
        _layout.addRow(probe_grid);
 
-       // Create the probe group options
+       // Create the channel group options
        if (binding)
        {
                binding->add_properties_to_form(&_layout, true);
@@ -174,7 +180,7 @@ void Probes::populate_group(const sr_probe_group *group,
        }
 }
 
-QGridLayout* Probes::create_probe_group_grid(
+QGridLayout* Probes::create_channel_group_grid(
        const vector< shared_ptr<pv::view::Signal> > sigs)
 {
        int row = 0, col = 0;