1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

ATV demod: GUI refactoring with addition of scope in screen and scope combo inside a tabbed panel

This commit is contained in:
f4exb 2017-03-20 11:57:52 +01:00
parent 3721b445b1
commit 9d85f9f640
5 changed files with 147 additions and 54 deletions

View File

@ -32,8 +32,9 @@ MESSAGE_CLASS_DEFINITION(ATVDemod::MsgReportEffectiveSampleRate, Message)
const float ATVDemod::m_fltSecondToUs = 1000000.0f;
const int ATVDemod::m_ssbFftLen = 1024;
ATVDemod::ATVDemod() :
m_objSettingsMutex(QMutex::NonRecursive),
ATVDemod::ATVDemod(BasebandSampleSink* objScopeSink) :
m_objScopeSink(objScopeSink),
m_objSettingsMutex(QMutex::Recursive),
m_objRegisteredATVScreen(NULL),
m_intImageIndex(0),
m_intColIndex(0),
@ -218,6 +219,13 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
}
}
if(m_objScopeSink != 0)
{
m_objScopeSink->feed(m_objScopeSampleBuffer.begin(), m_objScopeSampleBuffer.end(), false); // m_ssb = positive only
}
m_objScopeSampleBuffer.clear();
if (ptrBufferToRelease != 0)
{
delete ptrBufferToRelease;
@ -377,6 +385,8 @@ void ATVDemod::demod(Complex& c)
fltVal = 0.0f;
}
m_objScopeSampleBuffer.push_back(Sample(fltVal*32768.0f, 0.0f));
fltVal = m_objRunning.m_blnInvertVideo ? 1.0f - fltVal : fltVal;
m_fltAmpLineAverage += fltVal;
@ -638,7 +648,14 @@ bool ATVDemod::handleMessage(const Message& cmd)
}
else
{
return false;
if (m_objScopeSink != 0)
{
return m_objScopeSink->handleMessage(cmd);
}
else
{
return false;
}
}
}

View File

@ -123,7 +123,7 @@ public:
{ }
};
ATVDemod();
ATVDemod(BasebandSampleSink* objScopeSink);
~ATVDemod();
void configure(MessageQueue* objMessageQueue,
@ -264,6 +264,11 @@ private:
}
};
//*************** SCOPE ***************
BasebandSampleSink* m_objScopeSink;
SampleVector m_objScopeSampleBuffer;
//*************** ATV PARAMETERS ***************
ATVScreen * m_objRegisteredATVScreen;

View File

@ -24,6 +24,7 @@
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/scopevisng.h"
#include "ui_atvdemodgui.h"
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
@ -262,13 +263,15 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
m_objATVDemod = new ATVDemod();
m_objScopeVis = new ScopeVisNG(ui->glScope);
m_objATVDemod = new ATVDemod(m_objScopeVis);
m_objATVDemod->setATVScreen(ui->screenTV);
m_objChannelizer = new DownChannelizer(m_objATVDemod);
m_objThreadedChannelizer = new ThreadedBasebandSampleSink(m_objChannelizer, this);
m_objDeviceAPI->addThreadedSink(m_objThreadedChannelizer);
ui->glScope->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer());
connect(&m_objPluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -294,6 +297,8 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
m_objMagSqAverage.resize(4, 1.0);
ui->scopeGUI->setBuddies(m_objScopeVis->getInputMessageQueue(), m_objScopeVis, ui->glScope);
resetToDefaults(); // does applySettings()
connect(m_objATVDemod->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
@ -306,6 +311,7 @@ ATVDemodGUI::~ATVDemodGUI()
delete m_objThreadedChannelizer;
delete m_objChannelizer;
delete m_objATVDemod;
delete m_objScopeVis;
delete ui;
}

View File

@ -29,6 +29,7 @@ class DeviceSourceAPI;
class ThreadedBasebandSampleSink;
class DownChannelizer;
class ATVDemod;
class ScopeVisNG;
namespace Ui
{
@ -97,6 +98,8 @@ private:
MovingAverage<double> m_objMagSqAverage;
int m_intTickCount;
ScopeVisNG* m_objScopeVis;
explicit ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent = NULL);
virtual ~ATVDemodGUI();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>539</height>
<width>700</width>
<height>668</height>
</rect>
</property>
<property name="sizePolicy">
@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>520</width>
<width>700</width>
<height>480</height>
</size>
</property>
@ -39,7 +39,7 @@
<rect>
<x>10</x>
<y>10</y>
<width>501</width>
<width>681</width>
<height>81</height>
</rect>
</property>
@ -396,55 +396,12 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>501</width>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
<string>Video</string>
</property>
<layout class="QHBoxLayout" name="screenTVLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="ATVScreen" name="screenTV" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>495</width>
<height>346</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>495</width>
<height>346</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_3">
<property name="geometry">
<rect>
<x>10</x>
<y>430</y>
<width>501</width>
<y>570</y>
<width>681</width>
<height>81</height>
</rect>
</property>
@ -726,6 +683,99 @@
</item>
</layout>
</widget>
<widget class="QTabWidget" name="screenTabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>680</width>
<height>461</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>680</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>Video</string>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabScreen">
<attribute name="title">
<string>Monitor</string>
</attribute>
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>632</width>
<height>442</height>
</rect>
</property>
<layout class="QHBoxLayout" name="screenTVLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="ATVScreen" name="screenTV" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>420</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>420</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tabScope">
<attribute name="title">
<string>Scope</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="GLScopeNG" name="glScope" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="GLScopeNGGUI" name="scopeGUI" native="true"/>
</item>
</layout>
</widget>
</widget>
</widget>
<customwidgets>
<customwidget>
@ -751,6 +801,18 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>GLScopeNG</class>
<extends>QWidget</extends>
<header>gui/glscopeng.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScopeNGGUI</class>
<extends>QWidget</extends>
<header>gui/glscopenggui.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>