| 183 | } |
| 184 | |
| 185 | void 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 | |
| 233 | void DevMode::on_close() |
| 234 | { |
nothing calls this directly
no test coverage detected