const uint64_t SamplingBar::DefaultRecordLength = 1000000;
-SamplingBar::SamplingBar(QWidget *parent) :
+SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
QToolBar("Sampling Bar", parent),
+ _session(session),
_device_selector(this),
+ _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);
void SamplingBar::set_device_list(
const std::list<struct sr_dev_inst*> &devices)
{
+ _updating_device_selector = true;
+
_device_selector.clear();
BOOST_FOREACH (sr_dev_inst *sdi, devices) {
qVariantFromValue((void*)sdi));
}
- update_sample_rate_selector();
+ _updating_device_selector = false;
+
+ on_device_selected();
}
struct sr_dev_inst* SamplingBar::get_selected_device() const
{
using namespace pv::popups;
+ if (_updating_device_selector)
+ return;
+
update_sample_rate_selector();
sr_dev_inst *const sdi = get_selected_device();
+ _session.set_device(sdi);
_configure_button.set_popup(new DeviceOptions(sdi, this));
- _probes_button.set_popup(new Probes(sdi, this));
-
- device_selected();
}
void SamplingBar::on_sample_rate_changed()