if ((sr_config_list(drivers[i], SR_CONF_DEVICE_OPTIONS,
(const void **)&hwopts, NULL) == SR_OK) && hwopts)
for (int j = 0; hwopts[j]; j++)
- if(hwopts[j] == SR_CONF_SAMPLERATE) {
+ if (hwopts[j] == SR_CONF_SAMPLERATE) {
supported_device = true;
break;
}
- if(supported_device)
+ if (supported_device)
_drivers.addItem(QString("%1 (%2)").arg(
drivers[i]->longname).arg(drivers[i]->name),
qVariantFromValue((void*)drivers[i]));
_device_list.clear();
const int index = _drivers.currentIndex();
- if(index == -1)
+ if (index == -1)
return;
sr_dev_driver *const driver = (sr_dev_driver*)_drivers.itemData(
void MainWindow::on_actionConnect_triggered()
{
dialogs::Connect dlg(this);
- if(!dlg.exec())
+ if (!dlg.exec())
return;
struct sr_dev_inst *const sdi = dlg.get_selected_device();
const struct sr_dev_inst *sdi, int key)
{
const void *data = NULL;
- if(sr_config_get(sdi->driver, key, &data, sdi) != SR_OK) {
+ if (sr_config_get(sdi->driver, key, &data, sdi) != SR_OK) {
qDebug() <<
"WARNING: Failed to get value of config id" << key;
return NULL;
const struct sr_dev_inst *sdi)
{
uint64_t *samplerate = NULL;
- if(sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
+ if (sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
(const void**)&samplerate, sdi) != SR_OK) {
qDebug() <<
"WARNING: Failed to get value of sample rate";
struct sr_dev_inst *sdi, double value)
{
uint64_t samplerate = value;
- if(sr_config_set(sdi, SR_CONF_SAMPLERATE,
+ if (sr_config_set(sdi, SR_CONF_SAMPLERATE,
&samplerate) != SR_OK)
qDebug() <<
"WARNING: Failed to set value of sample rate";
return NULL;
}
- if(sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
+ if (sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
(const void**)&samplerate, sdi) != SR_OK ||
!samplerate) {
qDebug() <<
}
for (const uint64_t *rate = samplerates->list; *rate; rate++)
- if(*rate == *samplerate)
+ if (*rate == *samplerate)
return (const void*)rate;
return NULL;
QWidget* Double::get_widget(QWidget *parent)
{
- if(_spin_box)
+ if (_spin_box)
return _spin_box;
_spin_box = new QDoubleSpinBox(parent);
_spin_box->setDecimals(_decimals);
_spin_box->setSuffix(_suffix);
- if(_range)
+ if (_range)
_spin_box->setRange(_range->first, _range->second);
- if(_step)
+ if (_step)
_spin_box->setSingleStep(*_step);
_spin_box->setValue(_getter ? _getter() : 0.0);
{
assert(_setter);
- if(!_spin_box)
+ if (!_spin_box)
return;
_setter(_spin_box->value());
return _selector;
const void *value = NULL;
- if(_getter)
+ if (_getter)
value = _getter();
_selector = new QComboBox(parent);
- for(unsigned int i = 0; i < _values.size(); i++) {
+ for (unsigned int i = 0; i < _values.size(); i++) {
const pair<const void*, QString> &v = _values[i];
_selector->addItem(v.second,
qVariantFromValue((void*)v.first));
- if(v.first == value)
+ if (v.first == value)
_selector->setCurrentIndex(i);
}
void SamplingBar::set_selected_device(struct sr_dev_inst *const sdi)
{
- for(int i = 0; i < _device_selector.count(); i++)
- if(sdi == _device_selector.itemData(i).value<void*>()) {
+ for (int i = 0; i < _device_selector.count(); i++)
+ if (sdi == _device_selector.itemData(i).value<void*>()) {
_device_selector.setCurrentIndex(i);
return;
}
assert(sdi);
uint64_t *samplerate = NULL;
- if(sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
+ if (sr_config_get(sdi->driver, SR_CONF_SAMPLERATE,
(const void**)&samplerate, sdi) != SR_OK) {
qDebug() <<
"WARNING: Failed to get value of sample rate";
_sample_rate_value.setValue(*samplerate);
else if (_sample_rate_list_action->isVisible())
{
- for(int i = 0; i < _sample_rate_list.count(); i++)
- if(*samplerate == _sample_rate_list.itemData(
+ for (int i = 0; i < _sample_rate_list.count(); i++)
+ if (*samplerate == _sample_rate_list.itemData(
i).value<uint64_t>())
_sample_rate_list.setCurrentIndex(i);
}