_session(session),
_layout(this),
_probes(this),
+ _updating_probes(false),
_probes_bar(this),
_enable_all_probes(this),
_disable_all_probes(this)
_layout.addWidget(&_probes_bar);
+ connect(&_probes, SIGNAL(itemChanged(QListWidgetItem*)),
+ this, SLOT(item_changed(QListWidgetItem*)));
+}
+
+void Probes::set_all_probes(bool set)
+{
+ using pv::view::Signal;
+
+ _updating_probes = true;
+
const vector< shared_ptr<pv::view::Signal> > sigs =
_session.get_signals();
for (unsigned int i = 0; i < sigs.size(); i++)
{
const shared_ptr<pv::view::Signal> &s = sigs[i];
assert(s);
- QListWidgetItem *const item = new QListWidgetItem(
- s->get_name(), &_probes);
+ s->enable(set);
+
+ QListWidgetItem *const item = _probes.item(i);
assert(item);
- item->setData(UserRole, qVariantFromValue(i));
- item->setCheckState(s->enabled() ? Checked : Unchecked);
- _probes.addItem(item);
+ item->setCheckState(set ? Qt::Checked : Qt::Unchecked);
}
- connect(&_probes, SIGNAL(itemChanged(QListWidgetItem*)),
- this, SLOT(item_changed(QListWidgetItem*)));
+ _updating_probes = false;
}
-void Probes::set_all_probes(bool set)
+void Probes::showEvent(QShowEvent *e)
{
- using pv::view::Signal;
+ pv::widgets::Popup::showEvent(e);
+
+ _updating_probes = true;
+
+ _probes.clear();
const vector< shared_ptr<pv::view::Signal> > sigs =
_session.get_signals();
{
const shared_ptr<pv::view::Signal> &s = sigs[i];
assert(s);
- s->enable(set);
-
- QListWidgetItem *const item = _probes.item(i);
+ QListWidgetItem *const item = new QListWidgetItem(
+ s->get_name(), &_probes);
assert(item);
- item->setCheckState(set ? Qt::Checked : Qt::Unchecked);
+ item->setCheckState(s->enabled() ? Checked : Unchecked);
+ item->setData(UserRole, qVariantFromValue(i));
+ _probes.addItem(item);
}
+
+ _updating_probes = false;
}
void Probes::item_changed(QListWidgetItem *item)
{
using pv::view::Signal;
+ if (_updating_probes)
+ return;
+
assert(item);
const vector< shared_ptr<pv::view::Signal> > sigs =
_session.get_signals();
_updating_device_selector(false),
_configure_button(this),
_probes_button(this),
+ _probes_popup(_session, this),
_record_length_selector(this),
_sample_rate_list(this),
_icon_red(":/icons/status-red.svg"),
_configure_button.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/configure.png")));
+
_probes_button.setIcon(QIcon::fromTheme("probes",
QIcon(":/icons/probes.svg")));
+ _probes_button.set_popup(&_probes_popup);
_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_updating_device_selector = false;
- update_sample_rate_selector();
+ on_device_selected();
}
struct sr_dev_inst* SamplingBar::get_selected_device() const
_session.set_device(sdi);
_configure_button.set_popup(new DeviceOptions(sdi, this));
- _probes_button.set_popup(new Probes(_session, this));
}
void SamplingBar::on_sample_rate_changed()