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

Method on_mode_change

DSView/pv/view/devmode.cpp:185–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185void DevMode::on_mode_change()
186{
187 if (_device_agent->have_instance() == false){
188 assert(false);
189 }
190
191 QAction *action = qobject_cast<QAction *>(sender());
192
193 if (_device_agent->get_work_mode() == _mode_list[action]->mode){
194 return;
195 }
196
197 QString iconPath = GetIconPath();
198
199 for(auto i = _mode_list.begin();i != _mode_list.end(); i++)
200 {
201 if ((*i).first == action){
202
203 int mode = (*i).second->mode;
204 if (_device_agent->get_work_mode() == mode){
205 dsv_info("Current mode is set.");
206 break;
207 }
208
209 _session->stop_capture();
210 _session->session_save();
211 _session->switch_work_mode(mode);
212
213 auto *mode_name = get_mode_name(mode);
214 QString icon_fname = iconPath + "/" + QString::fromLocal8Bit(mode_name->_logo);
215
216 _mode_btn->setIcon(QIcon(icon_fname));
217 int cur_mode = mode_name->_mode;
218
219 if (cur_mode == LOGIC)
220 _mode_btn->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_DEVICE_MODE_LOGIC), "Logic Analyzer"));
221 else if (cur_mode == ANALOG)
222 _mode_btn->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_DEVICE_MODE_ANALOG), "Data Acquisition"));
223 else if (cur_mode == DSO)
224 _mode_btn->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_DEVICE_MODE_DSO), "Oscilloscope"));
225
226 break;
227 }
228 }
229
230 UpdateFont();
231}
232
233void DevMode::on_close()
234{

Callers

nothing calls this directly

Calls 7

GetIconPathFunction · 0.85
have_instanceMethod · 0.80
get_work_modeMethod · 0.80
stop_captureMethod · 0.80
switch_work_modeMethod · 0.80
endMethod · 0.45
session_saveMethod · 0.45

Tested by

no test coverage detected