"MainWindow", "&Decoders", 0, QApplication::UnicodeUTF8));
pv::widgets::DecoderMenu *const menu_decoders_add =
- new pv::widgets::DecoderMenu(menu_decoders);
+ new pv::widgets::DecoderMenu(menu_decoders, true);
menu_decoders_add->setTitle(QApplication::translate(
"MainWindow", "&Add", 0, QApplication::UnicodeUTF8));
connect(menu_decoders_add, SIGNAL(decoder_selected(srd_decoder*)),
namespace pv {
namespace widgets {
-DecoderMenu::DecoderMenu(QWidget *parent) :
+DecoderMenu::DecoderMenu(QWidget *parent, bool first_level_decoder) :
QMenu(parent),
_mapper(this)
{
(GSList*)srd_decoder_list()), decoder_name_cmp);
for(; l; l = l->next)
{
- QAction *const action = addAction(QString::fromUtf8(
- ((srd_decoder*)l->data)->name));
- action->setData(qVariantFromValue(l->data));
- _mapper.setMapping(action, action);
- connect(action, SIGNAL(triggered()),
- &_mapper, SLOT(map()));
+ const srd_decoder *const d = (srd_decoder*)l->data;
+ assert(d);
+
+ if (!first_level_decoder || d->probes || d->opt_probes) {
+ QAction *const action =
+ addAction(QString::fromUtf8(d->name));
+ action->setData(qVariantFromValue(l->data));
+ _mapper.setMapping(action, action);
+ connect(action, SIGNAL(triggered()),
+ &_mapper, SLOT(map()));
+ }
}
g_slist_free(l);
Q_OBJECT;
public:
- DecoderMenu(QWidget *parent);
+ DecoderMenu(QWidget *parent, bool first_level_decoder = false);
private:
static int decoder_name_cmp(const void *a, const void *b);