X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Flogicsignal.cpp;h=7bb2ee0caebaa9803e51f56af205d80520491e21;hp=5584a1fcb70a0fb334e85b2d2165a6b965efabfe;hb=bf0edd2b0cbb5f4bd5d69b0f00bcea7d037e2287;hpb=c6246dc56ed01d7e99aa65ab88b8c191300b1ebd diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 5584a1f..7bb2ee0 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,6 @@ using std::pair; using std::shared_ptr; using std::vector; -using sigrok::Channel; using sigrok::ConfigKey; using sigrok::Capability; using sigrok::Error; @@ -99,7 +99,7 @@ QCache LogicSignal::pixmap_cache_; LogicSignal::LogicSignal( pv::Session &session, shared_ptr device, - shared_ptr channel, + shared_ptr channel, shared_ptr data) : Signal(session, channel), signal_height_(QFontMetrics(QApplication::font()).height() * 2), @@ -114,7 +114,7 @@ LogicSignal::LogicSignal( { shared_ptr trigger; - set_colour(SignalColours[channel->index() % countof(SignalColours)]); + channel_->set_colour(SignalColours[channel->index() % countof(SignalColours)]); /* Populate this channel's trigger setting with whatever we * find in the current session trigger, if anything. */ @@ -122,7 +122,7 @@ LogicSignal::LogicSignal( if ((trigger = session_.session()->trigger())) for (auto stage : trigger->stages()) for (auto match : stage->matches()) - if (match->channel() == channel_) + if (match->channel() == channel_->channel()) trigger_match_ = match->type(); } @@ -332,8 +332,20 @@ const vector LogicSignal::get_trigger_types() const if (sr_dev->config_check(ConfigKey::TRIGGER_MATCH, Capability::LIST)) { const Glib::VariantContainerBase gvar = sr_dev->config_list(ConfigKey::TRIGGER_MATCH); - return Glib::VariantBase::cast_dynamic< - Glib::Variant>>(gvar).get(); + + vector ttypes; + + for (unsigned int i = 0; i < gvar.get_n_children(); i++) { + Glib::VariantBase tmp_vb; + gvar.get_child(tmp_vb, i); + + Glib::Variant tmp_v = + Glib::VariantBase::cast_dynamic< Glib::Variant >(tmp_vb); + + ttypes.push_back(tmp_v.get()); + } + + return ttypes; } else { return vector(); } @@ -418,12 +430,12 @@ void LogicSignal::modify_trigger() const auto &matches = stage->matches(); if (std::none_of(matches.begin(), matches.end(), [&](shared_ptr match) { - return match->channel() != channel_; })) + return match->channel() != channel_->channel(); })) continue; auto new_stage = new_trigger->add_stage(); for (auto match : stage->matches()) { - if (match->channel() == channel_) + if (match->channel() == channel_->channel()) continue; new_stage->add_match(match->channel(), match->type()); } @@ -437,7 +449,8 @@ void LogicSignal::modify_trigger() if (new_trigger->stages().empty()) new_trigger->add_stage(); - new_trigger->stages().back()->add_match(channel_, trigger_match_); + new_trigger->stages().back()->add_match(channel_->channel(), + trigger_match_); } session_.session()->set_trigger( @@ -449,24 +462,22 @@ void LogicSignal::modify_trigger() const QIcon* LogicSignal::get_icon(const char *path) { - const QIcon *icon = icon_cache_.take(path); - if (!icon) { - icon = new QIcon(path); + if (!icon_cache_.contains(path)) { + const QIcon *icon = new QIcon(path); icon_cache_.insert(path, icon); } - return icon; + return icon_cache_.take(path); } const QPixmap* LogicSignal::get_pixmap(const char *path) { - const QPixmap *pixmap = pixmap_cache_.take(path); - if (!pixmap) { - pixmap = new QPixmap(path); + if (!pixmap_cache_.contains(path)) { + const QPixmap *pixmap = new QPixmap(path); pixmap_cache_.insert(path, pixmap); } - return pixmap; + return pixmap_cache_.take(path); } void LogicSignal::on_trigger()