mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 10:38:45 -04:00
DATV demod: added standard basic settings dialog
This commit is contained in:
parent
7780435cba
commit
bc7a227277
@ -118,3 +118,8 @@ void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
uint32_t DATVDemod::getNumberOfDeviceStreams() const
|
||||
{
|
||||
return m_deviceAPI->getNbSourceStreams();
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
|
||||
virtual int getNbSinkStreams() const { return 1; }
|
||||
virtual int getNbSourceStreams() const { return 0; }
|
||||
uint32_t getNumberOfDeviceStreams() const;
|
||||
|
||||
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||
{
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "ui_datvdemodgui.h"
|
||||
#include "gui/crightclickenabler.h"
|
||||
#include "gui/audioselectdialog.h"
|
||||
#include "gui/basicchannelsettingsdialog.h"
|
||||
#include "gui/devicestreamselectiondialog.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "datvdemodreport.h"
|
||||
@ -146,8 +148,49 @@ void DATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
(void) rollDown;
|
||||
}
|
||||
|
||||
void DATVDemodGUI::onMenuDoubleClicked()
|
||||
void DATVDemodGUI::onMenuDialogCalled(const QPoint &p)
|
||||
{
|
||||
if (m_contextMenuType == ContextMenuChannelSettings)
|
||||
{
|
||||
BasicChannelSettingsDialog dialog(&m_objChannelMarker, this);
|
||||
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
|
||||
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
|
||||
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
|
||||
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
|
||||
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
|
||||
dialog.move(p);
|
||||
dialog.exec();
|
||||
|
||||
m_settings.m_centerFrequency = m_objChannelMarker.getCenterFrequency();
|
||||
m_settings.m_rgbColor = m_objChannelMarker.getColor().rgb();
|
||||
m_settings.m_title = m_objChannelMarker.getTitle();
|
||||
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
|
||||
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
applySettings();
|
||||
}
|
||||
else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine))
|
||||
{
|
||||
DeviceStreamSelectionDialog dialog(this);
|
||||
dialog.setNumberOfStreams(m_objDATVDemod->getNumberOfDeviceStreams());
|
||||
dialog.setStreamIndex(m_settings.m_streamIndex);
|
||||
dialog.move(p);
|
||||
dialog.exec();
|
||||
|
||||
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
||||
m_objChannelMarker.clearStreamIndexes();
|
||||
m_objChannelMarker.addStreamIndex(m_settings.m_streamIndex);
|
||||
displayStreamIndex();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
resetContextMenuType();
|
||||
}
|
||||
|
||||
DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* objParent) :
|
||||
@ -166,6 +209,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
|
||||
ui->screenTV->setColor(true);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
|
||||
m_objDATVDemod = (DATVDemod*) rxChannel;
|
||||
@ -197,6 +241,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
|
||||
m_objChannelMarker.setColor(Qt::magenta);
|
||||
m_objChannelMarker.setBandwidth(6000000);
|
||||
m_objChannelMarker.setCenterFrequency(0);
|
||||
m_objChannelMarker.setTitle("DATV Demodulator");
|
||||
m_objChannelMarker.blockSignals(false);
|
||||
m_objChannelMarker.setVisible(true);
|
||||
|
||||
@ -238,9 +283,13 @@ void DATVDemodGUI::displaySettings()
|
||||
|
||||
m_objChannelMarker.setCenterFrequency(m_settings.m_centerFrequency);
|
||||
m_objChannelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
ui->deltaFrequency->setValue(m_settings.m_centerFrequency);
|
||||
m_objChannelMarker.setColor(m_settings.m_rgbColor);
|
||||
m_objChannelMarker.setTitle(m_settings.m_title);
|
||||
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
setWindowTitle(m_objChannelMarker.getTitle());
|
||||
|
||||
ui->deltaFrequency->setValue(m_settings.m_centerFrequency);
|
||||
ui->chkAllowDrift->setChecked(m_settings.m_allowDrift);
|
||||
ui->chkHardMetric->setChecked(m_settings.m_hardMetric);
|
||||
ui->chkFastlock->setChecked(m_settings.m_fastLock);
|
||||
@ -339,6 +388,15 @@ void DATVDemodGUI::displaySystemConfiguration()
|
||||
ui->cmbFEC->blockSignals(false);
|
||||
}
|
||||
|
||||
void DATVDemodGUI::displayStreamIndex()
|
||||
{
|
||||
if (m_deviceUISet->m_deviceMIMOEngine) {
|
||||
setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex));
|
||||
} else {
|
||||
setStreamIndicator("S"); // single channel indicator
|
||||
}
|
||||
}
|
||||
|
||||
void DATVDemodGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_blnDoApplySettings)
|
||||
|
@ -66,7 +66,7 @@ private slots:
|
||||
void channelMarkerHighlightedByCursor();
|
||||
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDoubleClicked();
|
||||
void onMenuDialogCalled(const QPoint& p);
|
||||
void handleInputMessages();
|
||||
void audioSelect();
|
||||
void tick();
|
||||
@ -129,6 +129,7 @@ private:
|
||||
void applySettings(bool force = false);
|
||||
void displaySettings();
|
||||
void displaySystemConfiguration();
|
||||
void displayStreamIndex();
|
||||
QString formatBytes(qint64 intBytes);
|
||||
|
||||
void displayRRCParameters(bool blnVisible);
|
||||
|
@ -58,6 +58,12 @@ void DATVDemodSettings::resetToDefaults()
|
||||
m_udpTSAddress = "127.0.0.1";
|
||||
m_udpTSPort = 8882;
|
||||
m_udpTS = false;
|
||||
m_streamIndex = 0;
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
m_reverseAPIDeviceIndex = 0;
|
||||
m_reverseAPIChannelIndex = 0;
|
||||
}
|
||||
|
||||
QByteArray DATVDemodSettings::serialize() const
|
||||
@ -91,6 +97,12 @@ QByteArray DATVDemodSettings::serialize() const
|
||||
s.writeString(23, m_udpTSAddress);
|
||||
s.writeU32(24, m_udpTSPort);
|
||||
s.writeBool(25, m_udpTS);
|
||||
s.writeS32(26, m_streamIndex);
|
||||
s.writeBool(27, m_useReverseAPI);
|
||||
s.writeString(28, m_reverseAPIAddress);
|
||||
s.writeU32(29, m_reverseAPIPort);
|
||||
s.writeU32(30, m_reverseAPIDeviceIndex);
|
||||
s.writeU32(31, m_reverseAPIChannelIndex);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -157,6 +169,21 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readU32(24, &utmp, 8882);
|
||||
m_udpTSPort = utmp < 1024 ? 1024 : utmp > 65536 ? 65535 : utmp;
|
||||
d.readBool(25, &m_udpTS, false);
|
||||
d.readS32(26, &m_streamIndex, 0);
|
||||
d.readBool(27, &m_useReverseAPI, false);
|
||||
d.readString(28, &m_reverseAPIAddress, "127.0.0.1");
|
||||
d.readU32(29, &utmp, 0);
|
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) {
|
||||
m_reverseAPIPort = utmp;
|
||||
} else {
|
||||
m_reverseAPIPort = 8888;
|
||||
}
|
||||
|
||||
d.readU32(30, &utmp, 0);
|
||||
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readU32(31, &utmp, 0);
|
||||
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
|
||||
|
||||
validateSystemConfiguration();
|
||||
|
||||
|
@ -96,6 +96,12 @@ struct DATVDemodSettings
|
||||
QString m_udpTSAddress;
|
||||
quint32 m_udpTSPort;
|
||||
bool m_udpTS;
|
||||
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx).
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
uint16_t m_reverseAPIChannelIndex;
|
||||
|
||||
DATVDemodSettings();
|
||||
void resetToDefaults();
|
||||
@ -116,4 +122,4 @@ struct DATVDemodSettings
|
||||
static DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation);
|
||||
};
|
||||
|
||||
#endif // PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
||||
#endif // PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
||||
|
Loading…
Reference in New Issue
Block a user