mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Spectrum markers: implemented histogram markers display enable
This commit is contained in:
parent
7a00e51dc6
commit
deafa0833b
@ -37,6 +37,12 @@ public:
|
||||
AvgModeMax
|
||||
};
|
||||
|
||||
enum MarkersDisplay
|
||||
{
|
||||
MarkersDisplayNone,
|
||||
MarkersDisplaySpectrum
|
||||
};
|
||||
|
||||
int m_fftSize;
|
||||
int m_fftOverlap;
|
||||
FFTWindow::Function m_fftWindow;
|
||||
|
@ -41,6 +41,7 @@ const float GLSpectrum::m_maxFrequencyZoom = 10.0f;
|
||||
|
||||
GLSpectrum::GLSpectrum(QWidget* parent) :
|
||||
QGLWidget(parent),
|
||||
m_markersDisplay(SpectrumSettings::MarkersDisplaySpectrum),
|
||||
m_cursorState(CSNormal),
|
||||
m_cursorChannel(0),
|
||||
m_spectrumVis(nullptr),
|
||||
@ -1019,7 +1020,9 @@ void GLSpectrum::paintGL()
|
||||
}
|
||||
}
|
||||
|
||||
drawMarkers();
|
||||
if (m_markersDisplay == SpectrumSettings::MarkersDisplaySpectrum) {
|
||||
drawSpectrumMarkers();
|
||||
}
|
||||
|
||||
// paint waterfall grid
|
||||
if (m_displayWaterfall && m_displayGrid)
|
||||
@ -1166,7 +1169,7 @@ void GLSpectrum::paintGL()
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
void GLSpectrum::drawMarkers()
|
||||
void GLSpectrum::drawSpectrumMarkers()
|
||||
{
|
||||
QVector4D lineColor(1.0f, 1.0f, 1.0f, 0.3f);
|
||||
|
||||
@ -1175,6 +1178,10 @@ void GLSpectrum::drawMarkers()
|
||||
{
|
||||
for (int i = 0; i < m_histogramMarkers.size(); i++)
|
||||
{
|
||||
if (!m_histogramMarkers.at(i).m_show) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QPointF ypoint = m_histogramMarkers.at(i).m_point;
|
||||
QString powerStr = m_histogramMarkers.at(i).m_powerStr;
|
||||
|
||||
@ -1307,6 +1314,10 @@ void GLSpectrum::drawMarkers()
|
||||
// crosshairs
|
||||
for (int i = 0; i < m_waterfallMarkers.size(); i++)
|
||||
{
|
||||
if (!m_waterfallMarkers.at(i).m_show) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GLfloat h[] {
|
||||
(float) m_waterfallMarkers.at(i).m_point.x(), 0,
|
||||
(float) m_waterfallMarkers.at(i).m_point.x(), 1
|
||||
@ -1317,10 +1328,10 @@ void GLSpectrum::drawMarkers()
|
||||
1, (float) m_waterfallMarkers.at(i).m_point.y()
|
||||
};
|
||||
m_glShaderSimple.drawSegments(m_glWaterfallBoxMatrix, lineColor, v, 2);
|
||||
}
|
||||
// }
|
||||
// text
|
||||
for (int i = 0; i < m_waterfallMarkers.size(); i++)
|
||||
{
|
||||
// for (int i = 0; i < m_waterfallMarkers.size(); i++)
|
||||
// {
|
||||
QColor textColor = m_waterfallMarkers.at(i).m_markerColor;
|
||||
textColor.setAlpha(192);
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "gui/glshadertextured.h"
|
||||
#include "gui/spectrummarkers.h"
|
||||
#include "dsp/channelmarker.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "export.h"
|
||||
#include "util/incrementalarray.h"
|
||||
#include "util/message.h"
|
||||
@ -162,6 +163,7 @@ public:
|
||||
void setWaterfallMarkers(const QList<SpectrumWaterfallMarker>& waterfallMarkers);
|
||||
void updateHistogramMarkers();
|
||||
void updateWaterfallMarkers();
|
||||
SpectrumSettings::MarkersDisplay& getMarkersDisplay() { return m_markersDisplay; }
|
||||
|
||||
private:
|
||||
struct ChannelMarkerState {
|
||||
@ -190,6 +192,7 @@ private:
|
||||
|
||||
QList<SpectrumHistogramMarker> m_histogramMarkers;
|
||||
QList<SpectrumWaterfallMarker> m_waterfallMarkers;
|
||||
SpectrumSettings::MarkersDisplay m_markersDisplay;
|
||||
|
||||
CursorState m_cursorState;
|
||||
int m_cursorChannel;
|
||||
@ -296,7 +299,7 @@ private:
|
||||
void initializeGL();
|
||||
void resizeGL(int width, int height);
|
||||
void paintGL();
|
||||
void drawMarkers();
|
||||
void drawSpectrumMarkers();
|
||||
|
||||
void stopDrag();
|
||||
void applyChanges();
|
||||
|
@ -343,6 +343,7 @@ void GLSpectrumGUI::on_markers_clicked(bool checked)
|
||||
SpectrumMarkersDialog markersDialog(
|
||||
m_glSpectrum->getHistogramMarkers(),
|
||||
m_glSpectrum->getWaterfallMarkers(),
|
||||
m_glSpectrum->getMarkersDisplay(),
|
||||
this
|
||||
);
|
||||
|
||||
|
@ -41,6 +41,7 @@ struct SpectrumHistogramMarker
|
||||
float m_powerMax;
|
||||
SpectrumHistogramMarkerType m_markerType;
|
||||
QColor m_markerColor;
|
||||
bool m_show;
|
||||
QString m_frequencyStr;
|
||||
QString m_powerStr;
|
||||
QString m_deltaFrequencyStr;
|
||||
@ -56,6 +57,7 @@ struct SpectrumHistogramMarker
|
||||
m_powerMax(0),
|
||||
m_markerType(SpectrumHistogramMarkerTypeManual),
|
||||
m_markerColor(QColorConstants::White),
|
||||
m_show(true),
|
||||
m_frequencyStr(),
|
||||
m_powerStr(),
|
||||
m_deltaFrequencyStr(),
|
||||
@ -71,6 +73,7 @@ struct SpectrumHistogramMarker
|
||||
float powerMax,
|
||||
SpectrumHistogramMarkerType markerType,
|
||||
QColor markerColor,
|
||||
bool show,
|
||||
const QString& frequencyStr,
|
||||
const QString& powerStr,
|
||||
const QString& deltaFrequencyStr,
|
||||
@ -84,6 +87,7 @@ struct SpectrumHistogramMarker
|
||||
m_powerMax(powerMax),
|
||||
m_markerType(markerType),
|
||||
m_markerColor(markerColor),
|
||||
m_show(show),
|
||||
m_frequencyStr(frequencyStr),
|
||||
m_powerStr(powerStr),
|
||||
m_deltaFrequencyStr(deltaFrequencyStr),
|
||||
@ -100,6 +104,7 @@ struct SpectrumWaterfallMarker
|
||||
float m_frequency;
|
||||
float m_time;
|
||||
QColor m_markerColor;
|
||||
bool m_show;
|
||||
QString m_frequencyStr;
|
||||
QString m_timeStr;
|
||||
QString m_deltaFrequencyStr;
|
||||
@ -111,6 +116,7 @@ struct SpectrumWaterfallMarker
|
||||
m_frequency(0),
|
||||
m_time(0),
|
||||
m_markerColor(QColorConstants::White),
|
||||
m_show(true),
|
||||
m_frequencyStr(),
|
||||
m_timeStr(),
|
||||
m_deltaFrequencyStr(),
|
||||
@ -122,6 +128,7 @@ struct SpectrumWaterfallMarker
|
||||
float frequency,
|
||||
float time,
|
||||
QColor markerColor,
|
||||
bool show,
|
||||
const QString& frequencyStr,
|
||||
const QString& timeStr,
|
||||
const QString& deltaFrequencyStr,
|
||||
@ -131,6 +138,7 @@ struct SpectrumWaterfallMarker
|
||||
m_frequency(frequency),
|
||||
m_time(time),
|
||||
m_markerColor(markerColor),
|
||||
m_show(show),
|
||||
m_frequencyStr(frequencyStr),
|
||||
m_timeStr(timeStr),
|
||||
m_deltaFrequencyStr(deltaFrequencyStr),
|
||||
|
@ -27,11 +27,13 @@
|
||||
SpectrumMarkersDialog::SpectrumMarkersDialog(
|
||||
QList<SpectrumHistogramMarker>& histogramMarkers,
|
||||
QList<SpectrumWaterfallMarker>& waterfallMarkers,
|
||||
SpectrumSettings::MarkersDisplay& markersDisplay,
|
||||
QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SpectrumMarkersDialog),
|
||||
m_histogramMarkers(histogramMarkers),
|
||||
m_waterfallMarkers(waterfallMarkers),
|
||||
m_markersDisplay(markersDisplay),
|
||||
m_histogramMarkerIndex(0),
|
||||
m_waterfallMarkerIndex(0),
|
||||
m_centerFrequency(0),
|
||||
@ -44,6 +46,7 @@ SpectrumMarkersDialog::SpectrumMarkersDialog(
|
||||
ui->wMarkerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->wMarkerFrequency->setValueRange(false, 10, -9999999999L, 9999999999L);
|
||||
ui->wMarker->setMaximum(m_waterfallMarkers.size() - 1);
|
||||
ui->showSelect->setCurrentIndex((int) m_markersDisplay);
|
||||
displayHistogramMarker();
|
||||
displayWaterfallMarker();
|
||||
}
|
||||
@ -59,6 +62,7 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
ui->markerFrequency->setEnabled(false);
|
||||
ui->powerMode->setEnabled(false);
|
||||
ui->fixedPower->setEnabled(false);
|
||||
ui->showMarker->setEnabled(false);
|
||||
ui->markerText->setText("-");
|
||||
ui->fixedPower->setValue(0);
|
||||
ui->fixedPowerText->setText(tr("0.0"));
|
||||
@ -69,6 +73,7 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
ui->markerFrequency->setEnabled(true);
|
||||
ui->powerMode->setEnabled(true);
|
||||
ui->fixedPower->setEnabled(true);
|
||||
ui->showMarker->setEnabled(true);
|
||||
ui->markerText->setText(tr("%1").arg(m_histogramMarkerIndex));
|
||||
ui->markerFrequency->setValue(m_histogramMarkers[m_histogramMarkerIndex].m_frequency);
|
||||
ui->powerMode->setCurrentIndex((int) m_histogramMarkers[m_histogramMarkerIndex].m_markerType);
|
||||
@ -78,6 +83,7 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
int r,g,b,a;
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerColor.getRgb(&r, &g, &b, &a);
|
||||
ui->markerColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
|
||||
ui->showMarker->setChecked(m_histogramMarkers[m_histogramMarkerIndex].m_show);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,6 +96,7 @@ void SpectrumMarkersDialog::displayWaterfallMarker()
|
||||
ui->timeCoarse->setEnabled(false);
|
||||
ui->timeFine->setEnabled(false);
|
||||
ui->timeExp->setEnabled(false);
|
||||
ui->wShowMarker->setEnabled(false);
|
||||
ui->wMarkerText->setText("-");
|
||||
ui->timeCoarse->setValue(0);
|
||||
ui->timeFine->setValue(0);
|
||||
@ -104,6 +111,7 @@ void SpectrumMarkersDialog::displayWaterfallMarker()
|
||||
ui->timeCoarse->setEnabled(true);
|
||||
ui->timeFine->setEnabled(true);
|
||||
ui->timeExp->setEnabled(true);
|
||||
ui->wShowMarker->setEnabled(true);
|
||||
ui->wMarkerText->setText(tr("%1").arg(m_waterfallMarkerIndex));
|
||||
ui->wMarkerFrequency->setValue(m_waterfallMarkers[m_waterfallMarkerIndex].m_frequency);
|
||||
int r,g,b,a;
|
||||
@ -175,6 +183,15 @@ void SpectrumMarkersDialog::on_markerColor_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_showMarker_clicked(bool clicked)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_show = clicked;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_fixedPower_valueChanged(int value)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
@ -247,7 +264,15 @@ void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
||||
SpectrumHistogramMarkerType newType = (SpectrumHistogramMarkerType) index;
|
||||
|
||||
if ((m_histogramMarkers[m_histogramMarkerIndex].m_markerType != newType)
|
||||
&& (newType == SpectrumHistogramMarkerTypePowerMax))
|
||||
{
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_holdReset = true;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = newType;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_powerHoldReset_clicked()
|
||||
@ -338,6 +363,15 @@ void SpectrumMarkersDialog::on_wMarkerColor_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_wShowMarker_clicked(bool clicked)
|
||||
{
|
||||
if (m_waterfallMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_waterfallMarkers[m_waterfallMarkerIndex].m_show = clicked;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_wMarker_valueChanged(int value)
|
||||
{
|
||||
if (m_waterfallMarkers.size() == 0) {
|
||||
@ -391,3 +425,8 @@ void SpectrumMarkersDialog::on_wMarkerDel_clicked()
|
||||
ui->wMarker->setMaximum(m_waterfallMarkers.size() - 1);
|
||||
displayWaterfallMarker();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_showSelect_currentIndexChanged(int index)
|
||||
{
|
||||
m_markersDisplay = (SpectrumSettings::MarkersDisplay) index;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "gui/spectrummarkers.h"
|
||||
#include "export.h"
|
||||
|
||||
@ -36,6 +37,7 @@ public:
|
||||
explicit SpectrumMarkersDialog(
|
||||
QList<SpectrumHistogramMarker>& histogramMarkers,
|
||||
QList<SpectrumWaterfallMarker>& waterfallMarkers,
|
||||
SpectrumSettings::MarkersDisplay& markersDisplay,
|
||||
QWidget* parent = nullptr
|
||||
);
|
||||
~SpectrumMarkersDialog();
|
||||
@ -47,6 +49,7 @@ private:
|
||||
Ui::SpectrumMarkersDialog* ui;
|
||||
QList<SpectrumHistogramMarker>& m_histogramMarkers;
|
||||
QList<SpectrumWaterfallMarker>& m_waterfallMarkers;
|
||||
SpectrumSettings::MarkersDisplay& m_markersDisplay;
|
||||
int m_histogramMarkerIndex;
|
||||
int m_waterfallMarkerIndex;
|
||||
qint64 m_centerFrequency;
|
||||
@ -62,6 +65,7 @@ private slots:
|
||||
void on_markerFrequency_changed(qint64 value);
|
||||
void on_centerFrequency_clicked();
|
||||
void on_markerColor_clicked();
|
||||
void on_showMarker_clicked(bool clicked);
|
||||
void on_fixedPower_valueChanged(int value);
|
||||
void on_marker_valueChanged(int value);
|
||||
void on_setReference_clicked();
|
||||
@ -75,10 +79,12 @@ private slots:
|
||||
void on_timeExp_valueChanged(int value);
|
||||
void on_wCenterFrequency_clicked();
|
||||
void on_wMarkerColor_clicked();
|
||||
void on_wShowMarker_clicked(bool clicked);
|
||||
void on_wMarker_valueChanged(int value);
|
||||
void on_wSetReference_clicked();
|
||||
void on_wMarkerAdd_clicked();
|
||||
void on_wMarkerDel_clicked();
|
||||
void on_showSelect_currentIndexChanged(int index);
|
||||
|
||||
signals:
|
||||
void updateHistogram();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>418</width>
|
||||
<height>201</height>
|
||||
<height>237</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -158,6 +158,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showMarker">
|
||||
<property name="toolTip">
|
||||
<string>Show this marker</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -594,6 +607,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="wShowMarker">
|
||||
<property name="toolTip">
|
||||
<string>Show this marker</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -963,6 +989,50 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="commonLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="showLabel">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="showSelect">
|
||||
<property name="toolTip">
|
||||
<string>Select which set of markers to show</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Spec</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user