ATV demod: GUI: renamed UI widgets and added reset button

This commit is contained in:
f4exb 2017-02-25 10:15:47 +01:00
parent 9772a737a0
commit ebf1e0c439
3 changed files with 189 additions and 140 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -43,7 +43,7 @@
<height>361</height>
</rect>
</property>
<layout class="QHBoxLayout" name="signalLevelLayout">
<layout class="QHBoxLayout" name="screenTVLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
@ -74,7 +74,7 @@
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="settingsGroup">
<property name="geometry">
<rect>
<x>10</x>
@ -92,7 +92,7 @@
<property name="title">
<string>ATV Settings</string>
</property>
<widget class="QSlider" name="horizontalSlider_2">
<widget class="QSlider" name="blackLevel">
<property name="geometry">
<rect>
<x>310</x>
@ -101,6 +101,9 @@
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Black level</string>
</property>
<property name="maximum">
<number>999</number>
</property>
@ -117,15 +120,18 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="fps">
<property name="geometry">
<rect>
<x>140</x>
<x>120</x>
<y>30</y>
<width>72</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Frames per second</string>
</property>
<item>
<property name="text">
<string comment="25">25 Fps</string>
@ -137,7 +143,7 @@
</property>
</item>
</widget>
<widget class="QSlider" name="horizontalSlider">
<widget class="QSlider" name="synchLevel">
<property name="geometry">
<rect>
<x>50</x>
@ -146,6 +152,9 @@
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>Horizontal synchronization level</string>
</property>
<property name="maximum">
<number>999</number>
</property>
@ -162,33 +171,39 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="hSync">
<property name="geometry">
<rect>
<x>250</x>
<x>220</x>
<y>30</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Toggle horizontal synchronization</string>
</property>
<property name="text">
<string>HSync</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="vSync">
<property name="geometry">
<rect>
<x>340</x>
<x>300</x>
<y>30</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Toggle vertical synchronization</string>
</property>
<property name="text">
<string>VSync</string>
</property>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="synchLevelLabel">
<property name="geometry">
<rect>
<x>10</x>
@ -201,7 +216,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Synch&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="synchLevelText">
<property name="geometry">
<rect>
<x>160</x>
@ -217,7 +232,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="blackLevelLabel">
<property name="geometry">
<rect>
<x>250</x>
@ -230,7 +245,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Black Lvl&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="blackLevelText">
<property name="geometry">
<rect>
<x>420</x>
@ -246,20 +261,23 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3">
<widget class="QCheckBox" name="halfImage">
<property name="geometry">
<rect>
<x>420</x>
<x>380</x>
<y>30</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Half image (no interleave)</string>
</property>
<property name="text">
<string>Half</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="lineTimeLabel">
<property name="geometry">
<rect>
<x>10</x>
@ -272,7 +290,7 @@
<string>Line</string>
</property>
</widget>
<widget class="QSlider" name="horizontalSlider_3">
<widget class="QSlider" name="lineTime">
<property name="geometry">
<rect>
<x>50</x>
@ -281,6 +299,9 @@
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>Line length in time units</string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -300,7 +321,7 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="lineTimeText">
<property name="geometry">
<rect>
<x>160</x>
@ -316,7 +337,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="topTimeLabel">
<property name="geometry">
<rect>
<x>250</x>
@ -329,7 +350,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Top&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QSlider" name="horizontalSlider_4">
<widget class="QSlider" name="topTime">
<property name="geometry">
<rect>
<x>310</x>
@ -338,6 +359,9 @@
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Horizontal top length in time units</string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -357,7 +381,7 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="topTimeText">
<property name="geometry">
<rect>
<x>420</x>
@ -373,7 +397,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<widget class="QComboBox" name="modulation">
<property name="geometry">
<rect>
<x>10</x>
@ -382,6 +406,9 @@
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Modulation type</string>
</property>
<item>
<property name="text">
<string>FM 1</string>
@ -398,6 +425,22 @@
</property>
</item>
</widget>
<widget class="QPushButton" name="reset">
<property name="geometry">
<rect>
<x>450</x>
<y>30</y>
<width>24</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Reset to default values</string>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
</widget>
</widget>
<customwidgets>