X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.cpp;h=07917e582ff2846d537fecaf755dfa4e125daae7;hp=516e1acd5ad6ff1e6b52a277f97c042e28e37872;hb=132a5c6d4b3c220d1cb6d942bf9d7e8b180ab1c3;hpb=724f29f311db4f8b47169e58f3f3b50e6a50ed08 diff --git a/pv/session.cpp b/pv/session.cpp index 516e1acd..07917e58 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -53,6 +53,7 @@ #ifdef ENABLE_DECODE #include +#include "data/decodesignal.hpp" #endif using std::bad_alloc; @@ -437,10 +438,10 @@ void Session::set_default_device() /** * Convert generic options to data types that are specific to InputFormat. * - * @param[in] user_spec vector of tokenized words, string format - * @param[in] fmt_opts input format's options, result of InputFormat::options() + * @param[in] user_spec Vector of tokenized words, string format. + * @param[in] fmt_opts Input format's options, result of InputFormat::options(). * - * @return map of options suitable for InputFormat::create_input() + * @return Map of options suitable for InputFormat::create_input(). */ map Session::input_format_options(vector user_spec, @@ -664,37 +665,19 @@ bool Session::add_decoder(srd_decoder *const dec) // Create the decoder decoder_stack = make_shared(*this, dec); - // Make a list of all the channels - vector all_channels; - for (const GSList *i = dec->channels; i; i = i->next) - all_channels.push_back((const srd_channel*)i->data); - for (const GSList *i = dec->opt_channels; i; i = i->next) - all_channels.push_back((const srd_channel*)i->data); - - // Auto select the initial channels - for (const srd_channel *pdch : all_channels) - for (shared_ptr b : signalbases_) { - if (b->logic_data()) { - if (QString::fromUtf8(pdch->name).toLower(). - contains(b->name().toLower())) - channels[pdch] = b; - } - } - assert(decoder_stack); assert(!decoder_stack->stack().empty()); assert(decoder_stack->stack().front()); decoder_stack->stack().front()->set_channels(channels); // Create the decode signal - shared_ptr signalbase = - make_shared(nullptr, data::SignalBase::DecodeChannel); + shared_ptr signal = + make_shared(decoder_stack, signalbases_); - signalbase->set_decoder_stack(decoder_stack); - signalbases_.insert(signalbase); + signalbases_.insert(signal); for (shared_ptr view : views_) - view->add_decode_signal(signalbase); + view->add_decode_signal(signal); } catch (runtime_error e) { return false; } @@ -707,12 +690,12 @@ bool Session::add_decoder(srd_decoder *const dec) return true; } -void Session::remove_decode_signal(shared_ptr signalbase) +void Session::remove_decode_signal(shared_ptr signal) { - signalbases_.erase(signalbase); + signalbases_.erase(signal); for (shared_ptr view : views_) - view->remove_decode_signal(signalbase); + view->remove_decode_signal(signal); signals_changed(); }