@@ -48,10 +48,11 @@ DeviceOptions::DeviceOptions(QWidget *parent, boost::shared_ptr<pv::device::DevI
4848 _props_box->setLayout (get_property_form (_props_box));
4949 _layout.addWidget (_props_box);
5050
51- QGroupBox *dynamic_box = new QGroupBox (dynamic_widget (_dynamic_layout),
51+ _dynamic_box = new QGroupBox (dynamic_widget (_dynamic_layout),
5252 this );
53- dynamic_box->setLayout (&_dynamic_layout);
54- _layout.addWidget (dynamic_box);
53+ _dynamic_box->setLayout (&_dynamic_layout);
54+ _layout.addWidget (_dynamic_box);
55+ _dynamic_box->setVisible (_dynamic_box->title () != NULL );
5556
5657 _layout.addStretch (1 );
5758 _layout.addWidget (&_button_box);
@@ -333,6 +334,7 @@ void DeviceOptions::mode_check()
333334
334335 if (mode != _mode) {
335336 dynamic_widget (_dynamic_layout);
337+ _dynamic_box->setVisible (_dynamic_box->title () != NULL );
336338 _mode = mode;
337339 }
338340 }
@@ -356,9 +358,12 @@ void DeviceOptions::mode_check()
356358void DeviceOptions::channel_check ()
357359{
358360 QRadioButton* sc=dynamic_cast <QRadioButton*>(sender ());
361+ QString text = sc->text ();
362+ text.remove (' &' );
359363 if (sc != NULL )
360- _dev_inst->set_config (NULL , NULL , SR_CONF_CHANNEL_MODE, g_variant_new_string (sc-> text () .toUtf8 ().data ()));
364+ _dev_inst->set_config (NULL , NULL , SR_CONF_CHANNEL_MODE, g_variant_new_string (text.toUtf8 ().data ()));
361365 dynamic_widget (_dynamic_layout);
366+ _dynamic_box->setVisible (_dynamic_box->title () != NULL );
362367}
363368
364369void DeviceOptions::channel_enable ()
@@ -424,20 +429,27 @@ QString DeviceOptions::dynamic_widget(QGridLayout& inner_layout) {
424429 logic_probes (inner_layout);
425430 return tr (" Channels" );
426431 } else if (_dev_inst->dev_inst ()->mode == DSO) {
427- _config_button = new QPushButton (tr (" Auto Calibration" ), this );
428- inner_layout.addWidget (_config_button, 0 , 0 , 1 , 1 );
429- connect (_config_button, SIGNAL (clicked ()), this , SLOT (zero_adj ()));
430- _cali_button = new QPushButton (tr (" Manual Calibration" ), this );
431- inner_layout.addWidget (_cali_button, 1 , 0 , 1 , 1 );
432- connect (_cali_button, SIGNAL (clicked ()), this , SLOT (on_calibration ()));
433-
434- return tr (" Calibration" );
432+ GVariant* gvar = _dev_inst->get_config (NULL , NULL , SR_CONF_HAVE_ZERO);
433+ if (gvar != NULL ) {
434+ bool have_zero = g_variant_get_boolean (gvar);
435+ g_variant_unref (gvar);
436+
437+ if (have_zero) {
438+ _config_button = new QPushButton (tr (" Auto Calibration" ), this );
439+ inner_layout.addWidget (_config_button, 0 , 0 , 1 , 1 );
440+ connect (_config_button, SIGNAL (clicked ()), this , SLOT (zero_adj ()));
441+ _cali_button = new QPushButton (tr (" Manual Calibration" ), this );
442+ inner_layout.addWidget (_cali_button, 1 , 0 , 1 , 1 );
443+ connect (_cali_button, SIGNAL (clicked ()), this , SLOT (on_calibration ()));
444+
445+ return tr (" Calibration" );
446+ }
447+ }
435448 } else if (_dev_inst->dev_inst ()->mode == ANALOG) {
436449 analog_probes (inner_layout);
437450 return tr (" Channels" );
438- } else {
439- return tr (" Undefined" );
440451 }
452+ return NULL ;
441453}
442454
443455void DeviceOptions::analog_probes (QGridLayout &layout)
0 commit comments