1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

Added frequency scale display option to channel marker

This commit is contained in:
f4exb 2017-08-26 06:38:28 +02:00
parent e0014867a7
commit 480257a5dd
5 changed files with 89 additions and 2 deletions

View File

@ -38,11 +38,14 @@ ChannelMarker::ChannelMarker(QObject* parent) :
m_movable(true), m_movable(true),
m_udpAddress("127.0.0.1"), m_udpAddress("127.0.0.1"),
m_udpReceivePort(9999), m_udpReceivePort(9999),
m_udpSendPort(9998) m_udpSendPort(9998),
m_fScaleDisplayType(FScaleDisplay_freq)
{ {
++m_nextColor; ++m_nextColor;
if(m_colorTable[m_nextColor] == 0) if(m_colorTable[m_nextColor] == 0)
m_nextColor = 0; m_nextColor = 0;
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPSendPort()));
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPReceivePort()));
} }
void ChannelMarker::setTitle(const QString& title) void ChannelMarker::setTitle(const QString& title)
@ -102,17 +105,21 @@ void ChannelMarker::setColor(const QColor& color)
void ChannelMarker::setUDPAddress(const QString& udpAddress) void ChannelMarker::setUDPAddress(const QString& udpAddress)
{ {
m_udpAddress = udpAddress; m_udpAddress = udpAddress;
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPSendPort()));
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPReceivePort()));
emit changed(); emit changed();
} }
void ChannelMarker::setUDPReceivePort(quint16 port) void ChannelMarker::setUDPReceivePort(quint16 port)
{ {
m_udpReceivePort = port; m_udpReceivePort = port;
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPReceivePort()));
emit changed(); emit changed();
} }
void ChannelMarker::setUDPSendPort(quint16 port) void ChannelMarker::setUDPSendPort(quint16 port)
{ {
m_udpSendPort = port; m_udpSendPort = port;
m_displayAddressReceive = QString(tr("%1:%2").arg(getUDPAddress()).arg(getUDPSendPort()));
emit changed(); emit changed();
} }

View File

@ -18,6 +18,14 @@ public:
vlsb //!< LSB with vestigial USB vlsb //!< LSB with vestigial USB
} sidebands_t; } sidebands_t;
typedef enum frequencyScaleDisplay_e
{
FScaleDisplay_freq,
FScaleDisplay_title,
FScaleDisplay_addressSend,
FScaleDisplay_addressReceive,
} frequencyScaleDisplay_t;
ChannelMarker(QObject* parent = NULL); ChannelMarker(QObject* parent = NULL);
void setTitle(const QString& title); void setTitle(const QString& title);
@ -59,12 +67,19 @@ public:
void setUDPSendPort(quint16 port); void setUDPSendPort(quint16 port);
quint16 getUDPSendPort() const { return m_udpSendPort; } quint16 getUDPSendPort() const { return m_udpSendPort; }
void setFrequencyScaleDisplayType(frequencyScaleDisplay_t type) { m_fScaleDisplayType = type; }
frequencyScaleDisplay_t getFrequencyScaleDisplayType() const { return m_fScaleDisplayType; }
const QString& getDisplayAddressSend() const { return m_displayAddressSend; }
const QString& getDisplayAddressReceive() const { return m_displayAddressReceive; }
protected: protected:
static QRgb m_colorTable[]; static QRgb m_colorTable[];
static int m_nextColor; static int m_nextColor;
QString m_title; QString m_title;
QString m_displayAddressSend;
QString m_displayAddressReceive;
int m_centerFrequency; int m_centerFrequency;
int m_bandwidth; int m_bandwidth;
int m_oppositeBandwidth; int m_oppositeBandwidth;
@ -77,6 +92,7 @@ protected:
QString m_udpAddress; QString m_udpAddress;
quint16 m_udpReceivePort; quint16 m_udpReceivePort;
quint16 m_udpSendPort; quint16 m_udpSendPort;
frequencyScaleDisplay_t m_fScaleDisplayType;
signals: signals:
void changed(); void changed();

View File

@ -74,5 +74,7 @@ void BasicChannelSettingsDialog::accept()
m_channelMarker->setUDPSendPort(udpPort); m_channelMarker->setUDPSendPort(udpPort);
m_channelMarker->setFrequencyScaleDisplayType((ChannelMarker::frequencyScaleDisplay_t) ui->fScaleDisplayType->currentIndex());
QDialog::accept(); QDialog::accept();
} }

View File

@ -70,6 +70,50 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="fScaleDisplayTypeLabel">
<property name="text">
<string>FScale</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fScaleDisplayType">
<item>
<property name="text">
<string>Freq</string>
</property>
</item>
<item>
<property name="text">
<string>Title</string>
</property>
</item>
<item>
<property name="text">
<string>AdSnd</string>
</property>
</item>
<item>
<property name="text">
<string>AdRcv</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -1472,7 +1472,25 @@ void GLSpectrum::applyChanges()
int shift; int shift;
//ChannelMarker::sidebands_t sidebands = dv->m_channelMarker->getSidebands(); //ChannelMarker::sidebands_t sidebands = dv->m_channelMarker->getSidebands();
xc = m_centerFrequency + dv->m_channelMarker->getCenterFrequency(); // marker center frequency xc = m_centerFrequency + dv->m_channelMarker->getCenterFrequency(); // marker center frequency
QString ftext = QString::number((m_centerFrequency + dv->m_channelMarker->getCenterFrequency())/1e6, 'f', 6); QString ftext;
switch (dv->m_channelMarker->getFrequencyScaleDisplayType())
{
case ChannelMarker::FScaleDisplay_freq:
ftext = QString::number((m_centerFrequency + dv->m_channelMarker->getCenterFrequency())/1e6, 'f', 6); // TODO
break;
case ChannelMarker::FScaleDisplay_title:
ftext = dv->m_channelMarker->getTitle();
break;
case ChannelMarker::FScaleDisplay_addressSend:
ftext = dv->m_channelMarker->getDisplayAddressSend();
break;
case ChannelMarker::FScaleDisplay_addressReceive:
ftext = dv->m_channelMarker->getDisplayAddressReceive();
break;
default:
ftext = QString::number((m_centerFrequency + dv->m_channelMarker->getCenterFrequency())/1e6, 'f', 6);
break;
}
if (dv->m_channelMarker->getCenterFrequency() < 0) { // left half of scale if (dv->m_channelMarker->getCenterFrequency() < 0) { // left half of scale
ftext = " " + ftext; ftext = " " + ftext;
shift = 0; shift = 0;