]> sigrok.org Git - pulseview.git/commitdiff
Remove DecodeStack dependency from decode binding wrapper
authorSoeren Apel <redacted>
Thu, 13 Apr 2017 16:02:20 +0000 (18:02 +0200)
committerSoeren Apel <redacted>
Tue, 4 Jul 2017 21:14:36 +0000 (23:14 +0200)
pv/binding/decoder.cpp
pv/binding/decoder.hpp
pv/data/decodesignal.cpp
pv/data/decodesignal.hpp
pv/views/trace/decodetrace.cpp

index f2e2e1d579f46eabe7b67104de3a103a6647055a..28f42a08b38027ca87a9e42a5c6bec84e31c7a09 100644 (file)
@@ -24,7 +24,7 @@
 #include <boost/none_t.hpp>
 
 #include <pv/data/decode/decoder.hpp>
-#include <pv/data/decoderstack.hpp>
+#include <pv/data/decodesignal.hpp>
 #include <pv/prop/double.hpp>
 #include <pv/prop/enum.hpp>
 #include <pv/prop/int.hpp>
@@ -48,9 +48,9 @@ namespace pv {
 namespace binding {
 
 Decoder::Decoder(
-       shared_ptr<pv::data::DecoderStack> decoder_stack,
+       shared_ptr<pv::data::DecodeSignal> decode_signal,
        shared_ptr<data::decode::Decoder> 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
index bf670403dee317f486c5d43ab093eb74932288fa..a93a057f1a371b8571f19b0cd2808aa11e217b9e 100644 (file)
@@ -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<pv::data::DecoderStack> decoder_stack,
+       Decoder(shared_ptr<pv::data::DecodeSignal> decode_signal,
                shared_ptr<pv::data::decode::Decoder> decoder);
 
 private:
@@ -55,7 +55,7 @@ private:
        void setter(const char *id, Glib::VariantBase value);
 
 private:
-       shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       shared_ptr<pv::data::DecodeSignal> decode_signal_;
        shared_ptr<pv::data::decode::Decoder> decoder_;
 };
 
index 7a4a3d11269d0b22b397099cbf23a563133829cc..a557e1c16ebd601f8d2c65bd189ab544e0250faa 100644 (file)
@@ -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();
index 2f7c273e978bfa2ec09618d89ddb1d273c1be676..cdd061a9769a45484170bd8e69b82a1b131443b7 100644 (file)
@@ -28,6 +28,7 @@
 #include <libsigrokdecode/libsigrokdecode.h>
 
 #include <pv/data/signalbase.hpp>
+#include <pv/util.hpp>
 
 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<data::DecodeChannel> get_channels() const;
index a4628eab9fbfdac55c9125e765f5c6cc0976ebcd..ee9b0ee211472c47347deb84d7b01241db0a056d 100644 (file)
@@ -807,11 +807,9 @@ void DecodeTrace::create_decoder_form(int index,
                        .arg(ch.name, ch.desc, required_flag), hlayout);
        }
 
-       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
-
        // Add the options
        shared_ptr<binding::Decoder> 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);