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.
basicchannelsettingsdialog.cpp
Go to the documentation of this file.
1 #include <QColorDialog>
2 
3 #include "dsp/channelmarker.h"
4 
6 #include "ui_basicchannelsettingsdialog.h"
7 
9  QDialog(parent),
11  m_channelMarker(marker),
12  m_hasChanged(false)
13 {
14  ui->setupUi(this);
15  ui->title->setText(m_channelMarker->getTitle());
17  ui->fScaleDisplayType->setCurrentIndex((int) m_channelMarker->getFrequencyScaleDisplayType());
18  setUseReverseAPI(false);
19  setReverseAPIAddress("127.0.0.1");
20  setReverseAPIPort(8888);
23  paintColor();
24 }
25 
27 {
28  delete ui;
29 }
30 
32 {
34  ui->reverseAPI->setChecked(m_useReverseAPI);
35 }
36 
38 {
39  m_reverseAPIAddress = address;
40  ui->reverseAPIAddress->setText(m_reverseAPIAddress);
41 }
42 
44 {
45  if (port < 1024) {
46  return;
47  } else {
48  m_reverseAPIPort = port;
49  }
50 
51  ui->reverseAPIPort->setText(tr("%1").arg(m_reverseAPIPort));
52 }
53 
55 {
56  m_reverseAPIDeviceIndex = deviceIndex > 99 ? 99 : deviceIndex;
57  ui->reverseAPIDeviceIndex->setText(tr("%1").arg(m_reverseAPIDeviceIndex));
58 }
59 
61 {
62  m_reverseAPIChannelIndex = channelIndex > 99 ? 99 : channelIndex;
63  ui->reverseAPIChannelIndex->setText(tr("%1").arg(m_reverseAPIChannelIndex));
64 }
65 
67 {
68  QPixmap pm(24, 24);
69  pm.fill(m_color);
70  ui->colorBtn->setIcon(pm);
71  ui->colorText->setText(tr("#%1%2%3")
72  .arg(m_color.red(), 2, 16, QChar('0'))
73  .arg(m_color.green(), 2, 16, QChar('0'))
74  .arg(m_color.blue(), 2, 16, QChar('0')));
75 }
76 
78 {
79  QColor c = m_color;
80  c = QColorDialog::getColor(c, this, tr("Select Color for Channel"), QColorDialog::DontUseNativeDialog);
81 
82  if (c.isValid())
83  {
84  m_color = c;
85  paintColor();
86  }
87 }
88 
90 {
91  m_useReverseAPI = checked;
92 }
93 
95 {
96  m_reverseAPIAddress = ui->reverseAPIAddress->text();
97 }
98 
100 {
101  bool dataOk;
102  int reverseAPIPort = ui->reverseAPIPort->text().toInt(&dataOk);
103 
104  if((!dataOk) || (reverseAPIPort < 1024) || (reverseAPIPort > 65535)) {
105  return;
106  } else {
107  m_reverseAPIPort = reverseAPIPort;
108  }
109 }
110 
112 {
113  bool dataOk;
114  int reverseAPIDeviceIndex = ui->reverseAPIDeviceIndex->text().toInt(&dataOk);
115 
116  if ((!dataOk) || (reverseAPIDeviceIndex < 0)) {
117  return;
118  } else {
119  m_reverseAPIDeviceIndex = reverseAPIDeviceIndex;
120  }
121 }
122 
124 {
125  bool dataOk;
126  int reverseAPIChannelIndex = ui->reverseAPIChannelIndex->text().toInt(&dataOk);
127 
128  if ((!dataOk) || (reverseAPIChannelIndex < 0)) {
129  return;
130  } else {
131  m_reverseAPIChannelIndex = reverseAPIChannelIndex;
132  }
133 }
134 
136 {
137  m_channelMarker->blockSignals(true);
138  m_channelMarker->setTitle(ui->title->text());
139 
140  if(m_color.isValid()) {
142  }
143 
145  m_channelMarker->blockSignals(false);
146 
147  m_hasChanged = true;
148  QDialog::accept();
149 }
enum ChannelMarker::frequencyScaleDisplay_e frequencyScaleDisplay_t
frequencyScaleDisplay_t getFrequencyScaleDisplayType() const
Definition: channelmarker.h:70
void setFrequencyScaleDisplayType(frequencyScaleDisplay_t type)
Definition: channelmarker.h:69
void setReverseAPIChannelIndex(uint16_t channelIndex)
BasicChannelSettingsDialog(ChannelMarker *marker, QWidget *parent=0)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
unsigned short uint16_t
Definition: rtptypes_win.h:44
Ui::BasicChannelSettingsDialog * ui
const QString & getTitle() const
Definition: channelmarker.h:38
void setReverseAPIAddress(const QString &address)
void setColor(const QColor &color)
const QColor & getColor() const
Definition: channelmarker.h:64
void setTitle(const QString &title)
void setUseReverseAPI(bool useReverseAPI)