MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / ProtocolDock

Method ProtocolDock

DSView/pv/dock/protocoldock.cpp:67–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65//-----------ProtocolDock
66
67ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *session) :
68 QScrollArea(parent),
69 _view(view)
70{
71 _session = session;
72 _cur_search_index = -1;
73 _search_edited = false;
74 _pro_add_button = NULL;
75
76 //-----------------------------get protocol list
77 GSList *l = const_cast<GSList*>(srd_decoder_list());
78 std::map<std::string, int> pro_key_table;
79 QString repeatNammes;
80
81 for(; l; l = l->next)
82 {
83 const srd_decoder *const d = (srd_decoder*)l->data;
84 assert(d);
85
86 DecoderInfoItem *info = new DecoderInfoItem();
87 srd_decoder *dec = (srd_decoder *)(l->data);
88 info->_data_handle = dec;
89 _decoderInfoList.push_back(info);
90
91 std::string prokey(dec->id);
92 if (pro_key_table.find(prokey) != pro_key_table.end())
93 {
94 if (repeatNammes != "")
95 repeatNammes += ",";
96 repeatNammes += QString(dec->id);
97 }
98 else
99 {
100 pro_key_table[prokey] = 1;
101 }
102 }
103 g_slist_free(l);
104
105 sort(_decoderInfoList.begin(), _decoderInfoList.end(), ProtocolDock::protocol_sort_callback);
106
107 if (repeatNammes != ""){
108 QString err = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODER_REPEAT), "Any decoder have repeated id or name:");
109 err += repeatNammes;
110 MsgBox::Show(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_ERROR), "error"), err.toUtf8().data());
111 }
112
113 //-----------------------------top panel
114 QWidget *top_panel = new QWidget();
115 top_panel->setMinimumHeight(70);
116 _top_panel = top_panel;
117 QWidget* bot_panel = new QWidget();
118
119 _pro_add_button = new QPushButton(top_panel);
120 _pro_add_button->setFlat(true);
121 _del_all_button = new QPushButton(top_panel);
122 _del_all_button->setFlat(true);
123 _del_all_button->setCheckable(true);
124 _pro_keyword_edit = new KeywordLineEdit(top_panel, this);

Callers

nothing calls this directly

Calls 5

srd_decoder_listFunction · 0.85
ShowFunction · 0.85
get_decoder_modelMethod · 0.80
endMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected