From: Soeren Apel Date: Thu, 13 Apr 2017 16:02:20 +0000 (+0200) Subject: Remove DecodeStack dependency from decode binding wrapper X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=946b52e1f0e0520415c3653cc6ea9d083718f76d;p=pulseview.git Remove DecodeStack dependency from decode binding wrapper --- diff --git a/pv/binding/decoder.cpp b/pv/binding/decoder.cpp index f2e2e1d5..28f42a08 100644 --- a/pv/binding/decoder.cpp +++ b/pv/binding/decoder.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -48,9 +48,9 @@ namespace pv { namespace binding { Decoder::Decoder( - shared_ptr decoder_stack, + shared_ptr decode_signal, shared_ptr decoder) : - decoder_stack_(decoder_stack), + decode_signal_(decode_signal), decoder_(decoder) { assert(decoder_); @@ -137,8 +137,8 @@ void Decoder::setter(const char *id, Glib::VariantBase value) assert(decoder_); decoder_->set_option(id, value.gobj()); - assert(decoder_stack_); - decoder_stack_->begin_decode(); + assert(decode_signal_); + decode_signal_->begin_decode(); } } // namespace binding diff --git a/pv/binding/decoder.hpp b/pv/binding/decoder.hpp index bf670403..a93a057f 100644 --- a/pv/binding/decoder.hpp +++ b/pv/binding/decoder.hpp @@ -31,7 +31,7 @@ struct srd_decoder_option; namespace pv { namespace data { -class DecoderStack; +class DecodeSignal; namespace decode { class Decoder; } @@ -42,7 +42,7 @@ namespace binding { class Decoder : public Binding { public: - Decoder(shared_ptr decoder_stack, + Decoder(shared_ptr decode_signal, shared_ptr decoder); private: @@ -55,7 +55,7 @@ private: void setter(const char *id, Glib::VariantBase value); private: - shared_ptr decoder_stack_; + shared_ptr decode_signal_; shared_ptr decoder_; }; diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 7a4a3d11..a557e1c1 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -110,6 +110,11 @@ bool DecodeSignal::toggle_decoder_visibility(int index) return state; } +void DecodeSignal::begin_decode() +{ + decoder_stack_->begin_decode(); +} + QString DecodeSignal::error_message() const { return decoder_stack_->error_message(); diff --git a/pv/data/decodesignal.hpp b/pv/data/decodesignal.hpp index 2f7c273e..cdd061a9 100644 --- a/pv/data/decodesignal.hpp +++ b/pv/data/decodesignal.hpp @@ -28,6 +28,7 @@ #include #include +#include using std::list; using std::unordered_set; @@ -76,6 +77,7 @@ public: void remove_decoder(int index); bool toggle_decoder_visibility(int index); + void begin_decode(); QString error_message() const; const list get_channels() const; diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index a4628eab..ee9b0ee2 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -807,11 +807,9 @@ void DecodeTrace::create_decoder_form(int index, .arg(ch.name, ch.desc, required_flag), hlayout); } - shared_ptr decoder_stack = base_->decoder_stack(); - // Add the options shared_ptr binding( - new binding::Decoder(decoder_stack, dec)); + new binding::Decoder(decode_signal_, dec)); binding->add_properties_to_form(decoder_form, true); bindings_.push_back(binding);