NFM and SSB receiver in focus trigger the display of the central frequency line on the spectrum frequency scale thus facilitating its identification

This commit is contained in:
f4exb 2015-05-11 11:03:01 +02:00
parent 0602584f81
commit fe85503130
9 changed files with 68 additions and 4 deletions

View File

@ -76,6 +76,7 @@ Done since the fork
- Added display and precise control of the shift frequency from center frequency of the SSB receivers.
- Make the sidebands appear correctly on SSB channel overlay. Limit to +/- 6 kHz to fit channel spectrum analyzer window
- SSB bandwidth can now be tuned in steps of 100 Hz
- NFM and SSB receiver in focus trigger the display of the central frequency line on the spectrum frequency scale thus facilitating its identification
=====

View File

@ -148,6 +148,8 @@ private:
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
float getCenterFreqLineRelPos(ChannelMarker *channelMarker);
private slots:
void tick();
void channelMarkerChanged();

View File

@ -33,6 +33,9 @@ public:
void setVisible(bool visible);
bool getVisible() const { return m_visible; }
void setHighlighted(bool highlighted);
bool getHighlighted() const { return m_highlighted; }
void setColor(const QColor& color);
const QColor& getColor() const { return m_color; }
@ -45,6 +48,7 @@ protected:
int m_bandwidth;
sidebands_t m_sidebands;
bool m_visible;
bool m_highlighted;
QColor m_color;
signals:

View File

@ -222,3 +222,14 @@ void NFMDemodGUI::applySettings()
ui->volume->value() / 10.0,
ui->squelch->value());
}
void NFMDemodGUI::leaveEvent(QEvent*)
{
m_channelMarker->setHighlighted(false);
}
void NFMDemodGUI::enterEvent(QEvent*)
{
m_channelMarker->setHighlighted(true);
}

View File

@ -61,6 +61,9 @@ private:
~NFMDemodGUI();
void applySettings();
void leaveEvent(QEvent*);
void enterEvent(QEvent*);
};
#endif // INCLUDE_NFMDEMODGUI_H

View File

@ -209,3 +209,14 @@ void SSBDemodGUI::applySettings()
ui->BW->value() * 100.0,
ui->volume->value() / 10.0 );
}
void SSBDemodGUI::leaveEvent(QEvent*)
{
m_channelMarker->setHighlighted(false);
}
void SSBDemodGUI::enterEvent(QEvent*)
{
m_channelMarker->setHighlighted(true);
}

View File

@ -57,6 +57,9 @@ private:
~SSBDemodGUI();
void applySettings();
void leaveEvent(QEvent*);
void enterEvent(QEvent*);
};
#endif // INCLUDE_SSBDEMODGUI_H

View File

@ -31,6 +31,7 @@ ChannelMarker::ChannelMarker(QObject* parent) :
m_bandwidth(0),
m_sidebands(dsb),
m_visible(false),
m_highlighted(false),
m_color(m_colorTable[m_nextColor])
{
++m_nextColor;
@ -68,6 +69,12 @@ void ChannelMarker::setVisible(bool visible)
emit changed();
}
void ChannelMarker::setHighlighted(bool highlighted)
{
m_highlighted = highlighted;
emit changed();
}
void ChannelMarker::setColor(const QColor& color)
{
m_color = color;

View File

@ -544,7 +544,7 @@ void GLSpectrum::paintGL()
for(int i = 0; i < m_channelMarkerStates.size(); ++i) {
ChannelMarkerState* dv = m_channelMarkerStates[i];
if(dv->m_channelMarker->getVisible()) {
/*
ChannelMarker::sidebands_t sidebands = dv->m_channelMarker->getSidebands();
float fcLineRelativePos;
if (sidebands == ChannelMarker::usb) {
@ -554,7 +554,7 @@ void GLSpectrum::paintGL()
} else {
fcLineRelativePos = 0.5;
}
*/
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(dv->m_channelMarker->getColor().redF(), dv->m_channelMarker->getColor().greenF(), dv->m_channelMarker->getColor().blueF(), 0.3f);
@ -570,8 +570,8 @@ void GLSpectrum::paintGL()
glDisable(GL_BLEND);
glColor3f(0.8f, 0.8f, 0.6f);
glBegin(GL_LINE_LOOP);
glVertex2f(fcLineRelativePos, 0);
glVertex2f(fcLineRelativePos, 1);
glVertex2f(getCenterFreqLineRelPos(dv->m_channelMarker), 0);
glVertex2f(getCenterFreqLineRelPos(dv->m_channelMarker), 1);
glEnd();
glPopMatrix();
}
@ -667,6 +667,15 @@ void GLSpectrum::paintGL()
glVertex2f(1, 1);
glVertex2f(0, 1);
glEnd();
if (dv->m_channelMarker->getHighlighted()) {
glColor3f(0.8f, 0.8f, 0.6f);
glBegin(GL_LINE_LOOP);
glVertex2f(getCenterFreqLineRelPos(dv->m_channelMarker), 0);
glVertex2f(getCenterFreqLineRelPos(dv->m_channelMarker), 1);
glEnd();
}
glDisable(GL_BLEND);
glPopMatrix();
}
@ -1325,3 +1334,16 @@ void GLSpectrum::channelMarkerDestroyed(QObject* object)
{
removeChannelMarker((ChannelMarker*)object);
}
float GLSpectrum::getCenterFreqLineRelPos(ChannelMarker *channelMarker)
{
ChannelMarker::sidebands_t sidebands = channelMarker->getSidebands();
if (sidebands == ChannelMarker::usb) {
return 0.0;
} else if (sidebands == ChannelMarker::lsb) {
return 1.0;
} else {
return 0.5;
}
}