Dynamic loading the channel group of the demo device

This commit is contained in:
dreamsourcelabTAI 2023-05-23 13:43:49 +08:00
parent 666975063d
commit ed097505cc
2 changed files with 31 additions and 15 deletions

View File

@ -146,6 +146,9 @@ DeviceOptions::DeviceOptions(QWidget *parent) :
_device_agent->get_config_int16(SR_CONF_OPERATION_MODE, _opt_mode);
if (_device_agent->is_demo())
_demo_operation_mode = _device_agent->get_demo_operation_mode();
try_resize_scroll();
connect(&_mode_check_timer, SIGNAL(timeout()), this, SLOT(mode_check_timeout()));
@ -452,25 +455,37 @@ void DeviceOptions::mode_check_timeout()
if (_isBuilding)
return;
bool test;
int mode;
if (_device_agent->is_hardware())
{
bool test;
int mode;
if (_device_agent->get_config_int16(SR_CONF_OPERATION_MODE, mode)) {
if (mode != _opt_mode) {
_opt_mode = mode;
if (_device_agent->get_config_int16(SR_CONF_OPERATION_MODE, mode)) {
if (mode != _opt_mode) {
_opt_mode = mode;
build_dynamic_panel();
try_resize_scroll();
}
}
if (_device_agent->get_config_bool(SR_CONF_TEST, test)) {
if (test) {
for (auto box : _probes_checkBox_list) {
box->setCheckState(Qt::Checked);
box->setDisabled(true);
}
}
}
}
else if (_device_agent->is_demo())
{
QString opt_mode = _device_agent->get_demo_operation_mode();
if (opt_mode != _demo_operation_mode){
_demo_operation_mode = opt_mode;
build_dynamic_panel();
try_resize_scroll();
}
}
if (_device_agent->get_config_bool(SR_CONF_TEST, test)) {
if (test) {
for (auto box : _probes_checkBox_list) {
box->setCheckState(Qt::Checked);
box->setDisabled(true);
}
}
}
}
}
void DeviceOptions::channel_check()

View File

@ -144,6 +144,7 @@ private:
volatile bool _isBuilding;
DeviceAgent *_device_agent;
int _cur_analog_tag_index;
QString _demo_operation_mode;
pv::prop::binding::DeviceOptions _device_options_binding;
std::vector<pv::prop::binding::ProbeOptions *> _probe_options_binding_list;