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

Method DecoderMenu

DSView/pv/widgets/decodermenu.cpp:29–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace widgets {
28
29DecoderMenu::DecoderMenu(QWidget *parent, bool first_level_decoder) :
30 QMenu(parent),
31 _mapper(this)
32{
33 GSList *l = g_slist_sort(g_slist_copy(
34 (GSList*)srd_decoder_list()), decoder_name_cmp);
35 for(; l; l = l->next)
36 {
37 const srd_decoder *const d = (srd_decoder*)l->data;
38 assert(d);
39
40 const bool have_probes = (d->channels || d->opt_channels) != 0;
41 if (first_level_decoder == have_probes) {
42 QAction *const action =
43 addAction(QString::fromUtf8(d->name));
44 action->setData(QVariant::fromValue(l->data));
45 _mapper.setMapping(action, action);
46 connect(action, SIGNAL(triggered()),
47 &_mapper, SLOT(map()));
48 }
49 }
50 g_slist_free(l);
51
52#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
53 connect(&_mapper, SIGNAL(mappedObject(QObject*)), this, SLOT(on_action(QObject*)));
54#else
55 connect(&_mapper, SIGNAL(mapped(QObject*)), this, SLOT(on_action(QObject*)));
56#endif
57}
58
59int DecoderMenu::decoder_name_cmp(const void *a, const void *b)
60{

Callers

nothing calls this directly

Calls 1

srd_decoder_listFunction · 0.85

Tested by

no test coverage detected