diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index d8a86e959..ee96c75b3 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -36,10 +36,11 @@ const QString ATVDemodGUI::m_strChannelID = "sdrangel.channel.demodatv"; -ATVDemodGUI* ATVDemodGUI::create(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI) +ATVDemodGUI* ATVDemodGUI::create(PluginAPI* objPluginAPI, + DeviceSourceAPI *objDeviceAPI) { ATVDemodGUI* gui = new ATVDemodGUI(objPluginAPI, objDeviceAPI); - return gui; + return gui; } void ATVDemodGUI::destroy() @@ -54,7 +55,7 @@ void ATVDemodGUI::setName(const QString& strName) QString ATVDemodGUI::getName() const { - return objectName(); + return objectName(); } qint64 ATVDemodGUI::getCenterFrequency() const @@ -65,22 +66,31 @@ qint64 ATVDemodGUI::getCenterFrequency() const void ATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency) { m_objChannelMarker.setCenterFrequency(intCenterFrequency); - applySettings(); + applySettings(); } void ATVDemodGUI::resetToDefaults() { - blockApplySettings(true); + blockApplySettings(true); - //ui->rfBW->setValue(50); + //********** ATV Default values ********** + ui->synchLevel->setValue(100); + ui->blackLevel->setValue(310); + ui->lineTime->setValue(640); + ui->topTime->setValue(3); + ui->modulation->setCurrentIndex(0); + ui->fps->setCurrentIndex(0); + ui->hSync->setChecked(true); + ui->vSync->setChecked(true); + ui->halfImage->setChecked(false); blockApplySettings(false); - applySettings(); + applySettings(); } QByteArray ATVDemodGUI::serialize() const { - SimpleSerializer s(1); + SimpleSerializer s(1); //s.writeS32(2, ui->rfBW->value()); @@ -91,27 +101,27 @@ bool ATVDemodGUI::deserialize(const QByteArray& arrData) { SimpleDeserializer d(arrData); - if(!d.isValid()) + if (!d.isValid()) { - resetToDefaults(); - return false; - } + resetToDefaults(); + return false; + } - if(d.getVersion() == 1) + if (d.getVersion() == 1) { - QByteArray bytetmp; - quint32 u32tmp; - qint32 tmp; + QByteArray bytetmp; + quint32 u32tmp; + qint32 tmp; - blockApplySettings(true); + blockApplySettings(true); m_objChannelMarker.blockSignals(true); - d.readS32(1, &tmp, 0); + d.readS32(1, &tmp, 0); m_objChannelMarker.setCenterFrequency(tmp); //d.readS32(2, &tmp, 4); //ui->rfBW->setValue(tmp); - if(d.readU32(7, &u32tmp)) + if (d.readU32(7, &u32tmp)) { m_objChannelMarker.setColor(u32tmp); } @@ -119,24 +129,24 @@ bool ATVDemodGUI::deserialize(const QByteArray& arrData) blockApplySettings(false); m_objChannelMarker.blockSignals(false); - applySettings(); - return true; - } + applySettings(); + return true; + } else { - resetToDefaults(); - return false; - } + resetToDefaults(); + return false; + } } bool ATVDemodGUI::handleMessage(const Message& objMessage) { - return false; + return false; } void ATVDemodGUI::viewChanged() { - applySettings(); + applySettings(); } void ATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) @@ -145,35 +155,35 @@ void ATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) void ATVDemodGUI::onMenuDoubleClicked() { - if(!m_blnBasicSettingsShown) + if (!m_blnBasicSettingsShown) { m_blnBasicSettingsShown = true; - BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_objChannelMarker, this); + BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget( + &m_objChannelMarker, this); bcsw->show(); } } - - -ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent) : - RollupWidget(objParent), - ui(new Ui::ATVDemodGUI), - m_objPluginAPI(objPluginAPI), - m_objDeviceAPI(objDeviceAPI), - m_objChannelMarker(this), - m_blnBasicSettingsShown(false), - m_blnDoApplySettings(true) +ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, + QWidget* objParent) : + RollupWidget(objParent), ui(new Ui::ATVDemodGUI), m_objPluginAPI( + objPluginAPI), m_objDeviceAPI(objDeviceAPI), m_objChannelMarker( + this), m_blnBasicSettingsShown(false), m_blnDoApplySettings( + true) { - ui->setupUi(this); - setAttribute(Qt::WA_DeleteOnClose, true); - connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); - connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose, true); + connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, + SLOT(onWidgetRolled(QWidget*,bool))); + connect(this, SIGNAL(menuDoubleClickEvent()), this, + SLOT(onMenuDoubleClicked())); m_objATVDemod = new ATVDemod(); m_objATVDemod->SetATVScreen(ui->screenTV); m_objChannelizer = new DownChannelizer(m_objATVDemod); - m_objThreadedChannelizer = new ThreadedBasebandSampleSink(m_objChannelizer, this); + m_objThreadedChannelizer = new ThreadedBasebandSampleSink(m_objChannelizer, + this); m_objDeviceAPI->addThreadedSink(m_objThreadedChannelizer); //m_objPluginAPI->addThreadedSink(m_objThreadedChannelizer); @@ -193,17 +203,7 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, //ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer()); - //********** ATV Default values ********** - ui->horizontalSlider->setValue(100); - ui->horizontalSlider_2->setValue(310); - ui->horizontalSlider_3->setValue(640); - ui->horizontalSlider_4->setValue(3); - ui->comboBox_2->setCurrentIndex(0); - ui->comboBox->setCurrentIndex(0); - ui->checkBox->setChecked(true); - ui->checkBox_2->setChecked(true); - - applySettings(); + resetToDefaults(); // does applySettings() } ATVDemodGUI::~ATVDemodGUI() @@ -226,112 +226,117 @@ void ATVDemodGUI::applySettings() ATVModulation enmSelectedModulation; if (m_blnDoApplySettings) - { + { setTitleColor(m_objChannelMarker.getColor()); - m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(), m_objATVDemod->GetSampleRate(), m_objChannelMarker.getCenterFrequency()); + m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(), + m_objATVDemod->GetSampleRate(), + m_objChannelMarker.getCenterFrequency()); - switch(ui->comboBox_2->currentIndex()) + switch (ui->modulation->currentIndex()) { - case 0: - enmSelectedModulation=ATV_FM1; + case 0: + enmSelectedModulation = ATV_FM1; break; - case 1: - enmSelectedModulation=ATV_FM2; + case 1: + enmSelectedModulation = ATV_FM2; break; - case 2: - enmSelectedModulation=ATV_AM; + case 2: + enmSelectedModulation = ATV_AM; break; - default: - enmSelectedModulation=ATV_FM1; + default: + enmSelectedModulation = ATV_FM1; break; } m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(), - ui->horizontalSlider_3->value(), - ui->horizontalSlider_4->value(), - (ui->comboBox->currentIndex()==0)?25:30, - (ui->checkBox_3->checkState()==Qt::Checked)?50:100, - ((float)(ui->horizontalSlider->value()))/1000.0f, - ((float)(ui->horizontalSlider_2->value()))/1000.0f, - enmSelectedModulation, - ui->checkBox->isChecked(), - ui->checkBox_2->isChecked()); + ui->lineTime->value(), + ui->topTime->value(), + (ui->fps->currentIndex() == 0) ? 25 : 30, + (ui->halfImage->checkState() == Qt::Checked) ? 50 : 100, + ((float) (ui->synchLevel->value())) / 1000.0f, + ((float) (ui->blackLevel->value())) / 1000.0f, + enmSelectedModulation, ui->hSync->isChecked(), + ui->vSync->isChecked()); m_objChannelMarker.setBandwidth(m_objATVDemod->GetSampleRate()); - } + } } void ATVDemodGUI::leaveEvent(QEvent*) { - blockApplySettings(true); + blockApplySettings(true); m_objChannelMarker.setHighlighted(false); - blockApplySettings(false); + blockApplySettings(false); } void ATVDemodGUI::enterEvent(QEvent*) { - blockApplySettings(true); + blockApplySettings(true); m_objChannelMarker.setHighlighted(true); - blockApplySettings(false); + blockApplySettings(false); } void ATVDemodGUI::tick() { - return ; + return; } - -void ATVDemodGUI::on_horizontalSlider_valueChanged(int value) +void ATVDemodGUI::on_synchLevel_valueChanged(int value) { applySettings(); - ui->label_2->setText(QString("%1 mV").arg(value)); + ui->synchLevelText->setText(QString("%1 mV").arg(value)); } -void ATVDemodGUI::on_horizontalSlider_2_valueChanged(int value) +void ATVDemodGUI::on_blackLevel_valueChanged(int value) { applySettings(); - ui->label_4->setText(QString("%1 mV").arg(value)); + ui->blackLevelText->setText(QString("%1 mV").arg(value)); } -void ATVDemodGUI::on_horizontalSlider_3_valueChanged(int value) +void ATVDemodGUI::on_lineTime_valueChanged(int value) { - ui->label_6->setText(QString("%1 uS").arg(((float)value)/10.0f)); + ui->lineTimeText->setText(QString("%1 uS").arg(((float) value) / 10.0f)); applySettings(); } -void ATVDemodGUI::on_horizontalSlider_4_valueChanged(int value) +void ATVDemodGUI::on_topTime_valueChanged(int value) { - ui->label_8->setText(QString("%1 uS").arg(value)); - applySettings(); + ui->topTimeText->setText(QString("%1 uS").arg(value)); + applySettings(); } -void ATVDemodGUI::on_checkBox_clicked() -{ - applySettings(); -} - -void ATVDemodGUI::on_checkBox_2_clicked() -{ - applySettings(); -} - -void ATVDemodGUI::on_checkBox_3_clicked() -{ - applySettings(); -} - -void ATVDemodGUI::on_comboBox_currentIndexChanged(int index) +void ATVDemodGUI::on_hSync_clicked() { applySettings(); } -void ATVDemodGUI::on_comboBox_2_currentIndexChanged(int index) +void ATVDemodGUI::on_vSync_clicked() { applySettings(); } + +void ATVDemodGUI::on_halfImage_clicked() +{ + applySettings(); +} + +void ATVDemodGUI::on_modulation_currentIndexChanged(int index) +{ + applySettings(); +} + +void ATVDemodGUI::on_fps_currentIndexChanged(int index) +{ + applySettings(); +} + +void ATVDemodGUI::on_reset_clicked(bool checked) +{ + resetToDefaults(); +} diff --git a/plugins/channelrx/demodatv/atvdemodgui.h b/plugins/channelrx/demodatv/atvdemodgui.h index 7a203da1f..9e8054b22 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.h +++ b/plugins/channelrx/demodatv/atvdemodgui.h @@ -61,15 +61,16 @@ private slots: void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); void tick(); - void on_horizontalSlider_valueChanged(int value); - void on_horizontalSlider_2_valueChanged(int value); - void on_horizontalSlider_3_valueChanged(int value); - void on_horizontalSlider_4_valueChanged(int value); - void on_checkBox_clicked(); - void on_checkBox_2_clicked(); - void on_checkBox_3_clicked(); - void on_comboBox_currentIndexChanged(int index); - void on_comboBox_2_currentIndexChanged(int index); + void on_synchLevel_valueChanged(int value); + void on_blackLevel_valueChanged(int value); + void on_lineTime_valueChanged(int value); + void on_topTime_valueChanged(int value); + void on_hSync_clicked(); + void on_vSync_clicked(); + void on_halfImage_clicked(); + void on_modulation_currentIndexChanged(int index); + void on_fps_currentIndexChanged(int index); + void on_reset_clicked(bool checked); private: Ui::ATVDemodGUI* ui; diff --git a/plugins/channelrx/demodatv/atvdemodgui.ui b/plugins/channelrx/demodatv/atvdemodgui.ui index 763f14d75..ff5f04aa6 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.ui +++ b/plugins/channelrx/demodatv/atvdemodgui.ui @@ -43,7 +43,7 @@ 361 - + QLayout::SetMinimumSize @@ -74,7 +74,7 @@ - + 10 @@ -92,7 +92,7 @@ ATV Settings - + 310 @@ -101,6 +101,9 @@ 20 + + Black level + 999 @@ -117,15 +120,18 @@ Qt::Horizontal - + - 140 + 120 30 72 22 + + Frames per second + 25 Fps @@ -137,7 +143,7 @@ - + 50 @@ -146,6 +152,9 @@ 16 + + Horizontal synchronization level + 999 @@ -162,33 +171,39 @@ Qt::Horizontal - + - 250 + 220 30 61 20 + + Toggle horizontal synchronization + HSync - + - 340 + 300 30 61 20 + + Toggle vertical synchronization + VSync - + 10 @@ -201,7 +216,7 @@ <html><head/><body><p>Synch</p></body></html> - + 160 @@ -217,7 +232,7 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + 250 @@ -230,7 +245,7 @@ <html><head/><body><p>Black Lvl</p></body></html> - + 420 @@ -246,20 +261,23 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - 420 + 380 30 51 20 + + Half image (no interleave) + Half - + 10 @@ -272,7 +290,7 @@ Line - + 50 @@ -281,6 +299,9 @@ 16 + + Line length in time units + 1 @@ -300,7 +321,7 @@ Qt::Horizontal - + 160 @@ -316,7 +337,7 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + 250 @@ -329,7 +350,7 @@ <html><head/><body><p>Top</p></body></html> - + 310 @@ -338,6 +359,9 @@ 20 + + Horizontal top length in time units + 1 @@ -357,7 +381,7 @@ Qt::Horizontal - + 420 @@ -373,7 +397,7 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + 10 @@ -382,6 +406,9 @@ 22 + + Modulation type + FM 1 @@ -398,6 +425,22 @@ + + + + 450 + 30 + 24 + 22 + + + + Reset to default values + + + R + +