+void Probes::populate_group(const sr_channel_group *group,
+ const vector< shared_ptr<pv::view::Signal> > sigs)
+{
+ using pv::prop::binding::DeviceOptions;
+
+ // Only bind options if this is a group. We don't do it for general
+ // options, because these properties are shown in the device config
+ // popup.
+ shared_ptr<DeviceOptions> binding;
+ if (group)
+ binding = shared_ptr<DeviceOptions>(new DeviceOptions(
+ _session.get_device(), group));
+
+ // Create a title if the group is going to have any content
+ if ((!sigs.empty() || (binding && !binding->properties().empty())) &&
+ group && group->name)
+ _layout.addRow(new QLabel(
+ QString("<h3>%1</h3>").arg(group->name)));
+
+ // Create the channel group grid
+ QGridLayout *const probe_grid =
+ create_channel_group_grid(sigs);
+ _layout.addRow(probe_grid);
+
+ // Create the channel group options
+ if (binding)
+ {
+ binding->add_properties_to_form(&_layout, true);
+ _group_bindings.push_back(binding);
+ }
+}
+
+QGridLayout* Probes::create_channel_group_grid(
+ const vector< shared_ptr<pv::view::Signal> > sigs)
+{
+ int row = 0, col = 0;
+ QGridLayout *const grid = new QGridLayout();
+
+ for (const shared_ptr<pv::view::Signal>& sig : sigs)
+ {
+ assert(sig);
+
+ QCheckBox *const checkbox = new QCheckBox(sig->get_name());
+ _check_box_mapper.setMapping(checkbox, checkbox);
+ connect(checkbox, SIGNAL(toggled(bool)),
+ &_check_box_mapper, SLOT(map()));
+
+ grid->addWidget(checkbox, row, col);
+
+ _check_box_signal_map[checkbox] = sig;
+
+ if(++col >= 8)
+ col = 0, row++;
+ }
+
+ return grid;
+}
+