SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
DeviceUserArgsDialog Class Reference

#include <deviceuserargsdialog.h>

Inherits QDialog.

+ Collaboration diagram for DeviceUserArgsDialog:

Classes

struct  HWDeviceReference
 

Public Member Functions

 DeviceUserArgsDialog (DeviceEnumerator *deviceEnumerator, DeviceUserArgs &hardwareDeviceUserArgs, QWidget *parent=0)
 
 ~DeviceUserArgsDialog ()
 

Private Slots

void accept ()
 
void reject ()
 
void on_importDevice_clicked (bool checked)
 
void on_deleteArgs_clicked (bool checked)
 
void on_argsTree_currentItemChanged (QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem)
 
void on_argStringEdit_editingFinished ()
 

Private Member Functions

void pushHWDeviceReference (const PluginInterface::SamplingDevice *samplingDevice)
 
void displayArgsByDevice ()
 

Private Attributes

Ui::DeviceUserArgsDialog * ui
 
DeviceEnumeratorm_deviceEnumerator
 
DeviceUserArgsm_hardwareDeviceUserArgs
 
std::vector< HWDeviceReferencem_availableHWDevices
 
DeviceUserArgs m_deviceUserArgsCopy
 

Detailed Description

Definition at line 35 of file deviceuserargsdialog.h.

Constructor & Destructor Documentation

◆ DeviceUserArgsDialog()

DeviceUserArgsDialog::DeviceUserArgsDialog ( DeviceEnumerator deviceEnumerator,
DeviceUserArgs hardwareDeviceUserArgs,
QWidget *  parent = 0 
)
explicit

Definition at line 22 of file deviceuserargsdialog.cpp.

References arg(), displayArgsByDevice(), DeviceEnumerator::getMIMOSamplingDevice(), DeviceEnumerator::getNbMIMOSamplingDevices(), DeviceEnumerator::getNbRxSamplingDevices(), DeviceEnumerator::getNbTxSamplingDevices(), DeviceEnumerator::getRxSamplingDevice(), DeviceEnumerator::getTxSamplingDevice(), i, m_availableHWDevices, m_deviceEnumerator, pushHWDeviceReference(), and ui.

26  :
27  QDialog(parent),
28  ui(new Ui::DeviceUserArgsDialog),
29  m_deviceEnumerator(deviceEnumerator),
30  m_hardwareDeviceUserArgs(hardwareDeviceUserArgs),
31  m_deviceUserArgsCopy(hardwareDeviceUserArgs)
32 {
33  ui->setupUi(this);
34 
35  for (int i = 0; i < m_deviceEnumerator->getNbRxSamplingDevices(); i++) {
37  }
38 
39  for (int i = 0; i < m_deviceEnumerator->getNbTxSamplingDevices(); i++) {
41  }
42 
43  for (int i = 0; i < m_deviceEnumerator->getNbMIMOSamplingDevices(); i++) {
45  }
46 
47  for (auto& hwItem : m_availableHWDevices)
48  {
49  QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->deviceTree);
50  treeItem->setText(0, hwItem.m_hardwareId);
51  treeItem->setText(1, tr("%1").arg(hwItem.m_sequence));
52  treeItem->setText(2, hwItem.m_description);
53  }
54 
55  ui->deviceTree->resizeColumnToContents(0);
56  ui->deviceTree->resizeColumnToContents(1);
57  ui->deviceTree->resizeColumnToContents(2);
58 
60 }
void pushHWDeviceReference(const PluginInterface::SamplingDevice *samplingDevice)
std::vector< HWDeviceReference > m_availableHWDevices
DeviceEnumerator * m_deviceEnumerator
DeviceUserArgs & m_hardwareDeviceUserArgs
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
const PluginInterface::SamplingDevice * getMIMOSamplingDevice(int deviceIndex) const
int32_t i
Definition: decimators.h:244
Ui::DeviceUserArgsDialog * ui
int getNbRxSamplingDevices() const
const PluginInterface::SamplingDevice * getTxSamplingDevice(int deviceIndex) const
DeviceUserArgs m_deviceUserArgsCopy
const PluginInterface::SamplingDevice * getRxSamplingDevice(int deviceIndex) const
int getNbMIMOSamplingDevices() const
int getNbTxSamplingDevices() const
+ Here is the call graph for this function:

