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.
Public Types | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
ArgInfoGUI Class Reference

#include <arginfogui.h>

Inherits QWidget.

Public Types

enum  ArgInfoType { ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete }
 
enum  ArgInfoValueType { ArgInfoValueBool, ArgInfoValueInt, ArgInfoValueFloat, ArgInfoValueString }
 

Signals

void valueChanged ()
 

Public Member Functions

 ArgInfoGUI (ArgInfoType type, ArgInfoValueType valueType, QWidget *parent=0)
 
 ~ArgInfoGUI ()
 
void setLabel (const QString &text)
 
void setToolTip (const QString &text)
 
void setUnits (const QString &units)
 
ArgInfoType getType () const
 
ArgInfoValueType getValueType () const
 
void setRange (double min, double max)
 
bool getBoolValue () const
 
void setBoolValue (bool value)
 
void addBoolValue (const QString &text, bool value)
 
int getIntValue () const
 
void setIntValue (int value)
 
void addIntValue (const QString &text, int value)
 
double getFloatValue () const
 
void setFloatValue (double value)
 
void addFloatValue (const QString &text, double value)
 
const QString & getStringValue () const
 
void setStringValue (const QString &value)
 
void addStringValue (const QString &text, const QString &value)
 

Private Slots

void on_argCheck_toggled (bool checked)
 
void on_argEdit_editingFinished ()
 
void on_argCombo_currentIndexChanged (int index)
 

Private Member Functions

int setIntegerValue (int value)
 
double setDoubleValue (double value)
 
void updateUIFromBool ()
 
void updateUIFromInt ()
 
void updateUIFromFloat ()
 
void updateUIFromString ()
 

Private Attributes

Ui::ArgInfoGUI * ui
 
ArgInfoType m_type
 
ArgInfoValueType m_valueType
 
bool m_boolValue
 
int m_intValue
 
double m_floatValue
 
QString m_stringValue
 
bool m_hasRange
 
double m_minValue
 
double m_maxValue
 

Detailed Description

Definition at line 30 of file arginfogui.h.

Member Enumeration Documentation

◆ ArgInfoType

Enumerator
ArgInfoBinary 
ArgInfoContinuous 
ArgInfoDiscrete 

Definition at line 34 of file arginfogui.h.

◆ ArgInfoValueType

Enumerator
ArgInfoValueBool 
ArgInfoValueInt 
ArgInfoValueFloat 
ArgInfoValueString 

Definition at line 41 of file arginfogui.h.

Constructor & Destructor Documentation

◆ ArgInfoGUI()

ArgInfoGUI::ArgInfoGUI ( ArgInfoType  type,
ArgInfoValueType  valueType,
QWidget *  parent = 0 
)
explicit

Definition at line 24 of file arginfogui.cpp.

References ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, ArgInfoValueFloat, ArgInfoValueInt, m_type, m_valueType, and ui.

