- _trigger_bar = new QToolBar(parent);
- init_trigger_actions(_trigger_bar);
- _trigger_bar->addAction(_trigger_none);
- trig_matches = (const int32_t *)g_variant_get_fixed_array(gvar,
- &num_opts, sizeof(int32_t));
- for (i = 0; i < num_opts; i++) {
- _trigger_bar->addAction(match_action(trig_matches[i]));
- is_checked = _trigger_match == trig_matches[i];
- match_action(trig_matches[i])->setChecked(is_checked);
+void LogicSignal::modify_trigger()
+{
+ auto trigger = session_.session()->trigger();
+ auto new_trigger = session_.device_manager().context()->create_trigger("pulseview");
+
+ if (trigger) {
+ for (auto stage : trigger->stages()) {
+ const auto &matches = stage->matches();
+ if (std::none_of(matches.begin(), matches.end(),
+ [&](shared_ptr<TriggerMatch> match) {
+ return match->channel() != channel_; }))
+ continue;
+
+ auto new_stage = new_trigger->add_stage();
+ for (auto match : stage->matches()) {
+ if (match->channel() == channel_)
+ continue;
+ new_stage->add_match(match->channel(), match->type());
+ }
+ }
+ }
+
+ if (trigger_match_) {
+ // Until we can let the user decide how to group trigger matches
+ // into stages, put all of the matches into a single stage --
+ // most devices only support a single trigger stage.
+ if (new_trigger->stages().empty())
+ new_trigger->add_stage();
+
+ new_trigger->stages().back()->add_match(channel_, trigger_match_);
+ }
+
+ session_.session()->set_trigger(
+ new_trigger->stages().empty() ? nullptr : new_trigger);
+
+ if (owner_)
+ owner_->row_item_appearance_changed(false, true);
+}
+
+const QIcon* LogicSignal::get_icon(const char *path)
+{
+ if (!icon_cache_.contains(path)) {
+ const QIcon *icon = new QIcon(path);
+ icon_cache_.insert(path, icon);
+ }
+
+ return icon_cache_.take(path);
+}
+
+const QPixmap* LogicSignal::get_pixmap(const char *path)
+{
+ if (!pixmap_cache_.contains(path)) {
+ const QPixmap *pixmap = new QPixmap(path);
+ pixmap_cache_.insert(path, pixmap);