MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / set_protocol

Method set_protocol

DSView/pv/dialogs/protocollist.cpp:113–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void ProtocolList::set_protocol(int index)
114{
115 (void)index;
116
117 for(std::list<QCheckBox *>::const_iterator i = _show_checkbox_list.begin();
118 i != _show_checkbox_list.end(); i++) {
119 (*i)->setParent(NULL);
120 _flayout->removeWidget((*i));
121 delete (*i);
122 }
123 _show_checkbox_list.clear();
124 for(std::list<QLabel *>::const_iterator i = _show_label_list.begin();
125 i != _show_label_list.end(); i++) {
126 (*i)->setParent(NULL);
127 _flayout->removeWidget((*i));
128 delete (*i);
129 }
130 _show_label_list.clear();
131
132 pv::data::DecoderStack *decoder_stack = NULL;
133 const auto &decode_sigs = _session->get_decode_signals();
134 int cur_index = 0;
135
136 for(auto d : decode_sigs) {
137 if (index == cur_index) {
138 decoder_stack = d->decoder();
139 break;
140 }
141 cur_index++;
142 }
143
144 if (!decoder_stack){
145 _session->get_decoder_model()->setDecoderStack(NULL);
146 return;
147 }
148
149 _session->get_decoder_model()->setDecoderStack(decoder_stack);
150 int row_index = 0;
151 const auto rows = decoder_stack->get_rows_lshow();
152
153 for (auto i = rows.begin();i != rows.end(); i++) {
154 QLabel *row_label = new QLabel((*i).first.title(), this);
155 QCheckBox *row_checkbox = new QCheckBox(this);
156 //row_checkbox->setChecked(false);
157 _show_label_list.push_back(row_label);
158 _show_checkbox_list.push_back(row_checkbox);
159 _flayout->addRow(row_label, row_checkbox);
160
161 row_checkbox->setChecked((*i).second);
162 connect(row_checkbox, SIGNAL(clicked(bool)), this, SLOT(on_row_check(bool)));
163 row_checkbox->setProperty("index", row_index);
164 row_index++;
165 }
166}
167
168void ProtocolList::on_row_check(bool show)
169{

Callers

nothing calls this directly

Calls 7

setDecoderStackMethod · 0.80
get_decoder_modelMethod · 0.80
get_rows_lshowMethod · 0.80
endMethod · 0.45
clearMethod · 0.45
decoderMethod · 0.45
titleMethod · 0.45

Tested by

no test coverage detected