24  :
25  QWidget(parent),
26  ui(new Ui::ArgInfoGUI),
27  m_type(type),
28  m_valueType(valueType),
29  m_boolValue(false),
30  m_intValue(0),
31  m_floatValue(0.0),
32  m_hasRange(false),
33  m_minValue(0.0),
34  m_maxValue(0.0)
35 {
36  ui->setupUi(this);
37  QHBoxLayout *layout = ui->argLayout;
38 
40  {
41  if (m_type == ArgInfoContinuous) {
42  ui->argEdit->setAlignment(Qt::AlignRight);
43  } else if (m_type == ArgInfoDiscrete) {
44  ui->argCombo->setLayoutDirection(Qt::RightToLeft);
45  }
46  }
47 
48  if (m_type != ArgInfoBinary)
49  {
50  layout->removeWidget(ui->argCheck);
51  delete ui->argCheck;
52  }
53 
55  {
56  layout->removeWidget(ui->argEdit);
57  delete ui->argEdit;
58  }
59 
60  if (m_type != ArgInfoDiscrete)
61  {
62  layout->removeWidget(ui->argCombo);
63  delete ui->argCombo;
64  }
65 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
double m_maxValue
Definition: arginfogui.h:101
ArgInfoType m_type
Definition: arginfogui.h:93
bool m_boolValue
Definition: arginfogui.h:95
double m_minValue
Definition: arginfogui.h:100
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
bool m_hasRange
Definition: arginfogui.h:99
double m_floatValue
Definition: arginfogui.h:97

◆ ~ArgInfoGUI()

ArgInfoGUI::~ArgInfoGUI ( )

Definition at line 67 of file arginfogui.cpp.

References ui.

68 {
69  delete ui;
70 }
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92

Member Function Documentation

◆ addBoolValue()

void ArgInfoGUI::addBoolValue ( const QString &  text,
bool  value 
)

Definition at line 124 of file arginfogui.cpp.

References ArgInfoDiscrete, m_type, and ui.

125 {
126  if (m_type == ArgInfoDiscrete) {
127  ui->argCombo->addItem(text, QVariant(value));
128  }
129 }
ArgInfoType m_type
Definition: arginfogui.h:93
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92

◆ addFloatValue()

void ArgInfoGUI::addFloatValue ( const QString &  text,
double  value 
)

Definition at line 186 of file arginfogui.cpp.

References ArgInfoDiscrete, m_type, setDoubleValue(), and ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

187 {
188  if (m_type == ArgInfoDiscrete) {
189  ui->argCombo->addItem(text, QVariant(setDoubleValue(value)));
190  }
191 }
ArgInfoType m_type
Definition: arginfogui.h:93
double setDoubleValue(double value)
Definition: arginfogui.cpp:235
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addIntValue()

void ArgInfoGUI::addIntValue ( const QString &  text,
int  value 
)

Definition at line 155 of file arginfogui.cpp.

References ArgInfoDiscrete, m_type, setIntegerValue(), and ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

156 {
157  if (m_type == ArgInfoDiscrete) {
158  ui->argCombo->addItem(text, QVariant(setIntegerValue(value)));
159  }
160 }
ArgInfoType m_type
Definition: arginfogui.h:93
int setIntegerValue(int value)
Definition: arginfogui.cpp:226
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStringValue()

void ArgInfoGUI::addStringValue ( const QString &  text,
const QString &  value 
)

Definition at line 219 of file arginfogui.cpp.

References ArgInfoDiscrete, m_type, and ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

220 {
221  if (m_type == ArgInfoDiscrete) {
222  ui->argCombo->addItem(text, QVariant(value));
223  }
224 }
ArgInfoType m_type
Definition: arginfogui.h:93
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the caller graph for this function:

◆ getBoolValue()

bool ArgInfoGUI::getBoolValue ( ) const
inline

Definition at line 60 of file arginfogui.h.

Referenced by DynamicArgSettingGUI::getValue(), and DynamicArgSettingGUI::processValueChanged().

60 { return m_boolValue; }
bool m_boolValue
Definition: arginfogui.h:95
+ Here is the caller graph for this function:

◆ getFloatValue()

double ArgInfoGUI::getFloatValue ( ) const
inline

Definition at line 68 of file arginfogui.h.

Referenced by DynamicArgSettingGUI::getValue(), and DynamicArgSettingGUI::processValueChanged().

68 { return m_floatValue; }
double m_floatValue
Definition: arginfogui.h:97
+ Here is the caller graph for this function:

◆ getIntValue()

int ArgInfoGUI::getIntValue ( ) const
inline

Definition at line 64 of file arginfogui.h.

Referenced by DynamicArgSettingGUI::getValue(), and DynamicArgSettingGUI::processValueChanged().

64 { return m_intValue; }
int m_intValue
Definition: arginfogui.h:96
+ Here is the caller graph for this function:

◆ getStringValue()

const QString& ArgInfoGUI::getStringValue ( ) const
inline

Definition at line 72 of file arginfogui.h.

Referenced by DynamicArgSettingGUI::getValue(), and DynamicArgSettingGUI::processValueChanged().

72 { return m_stringValue; }
QString m_stringValue
Definition: arginfogui.h:98
+ Here is the caller graph for this function:

◆ getType()

ArgInfoType ArgInfoGUI::getType ( ) const
inline

Definition at line 56 of file arginfogui.h.

56 { return m_type; }
ArgInfoType m_type
Definition: arginfogui.h:93

◆ getValueType()

ArgInfoValueType ArgInfoGUI::getValueType ( ) const
inline

Definition at line 57 of file arginfogui.h.

References leansdr::max(), and leansdr::min().

Referenced by DynamicArgSettingGUI::getValue(), and DynamicArgSettingGUI::processValueChanged().

57 { return m_valueType; }
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_argCheck_toggled

void ArgInfoGUI::on_argCheck_toggled ( bool  checked)
privateslot

Definition at line 373 of file arginfogui.cpp.

References setBoolValue(), and valueChanged().

374 {
375  setBoolValue(checked);
376  emit valueChanged();
377 }
void valueChanged()
void setBoolValue(bool value)
Definition: arginfogui.cpp:100
+ Here is the call graph for this function:

◆ on_argCombo_currentIndexChanged

void ArgInfoGUI::on_argCombo_currentIndexChanged ( int  index)
privateslot

Definition at line 385 of file arginfogui.cpp.

References setBoolValue(), setFloatValue(), setIntValue(), setStringValue(), ui, and valueChanged().

386 {
387  (void) index;
388  QVariant v = ui->argCombo->currentData();
389  bool ok = false;
390 
391  if (v.type() == QVariant::Bool)
392  {
393  setBoolValue(v.toBool());
394  emit valueChanged();
395  }
396  else if (v.type() == QVariant::Int)
397  {
398  setIntValue(v.toInt(&ok));
399 
400  if (ok) {
401  emit valueChanged();
402  }
403  }
404  else if (v.type() == QVariant::Double)
405  {
406  setFloatValue(v.toDouble(&ok));
407 
408  if (ok) {
409  emit valueChanged();
410  }
411  }
412  else if (v.type() ==QVariant::String)
413  {
414  setStringValue(v.toString());
415  emit valueChanged();
416  }
417 }
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
void setIntValue(int value)
Definition: arginfogui.cpp:131
void valueChanged()
void setBoolValue(bool value)
Definition: arginfogui.cpp:100
void setFloatValue(double value)
Definition: arginfogui.cpp:162
void setStringValue(const QString &value)
Definition: arginfogui.cpp:193
+ Here is the call graph for this function:

◆ on_argEdit_editingFinished

void ArgInfoGUI::on_argEdit_editingFinished ( )
privateslot

Definition at line 379 of file arginfogui.cpp.

References setStringValue(), ui, and valueChanged().

380 {
381  setStringValue(ui->argEdit->text());
382  emit valueChanged();
383 }
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
void valueChanged()
void setStringValue(const QString &value)
Definition: arginfogui.cpp:193
+ Here is the call graph for this function:

◆ setBoolValue()

void ArgInfoGUI::setBoolValue ( bool  value)

Definition at line 100 of file arginfogui.cpp.

References ArgInfoValueBool, ArgInfoValueFloat, ArgInfoValueInt, ArgInfoValueString, m_boolValue, m_floatValue, m_intValue, m_stringValue, m_valueType, setDoubleValue(), setIntegerValue(), updateUIFromBool(), updateUIFromFloat(), updateUIFromInt(), and updateUIFromString().

Referenced by on_argCheck_toggled(), on_argCombo_currentIndexChanged(), and DynamicArgSettingGUI::setValue().

101 {
103  {
104  m_boolValue = value;
106  }
107  else if (m_valueType == ArgInfoValueInt)
108  {
109  m_intValue = setIntegerValue(value ? 1 : 0);
110  updateUIFromInt();
111  }
112  else if (m_valueType == ArgInfoValueFloat)
113  {
114  m_floatValue = setDoubleValue(value ? 1.0 : 0.0);
116  }
117  else if (m_valueType == ArgInfoValueString)
118  {
119  m_stringValue = QString(value ? "true" : "false");
121  }
122 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
void updateUIFromString()
Definition: arginfogui.cpp:339
double setDoubleValue(double value)
Definition: arginfogui.cpp:235
QString m_stringValue
Definition: arginfogui.h:98
bool m_boolValue
Definition: arginfogui.h:95
int setIntegerValue(int value)
Definition: arginfogui.cpp:226
void updateUIFromFloat()
Definition: arginfogui.cpp:304
void updateUIFromInt()
Definition: arginfogui.cpp:269
void updateUIFromBool()
Definition: arginfogui.cpp:244
double m_floatValue
Definition: arginfogui.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDoubleValue()

double ArgInfoGUI::setDoubleValue ( double  value)
private

Definition at line 235 of file arginfogui.cpp.

References m_hasRange, and m_maxValue.

Referenced by addFloatValue(), setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

236 {
237  if (m_hasRange) {
238  return value < m_minValue ? m_minValue : value > m_maxValue ? m_maxValue : value;
239  } else {
240  return value;
241  }
242 }
double m_maxValue
Definition: arginfogui.h:101
bool m_hasRange
Definition: arginfogui.h:99
+ Here is the caller graph for this function:

◆ setFloatValue()

void ArgInfoGUI::setFloatValue ( double  value)

Definition at line 162 of file arginfogui.cpp.

References ArgInfoValueBool, ArgInfoValueFloat, ArgInfoValueInt, ArgInfoValueString, m_boolValue, m_floatValue, m_intValue, m_stringValue, m_valueType, setDoubleValue(), setIntegerValue(), updateUIFromBool(), updateUIFromFloat(), updateUIFromInt(), and updateUIFromString().

Referenced by on_argCombo_currentIndexChanged(), and DynamicArgSettingGUI::setValue().

163 {
165  {
166  m_boolValue = (value != 0.0);
168  }
169  else if (m_valueType == ArgInfoValueInt)
170  {
171  m_intValue = setIntegerValue(value);
172  updateUIFromInt();
173  }
174  else if (m_valueType == ArgInfoValueFloat)
175  {
176  m_floatValue = setDoubleValue(value);
178  }
179  else if (m_valueType == ArgInfoValueString)
180  {
181  m_stringValue = QString("%1").arg(value);
183  }
184 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
void updateUIFromString()
Definition: arginfogui.cpp:339
double setDoubleValue(double value)
Definition: arginfogui.cpp:235
QString m_stringValue
Definition: arginfogui.h:98
bool m_boolValue
Definition: arginfogui.h:95
int setIntegerValue(int value)
Definition: arginfogui.cpp:226
void updateUIFromFloat()
Definition: arginfogui.cpp:304
void updateUIFromInt()
Definition: arginfogui.cpp:269
void updateUIFromBool()
Definition: arginfogui.cpp:244
double m_floatValue
Definition: arginfogui.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIntegerValue()

int ArgInfoGUI::setIntegerValue ( int  value)
private

Definition at line 226 of file arginfogui.cpp.

References m_hasRange, and m_maxValue.

Referenced by addIntValue(), setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

227 {
228  if (m_hasRange) {
229  return value < round(m_minValue) ? round(m_minValue) : value > round(m_maxValue) ? round(m_maxValue) : value;
230  } else {
231  return value;
232  }
233 }
double m_maxValue
Definition: arginfogui.h:101
bool m_hasRange
Definition: arginfogui.h:99
+ Here is the caller graph for this function:

◆ setIntValue()

void ArgInfoGUI::setIntValue ( int  value)

Definition at line 131 of file arginfogui.cpp.

References ArgInfoValueBool, ArgInfoValueFloat, ArgInfoValueInt, ArgInfoValueString, m_boolValue, m_floatValue, m_intValue, m_stringValue, m_valueType, setDoubleValue(), setIntegerValue(), updateUIFromBool(), updateUIFromFloat(), updateUIFromInt(), and updateUIFromString().

Referenced by on_argCombo_currentIndexChanged(), and DynamicArgSettingGUI::setValue().

132 {
134  {
135  m_boolValue = (value != 0);
137  }
138  else if (m_valueType == ArgInfoValueInt)
139  {
140  m_intValue = setIntegerValue(value);
141  updateUIFromInt();
142  }
143  else if (m_valueType == ArgInfoValueFloat)
144  {
145  m_floatValue = setDoubleValue(value);
147  }
148  else if (m_valueType == ArgInfoValueString)
149  {
150  m_stringValue = QString("%1").arg(value);
152  }
153 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
void updateUIFromString()
Definition: arginfogui.cpp:339
double setDoubleValue(double value)
Definition: arginfogui.cpp:235
QString m_stringValue
Definition: arginfogui.h:98
bool m_boolValue
Definition: arginfogui.h:95
int setIntegerValue(int value)
Definition: arginfogui.cpp:226
void updateUIFromFloat()
Definition: arginfogui.cpp:304
void updateUIFromInt()
Definition: arginfogui.cpp:269
void updateUIFromBool()
Definition: arginfogui.cpp:244
double m_floatValue
Definition: arginfogui.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLabel()

void ArgInfoGUI::setLabel ( const QString &  text)

Definition at line 79 of file arginfogui.cpp.

References ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

80 {
81  ui->argLabel->setText(text);
82 }
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the caller graph for this function:

◆ setRange()

void ArgInfoGUI::setRange ( double  min,
double  max 
)

Definition at line 72 of file arginfogui.cpp.

References m_hasRange, m_maxValue, m_minValue, leansdr::max(), and leansdr::min().

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

73 {
74  m_hasRange = true;
75  m_minValue = min;
76  m_maxValue = max;
77 }
double m_maxValue
Definition: arginfogui.h:101
double m_minValue
Definition: arginfogui.h:100
bool m_hasRange
Definition: arginfogui.h:99
T max(const T &x, const T &y)
Definition: framework.h:446
T min(const T &x, const T &y)
Definition: framework.h:440
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStringValue()

void ArgInfoGUI::setStringValue ( const QString &  value)

Definition at line 193 of file arginfogui.cpp.

References ArgInfoValueBool, ArgInfoValueFloat, ArgInfoValueInt, ArgInfoValueString, m_boolValue, m_floatValue, m_intValue, m_stringValue, m_valueType, setDoubleValue(), setIntegerValue(), updateUIFromBool(), updateUIFromFloat(), updateUIFromInt(), and updateUIFromString().

Referenced by on_argCombo_currentIndexChanged(), on_argEdit_editingFinished(), and DynamicArgSettingGUI::setValue().

194 {
196  {
197  m_boolValue = (value == "true");
199  }
200  else if (m_valueType == ArgInfoValueInt)
201  {
202  int intValue = atoi(value.toStdString().c_str());
203  m_intValue = setIntegerValue(intValue);
204  updateUIFromInt();
205  }
206  else if (m_valueType == ArgInfoValueFloat)
207  {
208  double doubleValue = atof(value.toStdString().c_str());
209  m_floatValue = setDoubleValue(doubleValue);
211  }
212  else if (m_valueType == ArgInfoValueString)
213  {
214  m_stringValue = value;
216  }
217 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoValueType m_valueType
Definition: arginfogui.h:94
void updateUIFromString()
Definition: arginfogui.cpp:339
double setDoubleValue(double value)
Definition: arginfogui.cpp:235
QString m_stringValue
Definition: arginfogui.h:98
bool m_boolValue
Definition: arginfogui.h:95
int setIntegerValue(int value)
Definition: arginfogui.cpp:226
void updateUIFromFloat()
Definition: arginfogui.cpp:304
void updateUIFromInt()
Definition: arginfogui.cpp:269
void updateUIFromBool()
Definition: arginfogui.cpp:244
double m_floatValue
Definition: arginfogui.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setToolTip()

void ArgInfoGUI::setToolTip ( const QString &  text)

Definition at line 84 of file arginfogui.cpp.

References ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, m_type, and ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

85 {
86  if (m_type == ArgInfoBinary) {
87  ui->argCheck->setToolTip(text);
88  } else if (m_type == ArgInfoContinuous) {
89  ui->argEdit->setToolTip(text);
90  } else if (m_type == ArgInfoDiscrete) {
91  ui->argCombo->setToolTip(text);
92  }
93 }
ArgInfoType m_type
Definition: arginfogui.h:93
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the caller graph for this function:

◆ setUnits()

void ArgInfoGUI::setUnits ( const QString &  units)

Definition at line 95 of file arginfogui.cpp.

References ui.

Referenced by SoapySDRInputGui::createArgumentsControl(), and SoapySDROutputGui::createArgumentsControl().

96 {
97  ui->argUnits->setText(units);
98 }
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the caller graph for this function:

◆ updateUIFromBool()

void ArgInfoGUI::updateUIFromBool ( )
private

Definition at line 244 of file arginfogui.cpp.

References ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, m_boolValue, m_type, and ui.

Referenced by setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

245 {
246  if (m_type == ArgInfoBinary)
247  {
248  ui->argCheck->blockSignals(true);
249  ui->argCheck->setChecked(m_boolValue);
250  ui->argCheck->blockSignals(false);
251  }
252  else if (m_type == ArgInfoContinuous)
253  {
254  ui->argEdit->blockSignals(true);
255  ui->argEdit->setText(QString(m_boolValue ? "true" : "false"));
256  ui->argEdit->blockSignals(false);
257  }
258  else if (m_type == ArgInfoDiscrete)
259  {
260  if (ui->argCombo->count() > 1)
261  {
262  ui->argCombo->blockSignals(true);
263  ui->argCombo->setCurrentIndex(m_boolValue ? 0 : 1);
264  ui->argCombo->blockSignals(false);
265  }
266  }
267 }
ArgInfoType m_type
Definition: arginfogui.h:93
bool m_boolValue
Definition: arginfogui.h:95
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
+ Here is the caller graph for this function:

◆ updateUIFromFloat()

void ArgInfoGUI::updateUIFromFloat ( )
private

Definition at line 304 of file arginfogui.cpp.

References arg(), ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, i, m_floatValue, m_type, and ui.

Referenced by setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

305 {
306  if (m_type == ArgInfoBinary)
307  {
308  ui->argCheck->blockSignals(true);
309  ui->argCheck->setChecked(m_floatValue == 0.0 ? false : true);
310  ui->argCheck->blockSignals(false);
311  }
312  else if (m_type == ArgInfoContinuous)
313  {
314  ui->argEdit->blockSignals(true);
315  ui->argEdit->setText(QString("%1").arg(m_floatValue));
316  ui->argEdit->blockSignals(false);
317  }
318  else if (m_type == ArgInfoDiscrete)
319  {
320  for (int i = 0; i < ui->argCombo->count(); i++)
321  {
322  if (ui->argCombo->itemData(i).type() == QVariant::Double)
323  {
324  bool ok = false;
325  QVariant v = ui->argCombo->itemData(i);
326 
327  if (m_floatValue >= v.toDouble(&ok) && ok)
328  {
329  ui->argCombo->blockSignals(true);
330  ui->argCombo->setCurrentIndex(i);
331  ui->argCombo->blockSignals(false);
332  break;
333  }
334  }
335  }
336  }
337 }
ArgInfoType m_type
Definition: arginfogui.h:93
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
int32_t i
Definition: decimators.h:244
double m_floatValue
Definition: arginfogui.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateUIFromInt()

void ArgInfoGUI::updateUIFromInt ( )
private

Definition at line 269 of file arginfogui.cpp.

References arg(), ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, i, m_intValue, m_type, and ui.

Referenced by setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

270 {
271  if (m_type == ArgInfoBinary)
272  {
273  ui->argCheck->blockSignals(true);
274  ui->argCheck->setChecked(m_intValue == 0 ? false : true);
275  ui->argCheck->blockSignals(false);
276  }
277  else if (m_type == ArgInfoContinuous)
278  {
279  ui->argEdit->blockSignals(true);
280  ui->argEdit->setText(QString("%1").arg(m_intValue));
281  ui->argEdit->blockSignals(false);
282  }
283  else if (m_type == ArgInfoDiscrete)
284  {
285  for (int i = 0; i < ui->argCombo->count(); i++)
286  {
287  if (ui->argCombo->itemData(i).type() == QVariant::Int)
288  {
289  bool ok = false;
290  QVariant v = ui->argCombo->itemData(i);
291 
292  if (m_intValue >= v.toInt(&ok) && ok)
293  {
294  ui->argCombo->blockSignals(true);
295  ui->argCombo->setCurrentIndex(i);
296  ui->argCombo->blockSignals(false);
297  break;
298  }
299  }
300  }
301  }
302 }
int m_intValue
Definition: arginfogui.h:96
ArgInfoType m_type
Definition: arginfogui.h:93
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
int32_t i
Definition: decimators.h:244
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateUIFromString()

void ArgInfoGUI::updateUIFromString ( )
private

Definition at line 339 of file arginfogui.cpp.

References ArgInfoBinary, ArgInfoContinuous, ArgInfoDiscrete, i, m_stringValue, m_type, and ui.

Referenced by setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

340 {
341  if (m_type == ArgInfoBinary)
342  {
343  ui->argCheck->blockSignals(true);
344  ui->argCheck->setChecked(m_stringValue == "true" ? true : false);
345  ui->argCheck->blockSignals(false);
346  }
347  else if (m_type == ArgInfoContinuous)
348  {
349  ui->argEdit->blockSignals(true);
350  ui->argEdit->setText(m_stringValue);
351  ui->argEdit->blockSignals(false);
352  }
353  else if (m_type == ArgInfoDiscrete)
354  {
355  for (int i = 0; i < ui->argCombo->count(); i++)
356  {
357  if (ui->argCombo->itemData(i).type() == QVariant::String)
358  {
359  QVariant v = ui->argCombo->itemData(i);
360 
361  if (m_stringValue == v.toString())
362  {
363  ui->argCombo->blockSignals(true);
364  ui->argCombo->setCurrentIndex(i);
365  ui->argCombo->blockSignals(false);
366  break;
367  }
368  }
369  }
370  }
371 }
ArgInfoType m_type
Definition: arginfogui.h:93
QString m_stringValue
Definition: arginfogui.h:98
Ui::ArgInfoGUI * ui
Definition: arginfogui.h:92
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ valueChanged

void ArgInfoGUI::valueChanged ( )
signal

Referenced by on_argCheck_toggled(), on_argCombo_currentIndexChanged(), and on_argEdit_editingFinished().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_boolValue

bool ArgInfoGUI::m_boolValue
private

◆ m_floatValue

double ArgInfoGUI::m_floatValue
private

◆ m_hasRange

bool ArgInfoGUI::m_hasRange
private

Definition at line 99 of file arginfogui.h.

Referenced by setDoubleValue(), setIntegerValue(), and setRange().

◆ m_intValue

int ArgInfoGUI::m_intValue
private

◆ m_maxValue

double ArgInfoGUI::m_maxValue
private

Definition at line 101 of file arginfogui.h.

Referenced by setDoubleValue(), setIntegerValue(), and setRange().

◆ m_minValue

double ArgInfoGUI::m_minValue
private

Definition at line 100 of file arginfogui.h.

Referenced by setRange().

◆ m_stringValue

QString ArgInfoGUI::m_stringValue
private

◆ m_type

ArgInfoType ArgInfoGUI::m_type
private

◆ m_valueType

ArgInfoValueType ArgInfoGUI::m_valueType
private

Definition at line 94 of file arginfogui.h.

Referenced by ArgInfoGUI(), setBoolValue(), setFloatValue(), setIntValue(), and setStringValue().

◆ ui

Ui::ArgInfoGUI* ArgInfoGUI::ui
private

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