From 8bd26d8b9c831b509ee3241ea4dac6f50c023622 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sat, 5 Apr 2014 14:00:56 +0200 Subject: [PATCH] Rename 'probe' to 'channel' (libsigrokdecode change). Variables of type 'struct srd_channel *' are consistently named 'pdch' to make them easily distinguishable from libsigrok's 'struct sr_channel *' variables that are consistently named 'ch'. --- pv/data/decode/decoder.cpp | 20 +++++++++--------- pv/data/decode/decoder.h | 10 ++++----- pv/data/decoderstack.cpp | 10 ++++----- pv/data/decoderstack.h | 2 +- pv/dialogs/connect.cpp | 2 +- pv/sigsession.cpp | 18 ++++++++-------- pv/sigsession.h | 2 +- pv/view/decodetrace.cpp | 52 +++++++++++++++++++++++----------------------- pv/view/decodetrace.h | 6 +++--- pv/widgets/decodermenu.cpp | 2 +- 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 89d19b3a..44e474b9 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -62,13 +62,13 @@ void Decoder::show(bool show) _shown = show; } -const map >& -Decoder::probes() const +const map >& +Decoder::channels() const { return _probes; } -void Decoder::set_probes(std::map > probes) { _probes = probes; @@ -88,10 +88,10 @@ void Decoder::set_option(const char *id, GVariant *value) bool Decoder::have_required_probes() const { - for (GSList *p = _decoder->probes; p; p = p->next) { - const srd_probe *const probe = (const srd_probe*)p->data; - assert(probe); - if (_probes.find(probe) == _probes.end()) + for (GSList *l = _decoder->channels; l; l = l->next) { + const srd_channel *const pdch = (const srd_channel*)l->data; + assert(pdch); + if (_probes.find(pdch) == _probes.end()) return false; } @@ -101,7 +101,7 @@ bool Decoder::have_required_probes() const set< shared_ptr > Decoder::get_data() { set< shared_ptr > data; - for(map >:: + for(map >:: const_iterator i = _probes.begin(); i != _probes.end(); i++) { @@ -138,7 +138,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_si GHashTable *const probes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for(map >:: + for(map >:: const_iterator i = _probes.begin(); i != _probes.end(); i++) { @@ -149,7 +149,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_si g_hash_table_insert(probes, (*i).first->id, gvar); } - srd_inst_probe_set_all(decoder_inst, probes, unit_size); + srd_inst_channel_set_all(decoder_inst, probes, unit_size); return decoder_inst; } diff --git a/pv/data/decode/decoder.h b/pv/data/decode/decoder.h index 0c3662cb..dffefab2 100644 --- a/pv/data/decode/decoder.h +++ b/pv/data/decode/decoder.h @@ -30,7 +30,7 @@ struct srd_decoder; struct srd_decoder_inst; -struct srd_probe; +struct srd_channel; struct srd_session; namespace pv { @@ -57,9 +57,9 @@ public: bool shown() const; void show(bool show = true); - const std::map >& probes() const; - void set_probes(std::map >& channels() const; + void set_probes(std::map > probes); const std::map& options() const; @@ -78,7 +78,7 @@ private: bool _shown; - std::map > + std::map > _probes; std::map _options; }; diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index 9a13769c..c3bf26d2 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -194,10 +194,10 @@ void DecoderStack::begin_decode() clear(); - // Check that all decoders have the required probes + // Check that all decoders have the required channels BOOST_FOREACH(const shared_ptr &dec, _stack) if (!dec->have_required_probes()) { - _error_message = tr("One or more required probes " + _error_message = tr("One or more required channels " "have not been specified"); return; } @@ -233,12 +233,12 @@ void DecoderStack::begin_decode() } } - // We get the logic data of the first probe in the list. + // We get the logic data of the first channel in the list. // This works because we are currently assuming all // LogicSignals have the same data/snapshot BOOST_FOREACH (const shared_ptr &dec, _stack) - if (dec && !dec->probes().empty() && - ((logic_signal = (*dec->probes().begin()).second)) && + if (dec && !dec->channels().empty() && + ((logic_signal = (*dec->channels().begin()).second)) && ((data = logic_signal->logic_data()))) break; diff --git a/pv/data/decoderstack.h b/pv/data/decoderstack.h index 4b271727..2eeaf1c7 100644 --- a/pv/data/decoderstack.h +++ b/pv/data/decoderstack.h @@ -37,7 +37,7 @@ struct srd_decoder; struct srd_decoder_annotation_row; -struct srd_probe; +struct srd_channel; struct srd_proto_data; struct srd_session; diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 611c9cc5..d5ab9c47 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -185,7 +185,7 @@ void Connect::scan_pressed() QString text = QString::fromUtf8(title.c_str()); if (sdi->channels) { - text += QString(" with %1 probes").arg( + text += QString(" with %1 channels").arg( g_slist_length(sdi->channels)); } diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index e51acde2..b441dab8 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -228,7 +228,7 @@ vector< shared_ptr > SigSession::get_signals() const #ifdef ENABLE_DECODE bool SigSession::add_decoder(srd_decoder *const dec) { - map > probes; + map > probes; shared_ptr decoder_stack; try @@ -240,22 +240,22 @@ bool SigSession::add_decoder(srd_decoder *const dec) new data::DecoderStack(*this, dec)); // Make a list of all the probes - std::vector all_probes; - for(const GSList *i = dec->probes; i; i = i->next) - all_probes.push_back((const srd_probe*)i->data); - for(const GSList *i = dec->opt_probes; i; i = i->next) - all_probes.push_back((const srd_probe*)i->data); + std::vector all_probes; + for(const GSList *i = dec->channels; i; i = i->next) + all_probes.push_back((const srd_channel*)i->data); + for(const GSList *i = dec->opt_channels; i; i = i->next) + all_probes.push_back((const srd_channel*)i->data); // Auto select the initial probes - BOOST_FOREACH(const srd_probe *probe, all_probes) + BOOST_FOREACH(const srd_channel *pdch, all_probes) BOOST_FOREACH(shared_ptr s, _signals) { shared_ptr l = dynamic_pointer_cast(s); - if (l && QString::fromUtf8(probe->name). + if (l && QString::fromUtf8(pdch->name). toLower().contains( l->get_name().toLower())) - probes[probe] = l; + probes[pdch] = l; } assert(decoder_stack); diff --git a/pv/sigsession.h b/pv/sigsession.h index a5f2aa72..1221750b 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -36,7 +36,7 @@ #include struct srd_decoder; -struct srd_probe; +struct srd_channel; namespace pv { diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index e4f02760..c3bc1dff 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -311,7 +311,7 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) } form->addRow(new QLabel( - tr("* Required Probes"), parent)); + tr("* Required channels"), parent)); } // Add stacking button @@ -482,8 +482,8 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left, // This works because we are currently assuming all // LogicSignals have the same data/snapshot BOOST_FOREACH (const shared_ptr &dec, stack) - if (dec && !dec->probes().empty() && - ((logic_signal = (*dec->probes().begin()).second)) && + if (dec && !dec->channels().empty() && + ((logic_signal = (*dec->channels().begin()).second)) && ((data = logic_signal->logic_data()))) break; @@ -521,7 +521,7 @@ void DecodeTrace::create_decoder_form(int index, shared_ptr &dec, QWidget *parent, QFormLayout *form) { - const GSList *probe; + const GSList *l; assert(dec); const srd_decoder *const decoder = dec->decoder(); @@ -542,33 +542,33 @@ void DecodeTrace::create_decoder_form(int index, QFormLayout *const decoder_form = new QFormLayout; group->add_layout(decoder_form); - // Add the mandatory probes - for(probe = decoder->probes; probe; probe = probe->next) { - const struct srd_probe *const p = - (struct srd_probe *)probe->data; - QComboBox *const combo = create_probe_selector(parent, dec, p); + // Add the mandatory channels + for(l = decoder->channels; l; l = l->next) { + const struct srd_channel *const pdch = + (struct srd_channel *)l->data; + QComboBox *const combo = create_probe_selector(parent, dec, pdch); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_probe_selected(int))); decoder_form->addRow(tr("%1 (%2) *") - .arg(QString::fromUtf8(p->name)) - .arg(QString::fromUtf8(p->desc)), combo); + .arg(QString::fromUtf8(pdch->name)) + .arg(QString::fromUtf8(pdch->desc)), combo); - const ProbeSelector s = {combo, dec, p}; + const ProbeSelector s = {combo, dec, pdch}; _probe_selectors.push_back(s); } - // Add the optional probes - for(probe = decoder->opt_probes; probe; probe = probe->next) { - const struct srd_probe *const p = - (struct srd_probe *)probe->data; - QComboBox *const combo = create_probe_selector(parent, dec, p); + // Add the optional channels + for(l = decoder->opt_channels; l; l = l->next) { + const struct srd_channel *const pdch = + (struct srd_channel *)l->data; + QComboBox *const combo = create_probe_selector(parent, dec, pdch); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_probe_selected(int))); decoder_form->addRow(tr("%1 (%2)") - .arg(QString::fromUtf8(p->name)) - .arg(QString::fromUtf8(p->desc)), combo); + .arg(QString::fromUtf8(pdch->name)) + .arg(QString::fromUtf8(pdch->desc)), combo); - const ProbeSelector s = {combo, dec, p}; + const ProbeSelector s = {combo, dec, pdch}; _probe_selectors.push_back(s); } @@ -585,22 +585,22 @@ void DecodeTrace::create_decoder_form(int index, QComboBox* DecodeTrace::create_probe_selector( QWidget *parent, const shared_ptr &dec, - const srd_probe *const probe) + const srd_channel *const pdch) { assert(dec); const vector< shared_ptr > sigs = _session.get_signals(); assert(_decoder_stack); - const map >::const_iterator probe_iter = - dec->probes().find(probe); + dec->channels().find(pdch); QComboBox *selector = new QComboBox(parent); selector->addItem("-", qVariantFromValue((void*)NULL)); - if (probe_iter == dec->probes().end()) + if (probe_iter == dec->channels().end()) selector->setCurrentIndex(0); for(size_t i = 0; i < sigs.size(); i++) { @@ -623,7 +623,7 @@ void DecodeTrace::commit_decoder_probes(shared_ptr &dec) { assert(dec); - map > probe_map; + map > probe_map; const vector< shared_ptr > sigs = _session.get_signals(); BOOST_FOREACH(const ProbeSelector &s, _probe_selectors) @@ -637,7 +637,7 @@ void DecodeTrace::commit_decoder_probes(shared_ptr &dec) BOOST_FOREACH(shared_ptr sig, sigs) if(sig.get() == selection) { - probe_map[s._probe] = + probe_map[s._pdch] = dynamic_pointer_cast(sig); break; } diff --git a/pv/view/decodetrace.h b/pv/view/decodetrace.h index 642f2a0e..9a991fcb 100644 --- a/pv/view/decodetrace.h +++ b/pv/view/decodetrace.h @@ -32,7 +32,7 @@ #include -struct srd_probe; +struct srd_channel; struct srd_decoder; class QComboBox; @@ -66,7 +66,7 @@ private: { const QComboBox *_combo; const boost::shared_ptr _decoder; - const srd_probe *_probe; + const srd_channel *_pdch; }; private: @@ -148,7 +148,7 @@ private: QComboBox* create_probe_selector(QWidget *parent, const boost::shared_ptr &dec, - const srd_probe *const probe); + const srd_channel *const pdch); void commit_decoder_probes( boost::shared_ptr &dec); diff --git a/pv/widgets/decodermenu.cpp b/pv/widgets/decodermenu.cpp index ff687e4c..2f828a20 100644 --- a/pv/widgets/decodermenu.cpp +++ b/pv/widgets/decodermenu.cpp @@ -36,7 +36,7 @@ DecoderMenu::DecoderMenu(QWidget *parent, bool first_level_decoder) : const srd_decoder *const d = (srd_decoder*)l->data; assert(d); - const bool have_probes = (d->probes || d->opt_probes) != 0; + const bool have_probes = (d->channels || d->opt_channels) != 0; if (first_level_decoder == have_probes) { QAction *const action = addAction(QString::fromUtf8(d->name)); -- 2.11.4.GIT