- Signal(session, probe),
- _data(data),
- _separator(this),
- _icon_trigger_none(":/icons/trigger-none.svg"),
- _trigger_none(_icon_trigger_none, tr("No trigger"), this),
- _icon_trigger_rising(":/icons/trigger-rising.svg"),
- _trigger_rising(_icon_trigger_rising,
- tr("Trigger on rising edge"), this),
- _icon_trigger_high(":/icons/trigger-high.svg"),
- _trigger_high(_icon_trigger_high,
- tr("Trigger on high level"), this),
- _icon_trigger_falling(":/icons/trigger-falling.svg"),
- _trigger_falling(_icon_trigger_falling,
- tr("Trigger on falling edge"), this),
- _icon_trigger_low(":/icons/trigger-low.svg"),
- _trigger_low(_icon_trigger_low,
- tr("Trigger on low level"), this),
- _icon_trigger_change(":/icons/trigger-change.svg"),
- _trigger_change(_icon_trigger_change,
- tr("Trigger on rising or falling edge"), this)
-{
- _colour = SignalColours[probe->index % countof(SignalColours)];
-
- _separator.setSeparator(true);
-}
-
-LogicSignal::~LogicSignal()
-{
-}
-
-const list<QAction*> LogicSignal::get_context_bar_actions()
-{
- GVariant *gvar;
- list<QAction*> actions;
-
- actions.push_back(&_name_action);
-
- // Add the trigger actions
- const sr_dev_inst *const sdi = _session.get_device();
- if (sr_config_list(sdi->driver, SR_CONF_TRIGGER_TYPE,
- &gvar, sdi) == SR_OK) {
- const char *const trig_types =
- g_variant_get_string(gvar, NULL);
-
- if (trig_types && trig_types[0] != '\0') {
- actions.push_back(&_separator);
-
- actions.push_back(&_trigger_none);
-
- add_trigger_action(trig_types, 'r',
- &_trigger_rising, actions);
- add_trigger_action(trig_types, '1',
- &_trigger_high, actions);
- add_trigger_action(trig_types, 'f',
- &_trigger_falling, actions);
- add_trigger_action(trig_types, '0',
- &_trigger_low, actions);
- add_trigger_action(trig_types, 'c',
- &_trigger_change, actions);
- }
+ Signal(session, channel),
+ signal_height_(QFontMetrics(QApplication::font()).height() * 2),
+ device_(device),
+ data_(data),
+ trigger_none_(nullptr),
+ trigger_rising_(nullptr),
+ trigger_high_(nullptr),
+ trigger_falling_(nullptr),
+ trigger_low_(nullptr),
+ trigger_change_(nullptr)
+{
+ shared_ptr<Trigger> trigger;
+
+ set_colour(SignalColours[channel->index() % countof(SignalColours)]);
+
+ /* Populate this channel's trigger setting with whatever we
+ * find in the current session trigger, if anything. */
+ trigger_match_ = nullptr;
+ if ((trigger = session_.session()->trigger()))
+ for (auto stage : trigger->stages())
+ for (auto match : stage->matches())
+ if (match->channel() == channel_)
+ trigger_match_ = match->type();
+}