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

Method channel_checkbox_clicked

DSView/pv/dialogs/deviceoptions.cpp:586–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
587{
588 if (_device_agent->get_work_mode() == LOGIC) {
589 if (sc == NULL || !sc->isChecked())
590 return;
591
592 bool stream_mode;
593 if (_device_agent->get_config_bool(SR_CONF_STREAM, stream_mode) == false)
594 return;
595
596 if (!stream_mode)
597 return;
598
599 int cur_ch_num = 0;
600 for (auto box : _probes_checkBox_list) {
601 if (box->isChecked())
602 cur_ch_num++;
603 }
604
605 int vld_ch_num;
606 if (_device_agent->get_config_int16(SR_CONF_VLD_CH_NUM, vld_ch_num) == false)
607 return;
608
609 if (cur_ch_num > vld_ch_num) {
610 QString msg_str(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MAX_CHANNEL_COUNT_WARNING), "max count of channels!"));
611 msg_str = msg_str.replace("{0}", QString::number(vld_ch_num) );
612 MsgBox::Show(msg_str);
613
614 sc->setChecked(false);
615 }
616 }
617 else if (_device_agent->get_work_mode() == ANALOG) {
618 if (sc != NULL) {
619 QGridLayout *const layout = (QGridLayout *)sc->property("Layout").value<void *>();
620 int i = layout->count();
621
622 int ck_index = -1;
623 int i_dex = 0;
624 bool map_default = false;
625
626 for(auto ck : _probes_checkBox_list){
627 if (ck == sc){
628 ck_index = i_dex;
629 break;
630 }
631 i_dex++;
632 }
633
634 if (ck_index != -1)
635 {
636 _device_agent->get_config_bool(SR_CONF_PROBE_MAP_DEFAULT,
637 map_default, _dso_channel_list[ck_index], NULL);
638 }
639
640 while(i--)
641 {
642 QWidget* w = layout->itemAt(i)->widget();
643

Callers

nothing calls this directly

Calls 4

ShowFunction · 0.85
get_work_modeMethod · 0.80
get_config_boolMethod · 0.80
get_config_int16Method · 0.80

Tested by

no test coverage detected