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

Method DecoderGroupBox

DSView/pv/widgets/decodergroupbox.cpp:43–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41namespace widgets {
42
43DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
44 data::decode::Decoder *dec,
45 QLayout *dec_layout,
46 QWidget *parent, QFont font):
47 QWidget(parent)
48{
49 _row_num = 0;
50 _content_width = 0;
51
52 _dec = dec;
53 _decoder_stack = decoder_stack;
54 _widget = new QWidget(this);
55 _layout = new QGridLayout(_widget);
56 _layout->setContentsMargins(0, 0, 0, 0);
57 _layout->setVerticalSpacing(2);
58
59 QString iconPath = GetIconPath();
60 _layout->addWidget(new QLabel(QString("<h3 style='font-style:italic'>%1</h3>").arg(_dec->decoder()->name), _widget),
61 0, 0);
62 _layout->setColumnStretch(0, 1);
63
64 const srd_decoder *const d = _dec->decoder();
65 assert(d);
66
67 _index = 0;
68 for(auto dec : _decoder_stack->stack()) {
69 if (dec == _dec)
70 break;
71 _index++;
72 }
73 _show_button = new QPushButton(QIcon(_dec->shown() ?
74 iconPath+"/shown.svg" :
75 iconPath+"/hidden.svg"), QString(), _widget);
76 _show_button->setProperty("index", -1);
77
78 connect(_show_button, SIGNAL(clicked()), this, SLOT(tog_icon()));
79
80 _layout->addWidget(_show_button, 0, 2);
81
82 _row_num++;
83
84
85 // add row show/hide
86 int index = 0;
87 auto rows = _decoder_stack->get_rows_gshow();
88
89 for (auto i = rows.begin();
90 i != rows.end(); i++) {
91 if ((*i).first.decoder() == _dec->decoder()) {
92 QPushButton *show_button = new QPushButton(QIcon((*i).second ?
93 iconPath+"/shown.svg" :
94 iconPath+"/hidden.svg"), QString(), _widget);
95 show_button->setProperty("index", index);
96 connect(show_button, SIGNAL(clicked()), this, SLOT(tog_icon()));
97
98 _row_show_button.push_back(show_button);
99 QLabel *lb = new QLabel((*i).first.title(), _widget);
100 lb->setFont(font);

Callers

nothing calls this directly

Calls 8

GetIconPathFunction · 0.85
shownMethod · 0.80
get_rows_gshowMethod · 0.80
sizeMethod · 0.80
layoutMethod · 0.80
decoderMethod · 0.45
endMethod · 0.45
titleMethod · 0.45

Tested by

no test coverage detected