10 changed files with 345 additions and 20 deletions
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wsspectrumsettingsdialog.h" |
||||
#include "ui_wsspectrumsettingsdialog.h" |
||||
|
||||
WebsocketSpectrumSettingsDialog::WebsocketSpectrumSettingsDialog(QWidget *parent) : |
||||
QDialog(parent), |
||||
ui(new Ui::WebsocketSpectrumSettingsDialog), |
||||
m_hasChanged(false) |
||||
{ |
||||
ui->setupUi(this); |
||||
setAddress("127.0.0.1"); |
||||
setPort(8887); |
||||
} |
||||
|
||||
WebsocketSpectrumSettingsDialog::~WebsocketSpectrumSettingsDialog() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void WebsocketSpectrumSettingsDialog::setAddress(const QString& address) |
||||
{ |
||||
m_address = address; |
||||
ui->address->setText(m_address); |
||||
} |
||||
|
||||
void WebsocketSpectrumSettingsDialog::setPort(uint16_t port) |
||||
{ |
||||
if (port < 1024) { |
||||
return; |
||||
} else { |
||||
m_port = port; |
||||
} |
||||
|
||||
ui->port->setText(tr("%1").arg(m_port)); |
||||
} |
||||
|
||||
void WebsocketSpectrumSettingsDialog::on_address_editingFinished() |
||||
{ |
||||
m_address = ui->address->text(); |
||||
} |
||||
|
||||
void WebsocketSpectrumSettingsDialog::on_port_editingFinished() |
||||
{ |
||||
bool dataOk; |
||||
int port = ui->port->text().toInt(&dataOk); |
||||
|
||||
if ((!dataOk) || (port < 1024) || (port > 65535)) { |
||||
return; |
||||
} else { |
||||
m_port = port; |
||||
} |
||||
} |
||||
|
||||
void WebsocketSpectrumSettingsDialog::accept() |
||||
{ |
||||
m_hasChanged = true; |
||||
QDialog::accept(); |
||||
} |
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WSSPECTRUMSETTINGSDIALOG_H |
||||
#define WSSPECTRUMSETTINGSDIALOG_H |
||||
|
||||
#include <QDialog> |
||||
|
||||
#include "../../exports/export.h" |
||||
|
||||
namespace Ui { |
||||
class WebsocketSpectrumSettingsDialog; |
||||
} |
||||
|
||||
class SDRGUI_API WebsocketSpectrumSettingsDialog : public QDialog |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit WebsocketSpectrumSettingsDialog(QWidget *parent = nullptr); |
||||
~WebsocketSpectrumSettingsDialog(); |
||||
bool hasChanged() const { return m_hasChanged; } |
||||
const QString& getAddress() const { return m_address; } |
||||
uint16_t getPort() const { return m_port; } |
||||
void setAddress(const QString& address); |
||||
void setPort(uint16_t port); |
||||
|
||||
private slots: |
||||
void on_address_editingFinished(); |
||||
void on_port_editingFinished(); |
||||
void accept(); |
||||
|
||||
private: |
||||
Ui::WebsocketSpectrumSettingsDialog *ui; |
||||
QString m_address; |
||||
uint16_t m_port; |
||||
bool m_hasChanged; |
||||
}; |
||||
|
||||
#endif // BASICDEVICESETTINGSDIALOG_H
|
||||
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>WebsocketSpectrumSettingsDialog</class> |
||||
<widget class="QDialog" name="WebsocketSpectrumSettingsDialog"> |
||||
<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>Websocket spectrum settings</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="wsServerLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="addressLabel"> |
||||
<property name="text"> |
||||
<string>Addr</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QLineEdit" name="address"> |
||||
<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="portLabel"> |
||||
<property name="text"> |
||||
<string>Port</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QLineEdit" name="port"> |
||||
<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>8887</string> |
||||
</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>WebsocketSpectrumSettingsDialog</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>WebsocketSpectrumSettingsDialog</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> |
||||
Loading…
Reference in new issue