| 41 | namespace widgets { |
| 42 | |
| 43 | DecoderGroupBox::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); |
nothing calls this directly
no test coverage detected