DSD demodulator: implemented now channel marker settings with UDP parameters

This commit is contained in:
f4exb 2017-08-23 23:44:12 +02:00
parent 7d4eddbeac
commit 0c0bf2e094
3 changed files with 39 additions and 10 deletions

View File

@ -110,6 +110,9 @@ QByteArray DSDDemodGUI::serialize() const
s.writeBool(14, m_slot1On);
s.writeBool(15, m_slot2On);
s.writeBool(16, m_tdmaStereo);
s.writeString(17, m_channelMarker.getTitle());
s.writeString(18, m_channelMarker.getUDPAddress());
s.writeU32(19, (quint32) m_channelMarker.getUDPPort());
return s.final();
}
@ -126,6 +129,7 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
if (d.getVersion() == 1)
{
QByteArray bytetmp;
QString strtmp;
quint32 u32tmp;
qint32 tmp;
@ -161,6 +165,13 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
d.readBool(14, &m_slot1On, false);
d.readBool(15, &m_slot2On, false);
d.readBool(16, &m_tdmaStereo, false);
d.readString(17, &strtmp, "DSD Demodulator");
m_channelMarker.setTitle(strtmp);
this->setWindowTitle(m_channelMarker.getTitle());
d.readString(18, &strtmp, "127.0.0.1");
m_channelMarker.setUDPAddress(strtmp);
d.readU32(19, &u32tmp, 9999);
m_channelMarker.setUDPPort(u32tmp);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@ -181,11 +192,6 @@ bool DSDDemodGUI::handleMessage(const Message& message __attribute__((unused)))
return false;
}
void DSDDemodGUI::viewChanged()
{
applySettings();
}
void DSDDemodGUI::on_deltaFrequency_changed(qint64 value)
{
m_channelMarker.setCenterFrequency(value);
@ -288,8 +294,15 @@ void DSDDemodGUI::onMenuDoubleClicked()
if (!m_basicSettingsShown)
{
m_basicSettingsShown = true;
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this);
bcsw->show();
m_bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this);
m_bcsw->show();
}
else
{
m_basicSettingsShown = false;
m_bcsw->hide();
delete m_bcsw;
m_bcsw = 0;
}
}
@ -308,7 +321,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
m_slot2On(false),
m_tdmaStereo(false),
m_squelchOpen(false),
m_tickCount(0)
m_tickCount(0),
m_bcsw(0)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
@ -344,7 +358,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
m_channelMarker.setCenterFrequency(0);
m_channelMarker.setVisible(true);
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
m_deviceAPI->registerChannelInstance(m_channelID, this);
m_deviceAPI->addChannelMarker(&m_channelMarker);
@ -358,6 +372,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
DSDDemodGUI::~DSDDemodGUI()
{
if (m_bcsw) delete m_bcsw;
m_deviceAPI->removeChannelInstance(this);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer;
@ -580,6 +595,13 @@ void DSDDemodGUI::formatStatusText()
m_formatStatusText[82] = '\0'; // guard
}
void DSDDemodGUI::channelMarkerChanged()
{
this->setWindowTitle(m_channelMarker.getTitle());
applySettings();
}
void DSDDemodGUI::tick()
{
double magsqAvg, magsqPeak;

View File

@ -18,6 +18,8 @@
#ifndef INCLUDE_DSDDEMODGUI_H
#define INCLUDE_DSDDEMODGUI_H
#include <QMenu>
#include "gui/rollupwidget.h"
#include "plugin/plugingui.h"
#include "dsp/dsptypes.h"
@ -26,6 +28,7 @@
class PluginAPI;
class DeviceSourceAPI;
class BasicChannelSettingsWidget;
class ThreadedBasebandSampleSink;
class DownChannelizer;
@ -57,8 +60,8 @@ public:
static const QString m_channelID;
private slots:
void viewChanged();
void formatStatusText();
void channelMarkerChanged();
void on_deltaFrequency_changed(qint64 value);
void on_rfBW_valueChanged(int index);
void on_demodGain_valueChanged(int value);
@ -114,6 +117,7 @@ private:
float m_myLatitude;
float m_myLongitude;
BasicChannelSettingsWidget *m_bcsw;
explicit DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~DSDDemodGUI();

View File

@ -31,6 +31,9 @@
<property name="windowTitle">
<string>DSD Demodulator</string>
</property>
<property name="statusTip">
<string>DSD Demodulator</string>
</property>
<widget class="QWidget" name="settingsContainer" native="true">
<property name="geometry">
<rect>