MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / create_decoder_form

Method create_decoder_form

DSView/pv/dialogs/decoderoptionsdlg.cpp:387–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385
386
387void DecoderOptionsDlg::create_decoder_form(
388 data::decode::Decoder *dec, QWidget *parent,
389 QFormLayout *form)
390{
391 const GSList *l;
392
393 assert(dec);
394 const srd_decoder *const decoder = dec->decoder();
395 assert(decoder);
396
397 QFont font = this->font();
398 font.setPointSizeF(AppConfig::Instance().appOptions.fontSize);
399
400 QFormLayout *const decoder_form = new QFormLayout();
401 decoder_form->setContentsMargins(0,0,0,0);
402 decoder_form->setVerticalSpacing(4);
403 decoder_form->setFormAlignment(Qt::AlignLeft);
404 decoder_form->setLabelAlignment(Qt::AlignLeft);
405 decoder_form->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
406
407 bool bLang = AppConfig::Instance().appOptions.transDecoderDlg;
408 if (LangResource::Instance()->is_lang_en()){
409 bLang = false;
410 }
411
412 // Add the mandatory channels
413 for(l = decoder->channels; l; l = l->next) {
414 const struct srd_channel *const pdch = (struct srd_channel *)l->data;
415 DsComboBox *const combo = create_probe_selector(parent, dec, pdch);
416
417 const char *desc_str = NULL;
418 const char *lang_str = NULL;
419
420 if (pdch->idn != NULL && LangResource::Instance()->is_lang_en() == false){
421 lang_str = LangResource::Instance()->get_lang_text(STR_PAGE_DECODER, pdch->idn, pdch->desc);
422 }
423
424 if (lang_str != NULL && bLang){
425 desc_str = lang_str;
426 }
427 else{
428 desc_str = pdch->desc;
429 }
430
431 //tr
432 decoder_form->addRow(QString("<b>%1</b> (%2) *")
433 .arg(QString::fromUtf8(pdch->name))
434 .arg(QString::fromUtf8(desc_str)), combo);
435
436 const ProbeSelector s = {combo, dec, pdch};
437 _probe_selectors.push_back(s);
438 }
439
440 // Add the optional channels
441 for(l = decoder->opt_channels; l; l = l->next) {
442 const struct srd_channel *const pdch = (struct srd_channel *)l->data;
443 DsComboBox *const combo = create_probe_selector(parent, dec, pdch);
444

Callers

nothing calls this directly

Calls 4

is_lang_enMethod · 0.80
get_lang_textMethod · 0.80
decoderMethod · 0.45

Tested by

no test coverage detected