kopia lustrzana https://github.com/f4exb/sdrangel
Reverse API: created basic device settings dialog similar to channel one. Connected it to RTL-SDR
rodzic
2e58818776
commit
6f81f4a7d7
|
@ -27,6 +27,7 @@
|
|||
#include "gui/colormapper.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "gui/crightclickenabler.h"
|
||||
#include "gui/basicdevicesettingsdialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
|
||||
|
@ -475,7 +476,7 @@ void RTLSDRGui::on_lowSampleRate_toggled(bool checked)
|
|||
|
||||
void RTLSDRGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
{
|
||||
QMessageBox m(QMessageBox::Information, tr("Message"), tr("RTLSDRGui::openDeviceSettingsDialog"));
|
||||
m.move(p);
|
||||
m.exec();
|
||||
BasicDeviceSettingsDialog dialog(this);
|
||||
dialog.move(p);
|
||||
dialog.exec();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ set(sdrgui_SOURCES
|
|||
gui/audiodialog.cpp
|
||||
gui/audioselectdialog.cpp
|
||||
gui/basicchannelsettingsdialog.cpp
|
||||
gui/basicdevicesettingsdialog.cpp
|
||||
gui/buttonswitch.cpp
|
||||
gui/channelwindow.cpp
|
||||
gui/clickablelabel.cpp
|
||||
|
@ -76,6 +77,7 @@ set(sdrgui_HEADERS
|
|||
gui/audiodialog.h
|
||||
gui/audioselectdialog.h
|
||||
gui/basicchannelsettingsdialog.h
|
||||
gui/basicdevicesettingsdialog.h
|
||||
gui/buttonswitch.h
|
||||
gui/channelwindow.h
|
||||
gui/colormapper.h
|
||||
|
@ -146,6 +148,7 @@ set(sdrgui_FORMS
|
|||
gui/aboutdialog.ui
|
||||
gui/addpresetdialog.ui
|
||||
gui/basicchannelsettingsdialog.ui
|
||||
gui/basicdevicesettingsdialog.ui
|
||||
gui/commandoutputdialog.ui
|
||||
gui/cwkeyergui.ui
|
||||
gui/editcommanddialog.ui
|
||||
|
|
|
@ -18,6 +18,8 @@ BasicChannelSettingsDialog::BasicChannelSettingsDialog(ChannelMarker* marker, QW
|
|||
setUseReverseAPI(false);
|
||||
setReverseAPIAddress("127.0.0.1");
|
||||
setReverseAPIPort(8888);
|
||||
setReverseAPIDeviceIndex(0);
|
||||
setReverseAPIChannelIndex(0);
|
||||
paintColor();
|
||||
}
|
||||
|
||||
|
@ -106,6 +108,30 @@ void BasicChannelSettingsDialog::on_reverseAPIPort_returnPressed()
|
|||
}
|
||||
}
|
||||
|
||||
void BasicChannelSettingsDialog::on_reverseAPIDeviceIndex_returnPressed()
|
||||
{
|
||||
bool dataOk;
|
||||
int reverseAPIDeviceIndex = ui->reverseAPIDeviceIndex->text().toInt(&dataOk);
|
||||
|
||||
if ((!dataOk) || (reverseAPIDeviceIndex < 0)) {
|
||||
return;
|
||||
} else {
|
||||
m_reverseAPIDeviceIndex = reverseAPIDeviceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicChannelSettingsDialog::on_reverseAPIChannelIndex_returnPressed()
|
||||
{
|
||||
bool dataOk;
|
||||
int reverseAPIChannelIndex = ui->reverseAPIChannelIndex->text().toInt(&dataOk);
|
||||
|
||||
if ((!dataOk) || (reverseAPIChannelIndex < 0)) {
|
||||
return;
|
||||
} else {
|
||||
m_reverseAPIChannelIndex = reverseAPIChannelIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicChannelSettingsDialog::accept()
|
||||
{
|
||||
m_channelMarker->blockSignals(true);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#include "export.h"
|
||||
#include "../../exports/export.h"
|
||||
|
||||
namespace Ui {
|
||||
class BasicChannelSettingsDialog;
|
||||
|
@ -35,6 +35,8 @@ private slots:
|
|||
void on_reverseAPI_toggled(bool checked);
|
||||
void on_reverseAPIAddress_returnPressed();
|
||||
void on_reverseAPIPort_returnPressed();
|
||||
void on_reverseAPIDeviceIndex_returnPressed();
|
||||
void on_reverseAPIChannelIndex_returnPressed();
|
||||
void accept();
|
||||
|
||||
private:
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
#include "basicdevicesettingsdialog.h"
|
||||
#include "ui_basicdevicesettingsdialog.h"
|
||||
|
||||
BasicDeviceSettingsDialog::BasicDeviceSettingsDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::BasicDeviceSettingsDialog),
|
||||
m_hasChanged(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setUseReverseAPI(false);
|
||||
setReverseAPIAddress("127.0.0.1");
|
||||
setReverseAPIPort(8888);
|
||||
setReverseAPIDeviceIndex(0);
|
||||
}
|
||||
|
||||
BasicDeviceSettingsDialog::~BasicDeviceSettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::setUseReverseAPI(bool useReverseAPI)
|
||||
{
|
||||
m_useReverseAPI = useReverseAPI;
|
||||
ui->reverseAPI->setChecked(m_useReverseAPI);
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::setReverseAPIAddress(const QString& address)
|
||||
{
|
||||
m_reverseAPIAddress = address;
|
||||
ui->reverseAPIAddress->setText(m_reverseAPIAddress);
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::setReverseAPIPort(uint16_t port)
|
||||
{
|
||||
if (port < 1024) {
|
||||
return;
|
||||
} else {
|
||||
m_reverseAPIPort = port;
|
||||
}
|
||||
|
||||
ui->reverseAPIPort->setText(tr("%1").arg(m_reverseAPIPort));
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::setReverseAPIDeviceIndex(uint16_t deviceIndex)
|
||||
{
|
||||
m_reverseAPIDeviceIndex = deviceIndex > 99 ? 99 : deviceIndex;
|
||||
ui->reverseAPIDeviceIndex->setText(tr("%1").arg(m_reverseAPIDeviceIndex));
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::on_reverseAPI_toggled(bool checked)
|
||||
{
|
||||
m_useReverseAPI = checked;
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::on_reverseAPIAddress_returnPressed()
|
||||
{
|
||||
m_reverseAPIAddress = ui->reverseAPIAddress->text();
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::on_reverseAPIPort_returnPressed()
|
||||
{
|
||||
bool dataOk;
|
||||
int reverseAPIPort = ui->reverseAPIPort->text().toInt(&dataOk);
|
||||
|
||||
if((!dataOk) || (reverseAPIPort < 1024) || (reverseAPIPort > 65535)) {
|
||||
return;
|
||||
} else {
|
||||
m_reverseAPIPort = reverseAPIPort;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::on_reverseAPIDeviceIndex_returnPressed()
|
||||
{
|
||||
bool dataOk;
|
||||
int reverseAPIDeviceIndex = ui->reverseAPIDeviceIndex->text().toInt(&dataOk);
|
||||
|
||||
if ((!dataOk) || (reverseAPIDeviceIndex < 0)) {
|
||||
return;
|
||||
} else {
|
||||
m_reverseAPIDeviceIndex = reverseAPIDeviceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicDeviceSettingsDialog::accept()
|
||||
{
|
||||
m_hasChanged = true;
|
||||
QDialog::accept();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef BASICDEVICESETTINGSDIALOG_H
|
||||
#define BASICDEVICESETTINGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../../exports/export.h"
|
||||
|
||||
namespace Ui {
|
||||
class BasicDeviceSettingsDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API BasicDeviceSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BasicDeviceSettingsDialog(QWidget *parent = 0);
|
||||
~BasicDeviceSettingsDialog();
|
||||
bool hasChanged() const { return m_hasChanged; }
|
||||
bool useReverseAPI() const { return m_useReverseAPI; }
|
||||
const QString& getReverseAPIAddress() const { return m_reverseAPIAddress; }
|
||||
uint16_t getReverseAPIPort() const { return m_reverseAPIPort; }
|
||||
uint16_t getReverseAPIDeviceIndex() const { return m_reverseAPIDeviceIndex; }
|
||||
void setUseReverseAPI(bool useReverseAPI);
|
||||
void setReverseAPIAddress(const QString& address);
|
||||
void setReverseAPIPort(uint16_t port);
|
||||
void setReverseAPIDeviceIndex(uint16_t deviceIndex);
|
||||
|
||||
private slots:
|
||||
void on_reverseAPI_toggled(bool checked);
|
||||
void on_reverseAPIAddress_returnPressed();
|
||||
void on_reverseAPIPort_returnPressed();
|
||||
void on_reverseAPIDeviceIndex_returnPressed();
|
||||
void accept();
|
||||
|
||||
private:
|
||||
Ui::BasicDeviceSettingsDialog *ui;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
bool m_hasChanged;
|
||||
};
|
||||
|
||||
#endif // BASICDEVICESETTINGSDIALOG_H
|
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BasicDeviceSettingsDialog</class>
|
||||
<widget class="QDialog" name="BasicDeviceSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>394</width>
|
||||
<height>77</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Basic device settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="reverseAPILayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="reverseAPI">
|
||||
<property name="toolTip">
|
||||
<string>Sychronize with reverse API </string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>reverse API</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="reverseAPIAddress">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reverse API address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="reverseAPISeparator">
|
||||
<property name="text">
|
||||
<string>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="reverseAPIPort">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reverse API port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>8888</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="reverseAPIDeviceLabel">
|
||||
<property name="text">
|
||||
<string>D</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="reverseAPIDeviceIndex">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reverse API destination device index</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>BasicDeviceSettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>BasicDeviceSettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Ładowanie…
Reference in New Issue