const srd_decoder *const decoder = dec->decoder();
assert(decoder);
+ const bool decoder_deletable = index > 0;
+
pv::widgets::DecoderGroupBox *const group =
new pv::widgets::DecoderGroupBox(
- QString::fromUtf8(decoder->name));
+ QString::fromUtf8(decoder->name), nullptr, decoder_deletable);
group->set_decoder_visible(dec->shown());
- delete_mapper_.setMapping(group, index);
- connect(group, SIGNAL(delete_decoder()), &delete_mapper_, SLOT(map()));
+ if (decoder_deletable) {
+ delete_mapper_.setMapping(group, index);
+ connect(group, SIGNAL(delete_decoder()), &delete_mapper_, SLOT(map()));
+ }
show_hide_mapper_.setMapping(group, index);
connect(group, SIGNAL(show_hide_decoder()),
namespace pv {
namespace widgets {
-DecoderGroupBox::DecoderGroupBox(QString title, QWidget *parent) :
+DecoderGroupBox::DecoderGroupBox(QString title, QWidget *parent, bool isDeletable) :
QWidget(parent),
layout_(new QGridLayout),
show_hide_button_(QIcon(":/icons/decoder-shown.svg"), QString(), this)
this, SIGNAL(show_hide_decoder()));
toolbar->addWidget(&show_hide_button_);
- QPushButton *const delete_button = new QPushButton(
- QIcon(":/icons/decoder-delete.svg"), QString(), this);
- delete_button->setFlat(true);
- delete_button->setIconSize(QSize(16, 16));
- connect(delete_button, SIGNAL(clicked()),
- this, SIGNAL(delete_decoder()));
- toolbar->addWidget(delete_button);
+ if (isDeletable) {
+ QPushButton *const delete_button = new QPushButton(
+ QIcon(":/icons/decoder-delete.svg"), QString(), this);
+ delete_button->setFlat(true);
+ delete_button->setIconSize(QSize(16, 16));
+ connect(delete_button, SIGNAL(clicked()),
+ this, SIGNAL(delete_decoder()));
+ toolbar->addWidget(delete_button);
+ }
}
void DecoderGroupBox::add_layout(QLayout *layout)