diff --git a/Readme.md b/Readme.md index d95f463bb..b63502d84 100644 --- a/Readme.md +++ b/Readme.md @@ -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 ===== diff --git a/include-gpl/gui/glspectrum.h b/include-gpl/gui/glspectrum.h index 794780b71..2feab86df 100644 --- a/include-gpl/gui/glspectrum.h +++ b/include-gpl/gui/glspectrum.h @@ -148,6 +148,8 @@ private: void enterEvent(QEvent* event); void leaveEvent(QEvent* event); + float getCenterFreqLineRelPos(ChannelMarker *channelMarker); + private slots: void tick(); void channelMarkerChanged(); diff --git a/include/dsp/channelmarker.h b/include/dsp/channelmarker.h index d5c788536..d5b43bd4d 100644 --- a/include/dsp/channelmarker.h +++ b/include/dsp/channelmarker.h @@ -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: diff --git a/plugins/channel/nfm/nfmdemodgui.cpp b/plugins/channel/nfm/nfmdemodgui.cpp index fcdc472f0..fe97a7d6e 100644 --- a/plugins/channel/nfm/nfmdemodgui.cpp +++ b/plugins/channel/nfm/nfmdemodgui.cpp @@ -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); +} + diff --git a/plugins/channel/nfm/nfmdemodgui.h b/plugins/channel/nfm/nfmdemodgui.h index 66a263c72..ae927add1 100644 --- a/plugins/channel/nfm/nfmdemodgui.h +++ b/plugins/channel/nfm/nfmdemodgui.h @@ -61,6 +61,9 @@ private: ~NFMDemodGUI(); void applySettings(); + + void leaveEvent(QEvent*); + void enterEvent(QEvent*); }; #endif // INCLUDE_NFMDEMODGUI_H diff --git a/plugins/channel/ssb/ssbdemodgui.cpp b/plugins/channel/ssb/ssbdemodgui.cpp index b11321b77..8c9840fca 100644 --- a/plugins/channel/ssb/ssbdemodgui.cpp +++ b/plugins/channel/ssb/ssbdemodgui.cpp @@ -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); +} + diff --git a/plugins/channel/ssb/ssbdemodgui.h b/plugins/channel/ssb/ssbdemodgui.h index ac2d441fe..439acfebc 100644 --- a/plugins/channel/ssb/ssbdemodgui.h +++ b/plugins/channel/ssb/ssbdemodgui.h @@ -57,6 +57,9 @@ private: ~SSBDemodGUI(); void applySettings(); + + void leaveEvent(QEvent*); + void enterEvent(QEvent*); }; #endif // INCLUDE_SSBDEMODGUI_H diff --git a/sdrbase/dsp/channelmarker.cpp b/sdrbase/dsp/channelmarker.cpp index 3a0c40803..531c1c268 100644 --- a/sdrbase/dsp/channelmarker.cpp +++ b/sdrbase/dsp/channelmarker.cpp @@ -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; diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index 8374d4127..44c7a9724 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -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; + } +}