- // Add the trigger actions
- const sr_dev_inst *const sdi = _session.get_device();
- if (sr_config_list(sdi->driver, sdi, NULL, SR_CONF_TRIGGER_TYPE,
- &gvar) == SR_OK)
- {
- const char *const trig_types =
- g_variant_get_string(gvar, NULL);
-
- if (trig_types && trig_types[0] != '\0')
- {
- _trigger_bar = new QToolBar(parent);
-
- init_trigger_actions(_trigger_bar);
- _trigger_bar->addAction(_trigger_none);
- add_trigger_action(trig_types, 'r', _trigger_rising);
- add_trigger_action(trig_types, '1', _trigger_high);
- add_trigger_action(trig_types, 'f', _trigger_falling);
- add_trigger_action(trig_types, '0', _trigger_low);
- add_trigger_action(trig_types, 'c', _trigger_change);
-
- update_trigger_actions();
-
- form->addRow(tr("Trigger"), _trigger_bar);
+ action = _trigger_none;
+ if (type) {
+ switch (type->id()) {
+ case SR_TRIGGER_ZERO:
+ action = _trigger_low;
+ break;
+ case SR_TRIGGER_ONE:
+ action = _trigger_high;
+ break;
+ case SR_TRIGGER_RISING:
+ action = _trigger_rising;
+ break;
+ case SR_TRIGGER_FALLING:
+ action = _trigger_falling;
+ break;
+ case SR_TRIGGER_EDGE:
+ action = _trigger_change;
+ break;
+ default:
+ assert(0);