- _trigger_bar = new QToolBar(parent);
- init_trigger_actions(_trigger_bar);
- _trigger_bar->addAction(_trigger_none);
- trig_types =
- Glib::VariantBase::cast_dynamic<Glib::Variant<vector<int32_t>>>(
- gvar).get();
- for (auto type_id : trig_types) {
- auto type = TriggerMatchType::get(type_id);
- _trigger_bar->addAction(match_action(type));
- match_action(type)->setChecked(_trigger_match == type);
+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);