mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-05 02:58:37 -04:00
Spectrum markers: make dialog dynamic
This commit is contained in:
parent
beb03eef01
commit
e7e82a12b0
@ -154,9 +154,13 @@ public:
|
||||
}
|
||||
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
|
||||
const QList<SpectrumHistogramMarker>& getHistogramMarkers() const { return m_histogramMarkers; }
|
||||
QList<SpectrumHistogramMarker>& getHistogramMarkers() { return m_histogramMarkers; }
|
||||
void setHistogramMarkers(const QList<SpectrumHistogramMarker>& histogramMarkers);
|
||||
const QList<SpectrumWaterfallMarker>& getWaterfallMarkers() const { return m_waterfallMarkers; }
|
||||
QList<SpectrumWaterfallMarker>& getWaterfallMarkers() { return m_waterfallMarkers; }
|
||||
void setWaterfallMarkers(const QList<SpectrumWaterfallMarker>& waterfallMarkers);
|
||||
void updateHistogramMarkers();
|
||||
void updateWaterfallMarkers();
|
||||
|
||||
private:
|
||||
struct ChannelMarkerState {
|
||||
@ -327,8 +331,6 @@ private:
|
||||
bool topHalf,
|
||||
const QRectF& glRect);
|
||||
void formatTextInfo(QString& info);
|
||||
void updateHistogramMarkers();
|
||||
void updateWaterfallMarkers();
|
||||
|
||||
private slots:
|
||||
void cleanup();
|
||||
|
@ -340,22 +340,19 @@ void GLSpectrumGUI::on_markers_clicked(bool checked)
|
||||
return;
|
||||
}
|
||||
|
||||
QList<SpectrumHistogramMarker> histogramMarkers = m_glSpectrum->getHistogramMarkers();
|
||||
QList<SpectrumWaterfallMarker> waterfallMarkers = m_glSpectrum->getWaterfallMarkers();
|
||||
SpectrumMarkersDialog markersDialog(histogramMarkers, waterfallMarkers, this);
|
||||
SpectrumMarkersDialog markersDialog(
|
||||
m_glSpectrum->getHistogramMarkers(),
|
||||
m_glSpectrum->getWaterfallMarkers(),
|
||||
this
|
||||
);
|
||||
|
||||
markersDialog.setCenterFrequency(m_glSpectrum->getCenterFrequency());
|
||||
markersDialog.setPower(m_glSpectrum->getPowerMax() / 2.0f);
|
||||
|
||||
if (markersDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (markersDialog.histogramMarkersChanged()) {
|
||||
m_glSpectrum->setHistogramMarkers(histogramMarkers);
|
||||
}
|
||||
connect(&markersDialog, SIGNAL(updateHistogram()), this, SLOT(updateHistogramMarkers()));
|
||||
connect(&markersDialog, SIGNAL(updateWaterfall()), this, SLOT(updateWaterfallMarkers()));
|
||||
|
||||
if (markersDialog.waterfallMarkersChanged()) {
|
||||
m_glSpectrum->setWaterfallMarkers(waterfallMarkers);
|
||||
}
|
||||
}
|
||||
markersDialog.exec();
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::on_refLevel_valueChanged(int value)
|
||||
@ -691,3 +688,17 @@ void GLSpectrumGUI::openWebsocketSpectrumSettingsDialog(const QPoint& p)
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::updateHistogramMarkers()
|
||||
{
|
||||
if (m_glSpectrum) {
|
||||
m_glSpectrum->updateHistogramMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::updateWaterfallMarkers()
|
||||
{
|
||||
if (m_glSpectrum) {
|
||||
m_glSpectrum->updateWaterfallMarkers();
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,9 @@ private slots:
|
||||
|
||||
void handleInputMessages();
|
||||
void openWebsocketSpectrumSettingsDialog(const QPoint& p);
|
||||
|
||||
void updateHistogramMarkers();
|
||||
void updateWaterfallMarkers();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_GLSPECTRUMGUI_H
|
||||
|
@ -30,8 +30,6 @@ SpectrumMarkersDialog::SpectrumMarkersDialog(
|
||||
ui(new Ui::SpectrumMarkersDialog),
|
||||
m_histogramMarkers(histogramMarkers),
|
||||
m_waterfallMarkers(waterfallMarkers),
|
||||
m_histogramMarkersChanged(false),
|
||||
m_waterfallMarkersChanged(false),
|
||||
m_histogramMarkerIndex(0),
|
||||
m_centerFrequency(0),
|
||||
m_power(0.5f)
|
||||
@ -73,18 +71,6 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
}
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::accept()
|
||||
{
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::reject()
|
||||
{
|
||||
m_histogramMarkersChanged = false;
|
||||
m_waterfallMarkersChanged = false;
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerFrequency_changed(qint64 value)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
@ -92,7 +78,7 @@ void SpectrumMarkersDialog::on_markerFrequency_changed(qint64 value)
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_frequency = value;
|
||||
m_histogramMarkersChanged = true;
|
||||
emit updateHistogram();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_fixedPower_valueChanged(int value)
|
||||
@ -104,7 +90,7 @@ void SpectrumMarkersDialog::on_fixedPower_valueChanged(int value)
|
||||
float powerDB = value / 10.0f;
|
||||
ui->fixedPowerText->setText(QString::number(powerDB, 'f', 1));
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_power = CalcDb::powerFromdB(powerDB);
|
||||
m_histogramMarkersChanged = true;
|
||||
emit updateHistogram();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_marker_valueChanged(int value)
|
||||
@ -129,7 +115,7 @@ void SpectrumMarkersDialog::on_setReference_clicked(bool checked)
|
||||
m_histogramMarkers[0] = m_histogramMarkers[m_histogramMarkerIndex];
|
||||
m_histogramMarkers[m_histogramMarkerIndex] = marker0;
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
emit updateHistogram();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerAdd_clicked(bool checked)
|
||||
@ -146,7 +132,6 @@ void SpectrumMarkersDialog::on_markerAdd_clicked(bool checked)
|
||||
m_histogramMarkerIndex = m_histogramMarkers.size() - 1;
|
||||
ui->marker->setMaximum(m_histogramMarkers.size() - 1);
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerDel_clicked(bool checked)
|
||||
@ -162,7 +147,6 @@ void SpectrumMarkersDialog::on_markerDel_clicked(bool checked)
|
||||
m_histogramMarkerIndex : m_histogramMarkerIndex - 1;
|
||||
ui->marker->setMaximum(m_histogramMarkers.size() - 1);
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
||||
@ -172,5 +156,4 @@ void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
@ -39,8 +39,6 @@ public:
|
||||
QWidget* parent = nullptr
|
||||
);
|
||||
~SpectrumMarkersDialog();
|
||||
bool histogramMarkersChanged() const { return m_histogramMarkersChanged; }
|
||||
bool waterfallMarkersChanged() const { return m_waterfallMarkersChanged; }
|
||||
void setCenterFrequency(qint64 centerFrequency) { m_centerFrequency = centerFrequency; }
|
||||
void setPower(float power) { m_power = power; }
|
||||
|
||||
@ -48,8 +46,6 @@ private:
|
||||
Ui::SpectrumMarkersDialog* ui;
|
||||
QList<SpectrumHistogramMarker>& m_histogramMarkers;
|
||||
QList<SpectrumWaterfallMarker>& m_waterfallMarkers;
|
||||
bool m_histogramMarkersChanged;
|
||||
bool m_waterfallMarkersChanged;
|
||||
int m_histogramMarkerIndex;
|
||||
qint64 m_centerFrequency;
|
||||
float m_power;
|
||||
@ -64,8 +60,10 @@ private slots:
|
||||
void on_markerAdd_clicked(bool checked);
|
||||
void on_markerDel_clicked(bool checked);
|
||||
void on_powerMode_currentIndexChanged(int index);
|
||||
void accept();
|
||||
void reject();
|
||||
|
||||
signals:
|
||||
void updateHistogram();
|
||||
void updateWaterfall();
|
||||
};
|
||||
|
||||
#endif // SDRBASE_GUI_SPECTRUMMARKERSDIALOG_H_
|
||||
|
@ -393,7 +393,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user