2018-02-22 16:52:49 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2018 F4HKW //
|
|
|
|
// for F4EXB / SDRAngel //
|
|
|
|
// using LeanSDR Framework (C) 2016 F4DAV //
|
|
|
|
// //
|
|
|
|
// 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 //
|
2019-04-11 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2018-02-22 16:52:49 -05:00
|
|
|
// //
|
|
|
|
// 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 <QDockWidget>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QMediaMetaData>
|
|
|
|
|
|
|
|
#include "datvdemodgui.h"
|
|
|
|
|
|
|
|
#include "device/deviceuiset.h"
|
|
|
|
#include "dsp/downchannelizer.h"
|
|
|
|
|
|
|
|
#include "dsp/threadedbasebandsamplesink.h"
|
|
|
|
#include "ui_datvdemodgui.h"
|
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "util/simpleserializer.h"
|
|
|
|
#include "util/db.h"
|
|
|
|
#include "dsp/dspengine.h"
|
2019-03-19 18:12:54 -04:00
|
|
|
#include "gui/crightclickenabler.h"
|
|
|
|
#include "gui/audioselectdialog.h"
|
2018-02-22 16:52:49 -05:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
const QString DATVDemodGUI::m_strChannelID = "sdrangel.channel.demoddatv";
|
|
|
|
|
|
|
|
DATVDemodGUI* DATVDemodGUI::create(PluginAPI* objPluginAPI,
|
|
|
|
DeviceUISet *deviceUISet,
|
|
|
|
BasebandSampleSink *rxChannel)
|
|
|
|
{
|
|
|
|
DATVDemodGUI* gui = new DATVDemodGUI(objPluginAPI, deviceUISet, rxChannel);
|
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::destroy()
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-02-22 16:52:49 -05:00
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::setName(const QString& strName)
|
|
|
|
{
|
|
|
|
setObjectName(strName);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString DATVDemodGUI::getName() const
|
|
|
|
{
|
|
|
|
return objectName();
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 DATVDemodGUI::getCenterFrequency() const
|
|
|
|
{
|
|
|
|
return m_objChannelMarker.getCenterFrequency();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency)
|
|
|
|
{
|
|
|
|
m_objChannelMarker.setCenterFrequency(intCenterFrequency);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::resetToDefaults()
|
|
|
|
{
|
2019-03-17 21:26:03 -04:00
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray DATVDemodGUI::serialize() const
|
|
|
|
{
|
2019-03-17 21:26:03 -04:00
|
|
|
return m_settings.serialize();
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DATVDemodGUI::deserialize(const QByteArray& arrData)
|
|
|
|
{
|
2019-03-17 21:26:03 -04:00
|
|
|
if (m_settings.deserialize(arrData))
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2019-03-17 21:26:03 -04:00
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
2018-02-22 16:52:49 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
bool DATVDemodGUI::handleMessage(const Message& message)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2019-07-16 20:51:46 -04:00
|
|
|
if (DATVDemod::MsgReportModcodCstlnChange::match(message))
|
|
|
|
{
|
|
|
|
DATVDemod::MsgReportModcodCstlnChange& notif = (DATVDemod::MsgReportModcodCstlnChange&) message;
|
|
|
|
m_settings.m_fec = notif.getCodeRate();
|
|
|
|
m_settings.m_modulation = notif.getModulation();
|
|
|
|
m_settings.validateSystemConfiguration();
|
|
|
|
displaySystemConfiguration();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::handleInputMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = getInputMessageQueue()->pop()) != 0)
|
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::channelMarkerChangedByCursor()
|
|
|
|
{
|
2018-03-10 13:30:55 -05:00
|
|
|
ui->deltaFrequency->setValue(m_objChannelMarker.getCenterFrequency());
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
if(m_intCenterFrequency!=m_objChannelMarker.getCenterFrequency())
|
|
|
|
{
|
|
|
|
m_intCenterFrequency=m_objChannelMarker.getCenterFrequency();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::channelMarkerHighlightedByCursor()
|
|
|
|
{
|
|
|
|
setHighlighted(m_objChannelMarker.getHighlighted());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) widget;
|
|
|
|
(void) rollDown;
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::onMenuDoubleClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* objParent) :
|
|
|
|
RollupWidget(objParent),
|
|
|
|
ui(new Ui::DATVDemodGUI),
|
|
|
|
m_objPluginAPI(objPluginAPI),
|
|
|
|
m_deviceUISet(deviceUISet),
|
|
|
|
m_objChannelMarker(this),
|
|
|
|
m_blnBasicSettingsShown(false),
|
2019-07-16 20:51:46 -04:00
|
|
|
m_blnDoApplySettings(true),
|
|
|
|
m_modcodModulationIndex(-1),
|
|
|
|
m_modcodCodeRateIndex(-1),
|
|
|
|
m_cstlnSetByModcod(false)
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-02-22 16:52:49 -05:00
|
|
|
ui->setupUi(this);
|
2018-03-11 14:43:40 -04:00
|
|
|
ui->screenTV->setColor(true);
|
2018-02-22 16:52:49 -05:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
2019-07-16 20:51:46 -04:00
|
|
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
m_objDATVDemod = (DATVDemod*) rxChannel;
|
|
|
|
m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue());
|
|
|
|
|
2018-03-11 11:39:02 -04:00
|
|
|
m_objDATVDemod->SetTVScreen(ui->screenTV);
|
2018-02-22 16:52:49 -05:00
|
|
|
|
2019-03-19 18:12:54 -04:00
|
|
|
connect(m_objDATVDemod->SetVideoRender(ui->screenTV_2), &DATVideostream::onDataPackets, this, &DATVDemodGUI::on_StreamDataAvailable);
|
|
|
|
connect(ui->screenTV_2, &DATVideoRender::onMetaDataChanged, this, &DATVDemodGUI::on_StreamMetaDataChanged);
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
m_intPreviousDecodedData=0;
|
|
|
|
m_intLastDecodedData=0;
|
|
|
|
m_intLastSpeed=0;
|
|
|
|
m_intReadyDecodedData=0;
|
|
|
|
m_objTimer.setInterval(1000);
|
|
|
|
connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
|
|
|
|
m_objTimer.start();
|
|
|
|
|
2019-03-23 20:37:34 -04:00
|
|
|
ui->fullScreen->setVisible(false);
|
2019-03-23 18:37:26 -04:00
|
|
|
|
2018-03-10 04:43:22 -05:00
|
|
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
|
|
|
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
|
|
|
|
|
|
|
ui->rfBandwidth->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
|
2018-03-10 13:30:55 -05:00
|
|
|
ui->rfBandwidth->setValueRange(true, 7, 0, 9999999);
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
m_objChannelMarker.blockSignals(true);
|
|
|
|
m_objChannelMarker.setColor(Qt::magenta);
|
|
|
|
m_objChannelMarker.setBandwidth(6000000);
|
|
|
|
m_objChannelMarker.setCenterFrequency(0);
|
|
|
|
m_objChannelMarker.blockSignals(false);
|
|
|
|
m_objChannelMarker.setVisible(true);
|
|
|
|
|
|
|
|
connect(&m_objChannelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
|
|
|
connect(&m_objChannelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
|
|
|
|
|
|
|
m_deviceUISet->registerRxChannelInstance(DATVDemod::m_channelIdURI, this);
|
|
|
|
m_deviceUISet->addChannelMarker(&m_objChannelMarker);
|
|
|
|
m_deviceUISet->addRollupWidget(this);
|
|
|
|
|
2019-03-23 01:06:42 -04:00
|
|
|
// QPixmap pixmapTarget = QPixmap(":/film.png");
|
|
|
|
// pixmapTarget = pixmapTarget.scaled(16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
|
|
// ui->videoPlay->setAlignment(Qt::AlignCenter);
|
|
|
|
// ui->videoPlay->setPixmap(pixmapTarget);
|
2019-03-19 18:12:54 -04:00
|
|
|
|
|
|
|
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
|
|
|
|
connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect()));
|
2018-02-22 16:52:49 -05:00
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
resetToDefaults(); // does applySettings()
|
|
|
|
}
|
|
|
|
|
|
|
|
DATVDemodGUI::~DATVDemodGUI()
|
|
|
|
{
|
|
|
|
m_deviceUISet->removeRxChannelInstance(this);
|
|
|
|
delete m_objDATVDemod;
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::blockApplySettings(bool blnBlock)
|
|
|
|
{
|
|
|
|
m_blnDoApplySettings = !blnBlock;
|
|
|
|
}
|
|
|
|
|
2019-03-17 21:26:03 -04:00
|
|
|
void DATVDemodGUI::displaySettings()
|
|
|
|
{
|
|
|
|
m_objChannelMarker.blockSignals(true);
|
|
|
|
blockApplySettings(true);
|
|
|
|
|
|
|
|
m_objChannelMarker.setCenterFrequency(m_settings.m_centerFrequency);
|
|
|
|
ui->deltaFrequency->setValue(m_settings.m_centerFrequency);
|
|
|
|
m_objChannelMarker.setColor(m_settings.m_rgbColor);
|
2019-07-16 20:51:46 -04:00
|
|
|
|
2019-03-17 21:26:03 -04:00
|
|
|
ui->chkAllowDrift->setChecked(m_settings.m_allowDrift);
|
2019-07-16 20:51:46 -04:00
|
|
|
ui->chkHardMetric->setChecked(m_settings.m_hardMetric);
|
2019-03-17 21:26:03 -04:00
|
|
|
ui->chkFastlock->setChecked(m_settings.m_fastLock);
|
2019-07-16 20:51:46 -04:00
|
|
|
ui->chkViterbi->setChecked(m_settings.m_viterbi);
|
|
|
|
|
|
|
|
ui->chkAllowDrift->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkHardMetric->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkFastlock->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkViterbi->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
2019-03-17 21:26:03 -04:00
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) {
|
|
|
|
ui->statusText->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->cmbFilter->setCurrentIndex((int) m_settings.m_filter);
|
2019-03-17 21:26:03 -04:00
|
|
|
displayRRCParameters(((int) m_settings.m_filter == 2));
|
|
|
|
|
|
|
|
ui->spiRollOff->setValue((int) (m_settings.m_rollOff * 100.0f));
|
2019-03-19 18:12:54 -04:00
|
|
|
ui->audioMute->setChecked(m_settings.m_audioMute);
|
2019-07-16 20:51:46 -04:00
|
|
|
displaySystemConfiguration();
|
2019-03-17 21:26:03 -04:00
|
|
|
ui->cmbStandard->setCurrentIndex((int) m_settings.m_standard);
|
|
|
|
ui->spiNotchFilters->setValue(m_settings.m_notchFilters);
|
|
|
|
ui->rfBandwidth->setValue(m_settings.m_rfBandwidth);
|
|
|
|
ui->spiSymbolRate->setValue(m_settings.m_symbolRate);
|
|
|
|
ui->spiExcursion->setValue(m_settings.m_excursion);
|
2019-03-22 03:05:01 -04:00
|
|
|
ui->audioVolume->setValue(m_settings.m_audioVolume);
|
|
|
|
ui->audioVolumeText->setText(tr("%1").arg(m_settings.m_audioVolume));
|
2019-03-23 01:06:42 -04:00
|
|
|
ui->videoMute->setChecked(m_settings.m_videoMute);
|
2019-03-17 21:26:03 -04:00
|
|
|
|
|
|
|
blockApplySettings(false);
|
|
|
|
m_objChannelMarker.blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
void DATVDemodGUI::displaySystemConfiguration()
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2019-07-16 20:51:46 -04:00
|
|
|
ui->cmbModulation->blockSignals(true);
|
|
|
|
ui->cmbFEC->blockSignals(true);
|
|
|
|
|
|
|
|
std::vector<DATVDemodSettings::DATVModulation> modulations;
|
|
|
|
DATVDemodSettings::getAvailableModulations(m_settings.m_standard, modulations);
|
|
|
|
std::vector<DATVDemodSettings::DATVCodeRate> codeRates;
|
|
|
|
DATVDemodSettings::getAvailableCodeRates(m_settings.m_standard, m_settings.m_modulation, codeRates);
|
|
|
|
|
|
|
|
ui->cmbModulation->clear();
|
|
|
|
int modulationIndex = 0;
|
|
|
|
int i;
|
|
|
|
std::vector<DATVDemodSettings::DATVModulation>::const_iterator mIt = modulations.begin();
|
2018-02-22 16:52:49 -05:00
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
for (i = 0; mIt != modulations.end(); ++mIt, i++)
|
|
|
|
{
|
|
|
|
ui->cmbModulation->addItem(DATVDemodSettings::getStrFromModulation(*mIt));
|
|
|
|
|
|
|
|
if (m_settings.m_modulation == *mIt) {
|
|
|
|
modulationIndex = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->cmbFEC->clear();
|
|
|
|
int rateIndex = 0;
|
|
|
|
std::vector<DATVDemodSettings::DATVCodeRate>::const_iterator rIt = codeRates.begin();
|
|
|
|
|
|
|
|
for (i = 0; rIt != codeRates.end(); ++rIt, i++)
|
|
|
|
{
|
|
|
|
ui->cmbFEC->addItem(DATVDemodSettings::getStrFromCodeRate(*rIt));
|
|
|
|
|
|
|
|
if (m_settings.m_fec == *rIt) {
|
|
|
|
rateIndex = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->cmbModulation->setCurrentIndex(modulationIndex);
|
|
|
|
ui->cmbFEC->setCurrentIndex(rateIndex);
|
|
|
|
|
|
|
|
ui->cmbModulation->blockSignals(false);
|
|
|
|
ui->cmbFEC->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::applySettings(bool force)
|
|
|
|
{
|
2018-02-22 16:52:49 -05:00
|
|
|
if (m_blnDoApplySettings)
|
|
|
|
{
|
2019-07-14 09:35:45 -04:00
|
|
|
qDebug("DATVDemodGUI::applySettings");
|
|
|
|
|
2018-03-10 13:30:55 -05:00
|
|
|
//Bandwidth and center frequency
|
|
|
|
m_objChannelMarker.setCenterFrequency(ui->deltaFrequency->getValueNew());
|
|
|
|
m_objChannelMarker.setBandwidth(ui->rfBandwidth->getValueNew());
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
DATVDemod::MsgConfigureChannelizer *msgChan = DATVDemod::MsgConfigureChannelizer::create(m_objChannelMarker.getCenterFrequency());
|
|
|
|
m_objDATVDemod->getInputMessageQueue()->push(msgChan);
|
|
|
|
|
|
|
|
setTitleColor(m_objChannelMarker.getColor());
|
|
|
|
|
2019-03-16 20:36:44 -04:00
|
|
|
if (ui->cmbFilter->currentIndex() == 0) {
|
2019-03-17 21:26:03 -04:00
|
|
|
m_settings.m_filter = DATVDemodSettings::SAMP_LINEAR;
|
2019-03-16 20:36:44 -04:00
|
|
|
} else if (ui->cmbFilter->currentIndex() == 1) {
|
2019-03-17 21:26:03 -04:00
|
|
|
m_settings.m_filter = DATVDemodSettings::SAMP_NEAREST;
|
2019-03-16 20:36:44 -04:00
|
|
|
} else {
|
2019-03-17 21:26:03 -04:00
|
|
|
m_settings.m_filter = DATVDemodSettings::SAMP_RRC;
|
2018-02-25 19:04:45 -05:00
|
|
|
}
|
|
|
|
|
2019-03-17 21:26:03 -04:00
|
|
|
m_settings.m_rfBandwidth = m_objChannelMarker.getBandwidth();
|
|
|
|
m_settings.m_centerFrequency = m_objChannelMarker.getCenterFrequency();
|
|
|
|
m_settings.m_symbolRate = ui->spiSymbolRate->value();
|
|
|
|
m_settings.m_notchFilters = ui->spiNotchFilters->value();
|
|
|
|
m_settings.m_allowDrift = ui->chkAllowDrift->isChecked();
|
|
|
|
m_settings.m_fastLock = ui->chkFastlock->isChecked();
|
|
|
|
m_settings.m_hardMetric = ui->chkHardMetric->isChecked();
|
|
|
|
m_settings.m_rollOff = ((float)ui->spiRollOff->value()) / 100.0f;
|
|
|
|
m_settings.m_viterbi = ui->chkViterbi->isChecked();
|
|
|
|
m_settings.m_excursion = ui->spiExcursion->value();
|
2019-03-22 03:05:01 -04:00
|
|
|
m_settings.m_audioMute = ui->audioMute->isChecked();
|
|
|
|
m_settings.m_audioVolume = ui->audioVolume->value();
|
2019-03-23 01:06:42 -04:00
|
|
|
m_settings.m_videoMute = ui->videoMute->isChecked();
|
2019-03-17 21:26:03 -04:00
|
|
|
|
|
|
|
QString msg = tr("DATVDemodGUI::applySettings: force: %1").arg(force);
|
|
|
|
m_settings.debug(msg);
|
|
|
|
|
|
|
|
DATVDemod::MsgConfigureDATVDemod* message = DATVDemod::MsgConfigureDATVDemod::create(m_settings, force);
|
|
|
|
m_objDATVDemod->getInputMessageQueue()->push(message);
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::leaveEvent(QEvent*)
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_objChannelMarker.setHighlighted(false);
|
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::enterEvent(QEvent*)
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_objChannelMarker.setHighlighted(true);
|
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
2019-03-19 18:12:54 -04:00
|
|
|
void DATVDemodGUI::audioSelect()
|
|
|
|
{
|
|
|
|
qDebug("AMDemodGUI::audioSelect");
|
|
|
|
AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_audioDeviceName);
|
|
|
|
audioSelect.exec();
|
|
|
|
|
|
|
|
if (audioSelect.m_selected)
|
|
|
|
{
|
|
|
|
m_settings.m_audioDeviceName = audioSelect.m_audioDeviceName;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
void DATVDemodGUI::tick()
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-03-10 17:01:03 -05:00
|
|
|
if (m_objDATVDemod)
|
|
|
|
{
|
|
|
|
m_objMagSqAverage(m_objDATVDemod->getMagSq());
|
|
|
|
double magSqDB = CalcDb::dbPower(m_objMagSqAverage / (SDR_RX_SCALED*SDR_RX_SCALED));
|
|
|
|
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
|
2019-07-16 20:51:46 -04:00
|
|
|
|
|
|
|
if ((m_modcodModulationIndex != m_objDATVDemod->getModcodModulation()) || (m_modcodCodeRateIndex != m_objDATVDemod->getModcodCodeRate()))
|
|
|
|
{
|
|
|
|
m_modcodModulationIndex = m_objDATVDemod->getModcodModulation();
|
|
|
|
m_modcodCodeRateIndex = m_objDATVDemod->getModcodCodeRate();
|
|
|
|
DATVDemodSettings::DATVModulation modulation = DATVDemod::getModulationFromLeanDVBCode(m_modcodModulationIndex);
|
|
|
|
DATVDemodSettings::DATVCodeRate rate = DATVDemod::getCodeRateFromLeanDVBCode(m_modcodCodeRateIndex);
|
|
|
|
QString modcodModulationStr = DATVDemodSettings::getStrFromModulation(modulation);
|
|
|
|
QString modcodCodeRateStr = DATVDemodSettings::getStrFromCodeRate(rate);
|
|
|
|
ui->statusText->setText(tr("MCOD %1 %2").arg(modcodModulationStr).arg(modcodCodeRateStr));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_cstlnSetByModcod != m_objDATVDemod->isCstlnSetByModcod())
|
|
|
|
{
|
|
|
|
m_cstlnSetByModcod = m_objDATVDemod->isCstlnSetByModcod();
|
|
|
|
|
|
|
|
if (m_cstlnSetByModcod) {
|
|
|
|
ui->statusText->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
}
|
2018-03-10 17:01:03 -05:00
|
|
|
}
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
if((m_intLastDecodedData-m_intPreviousDecodedData)>=0)
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-02-22 16:52:49 -05:00
|
|
|
m_intLastSpeed = 8*(m_intLastDecodedData-m_intPreviousDecodedData);
|
|
|
|
ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed)));
|
|
|
|
}
|
|
|
|
|
2019-03-23 04:38:29 -04:00
|
|
|
if (m_objDATVDemod->audioActive())
|
|
|
|
{
|
|
|
|
if (m_objDATVDemod->audioDecodeOK()) {
|
|
|
|
ui->audioMute->setStyleSheet("QToolButton { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->audioMute->setStyleSheet("QToolButton { background-color : red; }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-19 18:12:54 -04:00
|
|
|
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2019-03-23 04:38:29 -04:00
|
|
|
if (m_objDATVDemod->videoActive())
|
|
|
|
{
|
|
|
|
if (m_objDATVDemod->videoDecodeOK()) {
|
|
|
|
ui->videoMute->setStyleSheet("QToolButton { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->videoMute->setStyleSheet("QToolButton { background-color : red; }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->videoMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
m_intPreviousDecodedData = m_intLastDecodedData;
|
|
|
|
|
|
|
|
//Try to start video rendering
|
|
|
|
m_objDATVDemod->PlayVideo(false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
void DATVDemodGUI::on_cmbStandard_currentIndexChanged(int index)
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2019-07-16 20:51:46 -04:00
|
|
|
m_settings.m_standard = (DATVDemodSettings::dvb_version) index;
|
2019-07-14 09:35:45 -04:00
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
ui->chkAllowDrift->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkHardMetric->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkFastlock->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
|
|
|
ui->chkViterbi->setEnabled(m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S);
|
2019-07-14 09:35:45 -04:00
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) {
|
|
|
|
ui->statusText->clear();
|
2019-07-14 09:35:45 -04:00
|
|
|
}
|
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
m_settings.validateSystemConfiguration();
|
|
|
|
displaySystemConfiguration();
|
2018-02-22 16:52:49 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_cmbModulation_currentIndexChanged(const QString &arg1)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2019-07-16 20:51:46 -04:00
|
|
|
QString strModulation = ui->cmbModulation->currentText();
|
|
|
|
m_settings.m_modulation = DATVDemodSettings::getModulationFromStr(strModulation);
|
|
|
|
m_settings.validateSystemConfiguration();
|
|
|
|
displaySystemConfiguration();
|
|
|
|
|
|
|
|
//Viterbi only for BPSK and QPSK
|
|
|
|
if ((m_settings.m_modulation != DATVDemodSettings::BPSK)
|
|
|
|
&& (m_settings.m_modulation != DATVDemodSettings::QPSK))
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2019-07-16 20:51:46 -04:00
|
|
|
ui->chkViterbi->setChecked(false);
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
2019-07-16 20:51:46 -04:00
|
|
|
applySettings();
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_cmbFEC_currentIndexChanged(const QString &arg1)
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2019-07-16 20:51:46 -04:00
|
|
|
QString strFEC = ui->cmbFEC->currentText();
|
|
|
|
m_settings.m_fec = DATVDemodSettings::getCodeRateFromStr(strFEC);
|
|
|
|
applySettings();
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::on_chkViterbi_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::on_chkHardMetric_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-03-23 05:51:01 -04:00
|
|
|
void DATVDemodGUI::on_resetDefaults_clicked()
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_spiSymbolRate_valueChanged(int arg1)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2018-02-22 16:52:49 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_spiNotchFilters_valueChanged(int arg1)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2018-02-22 16:52:49 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::on_chkAllowDrift_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-03-23 05:51:01 -04:00
|
|
|
void DATVDemodGUI::on_fullScreen_clicked()
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
|
|
|
ui->screenTV_2->SetFullScreen(true);
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_mouseEvent(QMouseEvent* obj)
|
2018-02-24 18:07:08 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) obj;
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QString DATVDemodGUI::formatBytes(qint64 intBytes)
|
|
|
|
{
|
2019-03-16 20:36:44 -04:00
|
|
|
if(intBytes<1024) {
|
2018-02-22 16:52:49 -05:00
|
|
|
return QString("%1").arg(intBytes);
|
2019-03-16 20:36:44 -04:00
|
|
|
} else if(intBytes<1024*1024) {
|
2018-02-22 16:52:49 -05:00
|
|
|
return QString("%1 K").arg((float)(10*intBytes/1024)/10.0f);
|
2019-03-16 20:36:44 -04:00
|
|
|
} else if(intBytes<1024*1024*1024) {
|
2018-02-22 16:52:49 -05:00
|
|
|
return QString("%1 M").arg((float)(10*intBytes/(1024*1024))/10.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return QString("%1 G").arg((float)(10*intBytes/(1024*1024*1024))/10.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_StreamDataAvailable(int *intPackets, int *intBytes, int *intPercent, qint64 *intTotalReceived)
|
2018-02-22 16:52:49 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) intPackets;
|
2018-02-25 19:04:45 -05:00
|
|
|
ui->lblStatus->setText(QString("Data: %1B").arg(formatBytes(*intTotalReceived)));
|
2018-02-22 16:52:49 -05:00
|
|
|
m_intLastDecodedData = *intTotalReceived;
|
|
|
|
|
2019-03-16 20:36:44 -04:00
|
|
|
if((*intPercent)<100) {
|
|
|
|
ui->prgSynchro->setValue(*intPercent);
|
|
|
|
} else {
|
|
|
|
ui->prgSynchro->setValue(100);
|
2018-02-22 16:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_intReadyDecodedData = *intBytes;
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_deltaFrequency_changed(qint64 value)
|
2018-03-10 13:30:55 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) value;
|
2018-03-10 13:30:55 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_rfBandwidth_changed(qint64 value)
|
2018-03-10 13:30:55 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) value;
|
2018-03-10 13:30:55 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
void DATVDemodGUI::on_chkFastlock_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
2018-02-25 19:04:45 -05:00
|
|
|
|
2019-03-22 03:05:01 -04:00
|
|
|
void DATVDemodGUI::on_audioMute_toggled(bool checked)
|
|
|
|
{
|
|
|
|
(void) checked;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-03-23 01:06:42 -04:00
|
|
|
void DATVDemodGUI::on_videoMute_toggled(bool checked)
|
|
|
|
{
|
|
|
|
(void) checked;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2019-03-22 03:05:01 -04:00
|
|
|
void DATVDemodGUI::on_audioVolume_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->audioVolumeText->setText(tr("%1").arg(value));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-02-25 19:04:45 -05:00
|
|
|
void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
|
|
|
|
{
|
|
|
|
QString strMetaData="";
|
|
|
|
|
2019-03-16 20:36:44 -04:00
|
|
|
if (objMetaData != nullptr)
|
2018-02-25 19:04:45 -05:00
|
|
|
{
|
2019-03-16 20:36:44 -04:00
|
|
|
if (objMetaData->OK_TransportStream == true)
|
2018-02-25 19:04:45 -05:00
|
|
|
{
|
2018-03-10 13:30:55 -05:00
|
|
|
strMetaData.sprintf("PID: %d - Width: %d - Height: %d\r\n%s%s\r\nCodec: %s\r\n",
|
2019-03-16 20:36:44 -04:00
|
|
|
objMetaData->PID,
|
|
|
|
objMetaData->Width,
|
|
|
|
objMetaData->Height,
|
|
|
|
objMetaData->Program.toStdString().c_str(),
|
|
|
|
objMetaData->Stream.toStdString().c_str(),
|
|
|
|
objMetaData->CodecDescription.toStdString().c_str());
|
2018-02-25 19:04:45 -05:00
|
|
|
}
|
|
|
|
|
2019-03-16 20:36:44 -04:00
|
|
|
ui->textEdit->setText(strMetaData);
|
2018-02-25 19:04:45 -05:00
|
|
|
ui->chkData->setChecked(objMetaData->OK_Data);
|
|
|
|
ui->chkTS->setChecked(objMetaData->OK_TransportStream);
|
|
|
|
ui->chkVS->setChecked(objMetaData->OK_VideoStream);
|
|
|
|
ui->chkDecoding->setChecked(objMetaData->OK_Decoding);
|
|
|
|
|
2019-03-16 20:36:44 -04:00
|
|
|
if (objMetaData->Height > 0) {
|
2018-02-25 19:04:45 -05:00
|
|
|
ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DATVDemodGUI::displayRRCParameters(bool blnVisible)
|
|
|
|
{
|
|
|
|
ui->spiRollOff->setVisible(blnVisible);
|
|
|
|
ui->spiExcursion->setVisible(blnVisible);
|
2019-03-23 05:51:01 -04:00
|
|
|
ui->rollOffLabel->setVisible(blnVisible);
|
|
|
|
ui->excursionLabel->setVisible(blnVisible);
|
2018-02-25 19:04:45 -05:00
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_cmbFilter_currentIndexChanged(int index)
|
2018-02-25 19:04:45 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) index;
|
2019-03-17 21:43:58 -04:00
|
|
|
displayRRCParameters((ui->cmbFilter->currentIndex() == 2));
|
2018-02-25 19:04:45 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_spiRollOff_valueChanged(int arg1)
|
2018-02-25 19:04:45 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2018-02-25 19:04:45 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void DATVDemodGUI::on_spiExcursion_valueChanged(int arg1)
|
2018-02-25 19:04:45 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) arg1;
|
2018-02-25 19:04:45 -05:00
|
|
|
applySettings();
|
|
|
|
}
|