◆ ~DeviceUserArgsDialog()

DeviceUserArgsDialog::~DeviceUserArgsDialog ( )

Definition at line 62 of file deviceuserargsdialog.cpp.

References ui.

63 {
64  delete ui;
65 }
Ui::DeviceUserArgsDialog * ui

Member Function Documentation

◆ accept

void DeviceUserArgsDialog::accept ( )
privateslot

Definition at line 111 of file deviceuserargsdialog.cpp.

References m_deviceUserArgsCopy, and m_hardwareDeviceUserArgs.

112 {
114  QDialog::accept();
115 }
DeviceUserArgs & m_hardwareDeviceUserArgs
DeviceUserArgs m_deviceUserArgsCopy

◆ displayArgsByDevice()

void DeviceUserArgsDialog::displayArgsByDevice ( )
private

Definition at line 67 of file deviceuserargsdialog.cpp.

References arg(), DeviceUserArgs::getArgsByDevice(), m_deviceUserArgsCopy, and ui.

Referenced by DeviceUserArgsDialog(), on_argStringEdit_editingFinished(), on_deleteArgs_clicked(), and on_importDevice_clicked().

68 {
69  ui->argsTree->blockSignals(true);
70  ui->argsTree->clear();
71  ui->argStringEdit->clear();
72 
73  QList<DeviceUserArgs::Args>::const_iterator it = m_deviceUserArgsCopy.getArgsByDevice().begin();
74 
75  for (; it != m_deviceUserArgsCopy.getArgsByDevice().end(); ++it)
76  {
77  QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->argsTree);
78  treeItem->setText(0, it->m_id);
79  treeItem->setText(1, tr("%1").arg(it->m_sequence));
80  treeItem->setText(2, it->m_args);
81  }
82 
83  ui->argsTree->resizeColumnToContents(0);
84  ui->argsTree->resizeColumnToContents(1);
85  ui->argsTree->resizeColumnToContents(2);
86  ui->argsTree->blockSignals(false);
87 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
const QList< Args > & getArgsByDevice() const
Ui::DeviceUserArgsDialog * ui
DeviceUserArgs m_deviceUserArgsCopy
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_argsTree_currentItemChanged

void DeviceUserArgsDialog::on_argsTree_currentItemChanged ( QTreeWidgetItem *  currentItem,
QTreeWidgetItem *  previousItem 
)
privateslot

Definition at line 150 of file deviceuserargsdialog.cpp.

References ui.

151 {
152  (void) previousItem;
153  ui->argStringEdit->setText(currentItem->text(2));
154 }
Ui::DeviceUserArgsDialog * ui

◆ on_argStringEdit_editingFinished

void DeviceUserArgsDialog::on_argStringEdit_editingFinished ( )
privateslot

Definition at line 156 of file deviceuserargsdialog.cpp.

References displayArgsByDevice(), m_deviceUserArgsCopy, ui, and DeviceUserArgs::updateDeviceArgs().

157 {
158  QTreeWidgetItem *deviceItem = ui->argsTree->currentItem();
159 
160  if (deviceItem)
161  {
162  bool ok;
163  int sequence = deviceItem->text(1).toInt(&ok);
164  m_deviceUserArgsCopy.updateDeviceArgs(deviceItem->text(0), sequence, ui->argStringEdit->text());
166  }
167 }
Ui::DeviceUserArgsDialog * ui
void updateDeviceArgs(const QString &id, int sequence, const QString &args)
Will not update if reference does not exist.
DeviceUserArgs m_deviceUserArgsCopy
+ Here is the call graph for this function:

◆ on_deleteArgs_clicked

void DeviceUserArgsDialog::on_deleteArgs_clicked ( bool  checked)
privateslot

Definition at line 136 of file deviceuserargsdialog.cpp.

References DeviceUserArgs::deleteDeviceArgs(), displayArgsByDevice(), m_deviceUserArgsCopy, and ui.

137 {
138  (void) checked;
139  QTreeWidgetItem *deviceItem = ui->argsTree->currentItem();
140 
141  if (deviceItem)
142  {
143  bool ok;
144  int sequence = deviceItem->text(1).toInt(&ok);
145  m_deviceUserArgsCopy.deleteDeviceArgs(deviceItem->text(0), sequence);
147  }
148 }
void deleteDeviceArgs(const QString &id, int sequence)
Ui::DeviceUserArgsDialog * ui
DeviceUserArgs m_deviceUserArgsCopy
+ Here is the call graph for this function:

◆ on_importDevice_clicked

void DeviceUserArgsDialog::on_importDevice_clicked ( bool  checked)
privateslot

Definition at line 122 of file deviceuserargsdialog.cpp.

References DeviceUserArgs::addDeviceArgs(), displayArgsByDevice(), m_deviceUserArgsCopy, and ui.

123 {
124  (void) checked;
125  QTreeWidgetItem *deviceItem = ui->deviceTree->currentItem();
126 
127  if (deviceItem)
128  {
129  bool ok;
130  int sequence = deviceItem->text(1).toInt(&ok);
131  m_deviceUserArgsCopy.addDeviceArgs(deviceItem->text(0), sequence, "");
133  }
134 }
void addDeviceArgs(const QString &id, int sequence, const QString &args)
Will not add if it exists for same reference.
Ui::DeviceUserArgsDialog * ui
DeviceUserArgs m_deviceUserArgsCopy
+ Here is the call graph for this function:

◆ pushHWDeviceReference()

void DeviceUserArgsDialog::pushHWDeviceReference ( const PluginInterface::SamplingDevice samplingDevice)
private

Definition at line 89 of file deviceuserargsdialog.cpp.

References PluginInterface::SamplingDevice::displayedName, PluginInterface::SamplingDevice::hardwareId, m_availableHWDevices, DeviceUserArgsDialog::HWDeviceReference::m_description, DeviceUserArgsDialog::HWDeviceReference::m_hardwareId, DeviceUserArgsDialog::HWDeviceReference::m_sequence, and PluginInterface::SamplingDevice::sequence.

Referenced by DeviceUserArgsDialog().

90 {
91  HWDeviceReference hw;
92  hw.m_hardwareId = samplingDevice->hardwareId;
93  hw.m_sequence = samplingDevice->sequence;
94  hw.m_description = samplingDevice->displayedName;
95  bool found = false;
96 
97  for (auto& hwAvail : m_availableHWDevices)
98  {
99  if (hw == hwAvail)
100  {
101  found = true;
102  break;
103  }
104  }
105 
106  if (!found) {
107  m_availableHWDevices.push_back(hw);
108  }
109 }
std::vector< HWDeviceReference > m_availableHWDevices
int sequence
The device sequence. >0 when more than one device of the same type is connected.
QString displayedName
The human readable name.
QString hardwareId
The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
+ Here is the caller graph for this function:

◆ reject

void DeviceUserArgsDialog::reject ( )
privateslot

Definition at line 117 of file deviceuserargsdialog.cpp.

118 {
119  QDialog::reject();
120 }

Member Data Documentation

◆ m_availableHWDevices

std::vector<HWDeviceReference> DeviceUserArgsDialog::m_availableHWDevices
private

Definition at line 59 of file deviceuserargsdialog.h.

Referenced by DeviceUserArgsDialog(), and pushHWDeviceReference().

◆ m_deviceEnumerator

DeviceEnumerator* DeviceUserArgsDialog::m_deviceEnumerator
private

Definition at line 57 of file deviceuserargsdialog.h.

Referenced by DeviceUserArgsDialog().

◆ m_deviceUserArgsCopy

DeviceUserArgs DeviceUserArgsDialog::m_deviceUserArgsCopy
private

◆ m_hardwareDeviceUserArgs

DeviceUserArgs& DeviceUserArgsDialog::m_hardwareDeviceUserArgs
private

Definition at line 58 of file deviceuserargsdialog.h.

Referenced by accept().

◆ ui

Ui::DeviceUserArgsDialog* DeviceUserArgsDialog::ui
private

The documentation for this class was generated from the following files: