mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-27 15:26:33 -04:00
Spectrum markers dialog (1)
This commit is contained in:
parent
1c2c8352f2
commit
1decb23fac
@ -59,6 +59,7 @@ set(sdrgui_SOURCES
|
||||
gui/scaleengine.cpp
|
||||
gui/scaledimage.cpp
|
||||
gui/sdrangelsplash.cpp
|
||||
gui/spectrummarkersdialog.cpp
|
||||
gui/tickedslider.cpp
|
||||
gui/transverterbutton.cpp
|
||||
gui/transverterdialog.cpp
|
||||
@ -148,6 +149,7 @@ set(sdrgui_HEADERS
|
||||
gui/scaledimage.h
|
||||
gui/sdrangelsplash.h
|
||||
gui/spectrummarkers.h
|
||||
gui/spectrummarkersdialog.h
|
||||
gui/tickedslider.h
|
||||
gui/transverterbutton.h
|
||||
gui/transverterdialog.h
|
||||
@ -205,6 +207,7 @@ set(sdrgui_FORMS
|
||||
gui/audioselectdialog.ui
|
||||
gui/samplingdevicecontrol.ui
|
||||
gui/samplingdevicedialog.ui
|
||||
gui/spectrummarkersdialog.ui
|
||||
gui/myposdialog.ui
|
||||
gui/transverterdialog.ui
|
||||
gui/loggingdialog.ui
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/db.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -417,6 +418,31 @@ void GLSpectrum::removeChannelMarker(ChannelMarker* channelMarker)
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
void GLSpectrum::setHistogramMarkers(const QList<SpectrumHistogramMarker>& histogramMarkers)
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_histogramMarkers = histogramMarkers;
|
||||
updateHistogramMarkers();
|
||||
m_changesPending = true;
|
||||
m_mutex.unlock();
|
||||
update();
|
||||
}
|
||||
|
||||
void GLSpectrum::setWaterfallMarkers(const QList<SpectrumWaterfallMarker>& waterfallMarkers)
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_waterfallMarkers = waterfallMarkers;
|
||||
updateWaterfallMarkers();
|
||||
m_changesPending = true;
|
||||
m_mutex.unlock();
|
||||
update();
|
||||
}
|
||||
|
||||
float GLSpectrum::getPowerMax() const
|
||||
{
|
||||
return m_linear ? m_powerScale.getRangeMax() : CalcDb::powerFromdB(m_powerScale.getRangeMax());
|
||||
}
|
||||
|
||||
void GLSpectrum::newSpectrum(const Real *spectrum, int nbBins, int fftSize)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
@ -1197,10 +1223,10 @@ void GLSpectrum::drawMarkers()
|
||||
{
|
||||
float power0 = m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||
m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin] :
|
||||
m_histogramMarkers.at(0).m_power;
|
||||
m_linear ? m_histogramMarkers.at(0).m_power : CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||
float poweri = m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
||||
m_histogramMarkers.at(i).m_power;
|
||||
m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||
QString deltaPowerStr = displayScaledF(
|
||||
poweri - power0,
|
||||
m_linear ? 'e' : 'f',
|
||||
@ -1979,25 +2005,88 @@ void GLSpectrum::applyChanges()
|
||||
m_q3TickTime.allocate(4*m_timeScale.getTickList().count());
|
||||
m_q3TickFrequency.allocate(4*m_frequencyScale.getTickList().count());
|
||||
m_q3TickPower.allocate(4*m_powerScale.getTickList().count());
|
||||
updateHistogramMarkers();
|
||||
updateWaterfallMarkers();
|
||||
} // applyChanges
|
||||
|
||||
// Histogram markers
|
||||
void GLSpectrum::updateHistogramMarkers()
|
||||
{
|
||||
for (int i = 0; i < m_histogramMarkers.size(); i++)
|
||||
{
|
||||
float powerI = m_linear ? m_histogramMarkers[i].m_power : CalcDb::dbPower(m_histogramMarkers[i].m_power);
|
||||
m_histogramMarkers[i].m_point.rx() =
|
||||
(m_histogramMarkers[i].m_frequency - m_frequencyScale.getRangeMin()) / m_frequencyScale.getRange();
|
||||
m_histogramMarkers[i].m_point.ry() =
|
||||
(m_powerScale.getRangeMax() - m_histogramMarkers[i].m_power) / m_powerScale.getRange();
|
||||
(m_powerScale.getRangeMax() - powerI) / m_powerScale.getRange();
|
||||
m_histogramMarkers[i].m_fftBin =
|
||||
(((m_histogramMarkers[i].m_frequency - m_centerFrequency) / (float) m_sampleRate) * m_fftSize) + (m_fftSize / 2);
|
||||
}
|
||||
m_histogramMarkers[i].m_frequencyStr = displayScaled(
|
||||
m_histogramMarkers[i].m_frequency,
|
||||
'f',
|
||||
getPrecision((m_centerFrequency*1000)/m_sampleRate),
|
||||
false);
|
||||
m_histogramMarkers[i].m_powerStr = displayScaledF(
|
||||
powerI,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false);
|
||||
|
||||
// Waterfall markers
|
||||
if (i > 0)
|
||||
{
|
||||
int64_t deltaFrequency = m_histogramMarkers.at(i).m_frequency - m_histogramMarkers.at(0).m_frequency;
|
||||
m_histogramMarkers.back().m_deltaFrequencyStr = displayScaled(
|
||||
deltaFrequency,
|
||||
'f',
|
||||
getPrecision(deltaFrequency/m_sampleRate),
|
||||
true);
|
||||
float power0 = m_linear ?
|
||||
m_histogramMarkers.at(0).m_power :
|
||||
CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||
float powerI = m_linear ?
|
||||
m_histogramMarkers.at(i).m_power :
|
||||
CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||
m_histogramMarkers.back().m_deltaPowerStr = displayScaledF(
|
||||
powerI - power0,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrum::updateWaterfallMarkers()
|
||||
{
|
||||
for (int i = 0; i < m_waterfallMarkers.size(); i++)
|
||||
{
|
||||
m_waterfallMarkers[i].m_point.rx() =
|
||||
(m_waterfallMarkers[i].m_frequency - m_frequencyScale.getRangeMin()) / m_frequencyScale.getRange();
|
||||
m_waterfallMarkers[i].m_point.ry() =
|
||||
(m_waterfallMarkers[i].m_time - m_timeScale.getRangeMin()) / m_timeScale.getRange();
|
||||
m_waterfallMarkers[i].m_frequencyStr = displayScaled(
|
||||
m_waterfallMarkers[i].m_frequency,
|
||||
'f',
|
||||
getPrecision((m_centerFrequency*1000)/m_sampleRate),
|
||||
false);
|
||||
m_waterfallMarkers[i].m_timeStr = displayScaledF(
|
||||
m_waterfallMarkers[i].m_time,
|
||||
'f',
|
||||
3,
|
||||
true);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
int64_t deltaFrequency = m_waterfallMarkers.at(i).m_frequency - m_waterfallMarkers.at(0).m_frequency;
|
||||
m_waterfallMarkers.back().m_deltaFrequencyStr = displayScaled(
|
||||
deltaFrequency,
|
||||
'f',
|
||||
getPrecision(deltaFrequency/m_sampleRate),
|
||||
true);
|
||||
m_waterfallMarkers.back().m_deltaTimeStr = displayScaledF(
|
||||
m_waterfallMarkers.at(i).m_time - m_waterfallMarkers.at(0).m_time,
|
||||
'f',
|
||||
3,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2171,12 +2260,13 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
pHis.rx() = (ep.x()/width() - m_histogramRect.left()) / m_histogramRect.width();
|
||||
pHis.ry() = (ep.y()/height() - m_histogramRect.top()) / m_histogramRect.height();
|
||||
float frequency = m_frequencyScale.getRangeMin() + pHis.x()*m_frequencyScale.getRange();
|
||||
float power = m_powerScale.getRangeMax() - pHis.y()*m_powerScale.getRange();
|
||||
float powerVal = m_powerScale.getRangeMax() - pHis.y()*m_powerScale.getRange();
|
||||
float power = m_linear ? powerVal : CalcDb::powerFromdB(powerVal);
|
||||
int fftBin = (((frequency - m_centerFrequency) / (float) m_sampleRate) * m_fftSize) + (m_fftSize / 2);
|
||||
|
||||
if ((pHis.x() >= 0) && (pHis.x() <= 1) && (pHis.y() >= 0) && (pHis.y() <= 1))
|
||||
{
|
||||
if (m_histogramMarkers.size() < 2)
|
||||
if (m_histogramMarkers.size() < SpectrumHistogramMarker::m_maxNbOfMarkers)
|
||||
{
|
||||
m_histogramMarkers.push_back(SpectrumHistogramMarker());
|
||||
m_histogramMarkers.back().m_point = pHis;
|
||||
@ -2189,7 +2279,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
false);
|
||||
m_histogramMarkers.back().m_power = power;
|
||||
m_histogramMarkers.back().m_powerStr = displayScaledF(
|
||||
power,
|
||||
powerVal,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false);
|
||||
@ -2202,8 +2292,11 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
'f',
|
||||
getPrecision(deltaFrequency/m_sampleRate),
|
||||
true);
|
||||
float power0 = m_linear ?
|
||||
m_histogramMarkers.at(0).m_power :
|
||||
CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||
m_histogramMarkers.back().m_deltaPowerStr = displayScaledF(
|
||||
power - m_histogramMarkers.at(0).m_power,
|
||||
power - power0,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false);
|
||||
@ -2221,7 +2314,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
|
||||
if ((pWat.x() >= 0) && (pWat.x() <= 1) && (pWat.y() >= 0) && (pWat.y() <= 1))
|
||||
{
|
||||
if (m_waterfallMarkers.size() < 2)
|
||||
if (m_waterfallMarkers.size() < SpectrumWaterfallMarker::m_maxNbOfMarkers)
|
||||
{
|
||||
m_waterfallMarkers.push_back(SpectrumWaterfallMarker());
|
||||
m_waterfallMarkers.back().m_point = pWat;
|
||||
|
@ -113,6 +113,8 @@ public:
|
||||
virtual ~GLSpectrum();
|
||||
|
||||
void setCenterFrequency(qint64 frequency);
|
||||
qint64 getCenterFrequency() const { return m_centerFrequency; }
|
||||
float getPowerMax() const;
|
||||
void setSampleRate(qint32 sampleRate);
|
||||
void setTimingRate(qint32 timingRate);
|
||||
void setFFTOverlap(int overlap);
|
||||
@ -151,6 +153,10 @@ public:
|
||||
m_displayStreamIndex = streamIndex;
|
||||
}
|
||||
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
|
||||
const QList<SpectrumHistogramMarker>& getHistogramMarkers() const { return m_histogramMarkers; }
|
||||
void setHistogramMarkers(const QList<SpectrumHistogramMarker>& histogramMarkers);
|
||||
const QList<SpectrumWaterfallMarker>& getWaterfallMarkers() const { return m_waterfallMarkers; }
|
||||
void setWaterfallMarkers(const QList<SpectrumWaterfallMarker>& waterfallMarkers);
|
||||
|
||||
private:
|
||||
struct ChannelMarkerState {
|
||||
@ -321,6 +327,8 @@ private:
|
||||
bool topHalf,
|
||||
const QRectF& glRect);
|
||||
void formatTextInfo(QString& info);
|
||||
void updateHistogramMarkers();
|
||||
void updateWaterfallMarkers();
|
||||
|
||||
private slots:
|
||||
void cleanup();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gui/glspectrum.h"
|
||||
#include "gui/crightclickenabler.h"
|
||||
#include "gui/wsspectrumsettingsdialog.h"
|
||||
#include "gui/spectrummarkersdialog.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "util/db.h"
|
||||
#include "ui_glspectrumgui.h"
|
||||
@ -331,6 +332,32 @@ void GLSpectrumGUI::on_wsSpectrum_toggled(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::on_markers_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
|
||||
if (!m_glSpectrum) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<SpectrumHistogramMarker> histogramMarkers = m_glSpectrum->getHistogramMarkers();
|
||||
QList<SpectrumWaterfallMarker> waterfallMarkers = m_glSpectrum->getWaterfallMarkers();
|
||||
SpectrumMarkersDialog markersDialog(histogramMarkers, waterfallMarkers, 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);
|
||||
}
|
||||
|
||||
if (markersDialog.waterfallMarkersChanged()) {
|
||||
m_glSpectrum->setWaterfallMarkers(waterfallMarkers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::on_refLevel_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_refLevel = value;
|
||||
|
@ -98,6 +98,7 @@ private slots:
|
||||
void on_averaging_currentIndexChanged(int index);
|
||||
void on_linscale_toggled(bool checked);
|
||||
void on_wsSpectrum_toggled(bool checked);
|
||||
void on_markers_clicked(bool checked);
|
||||
|
||||
void on_waterfall_toggled(bool checked);
|
||||
void on_histogram_toggled(bool checked);
|
||||
|
@ -553,6 +553,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="markers">
|
||||
<property name="toolTip">
|
||||
<string>Open spectrum markers dialog</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/gridpolar.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
|
@ -40,6 +40,7 @@ struct SpectrumHistogramMarker
|
||||
QString m_powerStr;
|
||||
QString m_deltaFrequencyStr;
|
||||
QString m_deltaPowerStr;
|
||||
static const int m_maxNbOfMarkers = 4;
|
||||
|
||||
SpectrumHistogramMarker() :
|
||||
m_point(0, 0),
|
||||
@ -88,6 +89,7 @@ struct SpectrumWaterfallMarker
|
||||
QString m_timeStr;
|
||||
QString m_deltaFrequencyStr;
|
||||
QString m_deltaTimeStr;
|
||||
static const int m_maxNbOfMarkers = 4;
|
||||
|
||||
SpectrumWaterfallMarker() :
|
||||
m_point(0, 0),
|
||||
|
148
sdrgui/gui/spectrummarkersdialog.cpp
Normal file
148
sdrgui/gui/spectrummarkersdialog.cpp
Normal file
@ -0,0 +1,148 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "util/db.h"
|
||||
#include "spectrummarkersdialog.h"
|
||||
|
||||
#include "ui_spectrummarkersdialog.h"
|
||||
|
||||
|
||||
SpectrumMarkersDialog::SpectrumMarkersDialog(
|
||||
QList<SpectrumHistogramMarker>& histogramMarkers,
|
||||
QList<SpectrumWaterfallMarker>& waterfallMarkers,
|
||||
QWidget* parent) :
|
||||
QDialog(parent),
|
||||
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)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->markerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->markerFrequency->setValueRange(false, 10, -9999999999L, 9999999999L);
|
||||
ui->marker->setMaximum(m_histogramMarkers.size() - 1);
|
||||
displayHistogramMarker();
|
||||
}
|
||||
|
||||
SpectrumMarkersDialog::~SpectrumMarkersDialog()
|
||||
{}
|
||||
|
||||
void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0)
|
||||
{
|
||||
ui->markerText->setText("-");
|
||||
ui->marker->setEnabled(false);
|
||||
ui->markerFrequency->setEnabled(false);
|
||||
ui->fixedPower->setEnabled(false);
|
||||
ui->fixedPower->setValue(0);
|
||||
ui->fixedPowerText->setText(tr("0.0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->marker->setEnabled(true);
|
||||
ui->markerFrequency->setEnabled(true);
|
||||
ui->markerText->setText(tr("%1").arg(m_histogramMarkerIndex));
|
||||
ui->markerFrequency->setValue(m_histogramMarkers[m_histogramMarkerIndex].m_frequency);
|
||||
float powerDB = CalcDb::dbPower(m_histogramMarkers[m_histogramMarkerIndex].m_power);
|
||||
ui->fixedPower->setEnabled(true);
|
||||
ui->fixedPower->setValue(powerDB*10);
|
||||
ui->fixedPowerText->setText(QString::number(powerDB, 'f', 1));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_frequency = value;
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_fixedPower_valueChanged(int value)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_marker_valueChanged(int value)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkerIndex = value;
|
||||
displayHistogramMarker();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerAdd_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
|
||||
if (m_histogramMarkers.size() == SpectrumHistogramMarker::m_maxNbOfMarkers) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers.append(SpectrumHistogramMarker());
|
||||
m_histogramMarkers.back().m_frequency = m_centerFrequency;
|
||||
m_histogramMarkers.back().m_power = m_power;
|
||||
m_histogramMarkerIndex = m_histogramMarkers.size() - 1;
|
||||
ui->marker->setMaximum(m_histogramMarkers.size() - 1);
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerDel_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers.removeAt(m_histogramMarkerIndex);
|
||||
m_histogramMarkerIndex = m_histogramMarkerIndex < m_histogramMarkers.size() ?
|
||||
m_histogramMarkerIndex : m_histogramMarkerIndex - 1;
|
||||
ui->marker->setMaximum(m_histogramMarkers.size() - 1);
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
69
sdrgui/gui/spectrummarkersdialog.h
Normal file
69
sdrgui/gui/spectrummarkersdialog.h
Normal file
@ -0,0 +1,69 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_SPECTRUMMARKERSDIALOG_H_
|
||||
#define SDRBASE_GUI_SPECTRUMMARKERSDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
|
||||
#include "gui/spectrummarkers.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace Ui {
|
||||
class SpectrumMarkersDialog;
|
||||
}
|
||||
|
||||
class SDRGUI_API SpectrumMarkersDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpectrumMarkersDialog(
|
||||
QList<SpectrumHistogramMarker>& histogramMarkers,
|
||||
QList<SpectrumWaterfallMarker>& waterfallMarkers,
|
||||
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; }
|
||||
|
||||
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;
|
||||
|
||||
void displayHistogramMarker();
|
||||
|
||||
private slots:
|
||||
void on_markerFrequency_changed(qint64 value);
|
||||
void on_fixedPower_valueChanged(int value);
|
||||
void on_marker_valueChanged(int value);
|
||||
void on_markerAdd_clicked(bool checked);
|
||||
void on_markerDel_clicked(bool checked);
|
||||
void accept();
|
||||
void reject();
|
||||
};
|
||||
|
||||
#endif // SDRBASE_GUI_SPECTRUMMARKERSDIALOG_H_
|
434
sdrgui/gui/spectrummarkersdialog.ui
Normal file
434
sdrgui/gui/spectrummarkersdialog.ui
Normal file
@ -0,0 +1,434 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpectrumMarkersDialog</class>
|
||||
<widget class="QDialog" name="SpectrumMarkersDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>125</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Spectrum Markers</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="MarkerLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="MarkerPosLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="markerFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>F</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDialZ" name="markerFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Transverter delta frequency (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="markerFrequencyUnits">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Marker frequency (Hz)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</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>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="OptionsLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="markerLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mk</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="markerText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>15</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="marker">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Marker index (0 is reference)</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="markerAddRemoveLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="markerAdd">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>190</red>
|
||||
<green>190</green>
|
||||
<blue>190</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add a new Y trace</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="markerDel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>190</red>
|
||||
<green>190</green>
|
||||
<blue>190</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove current Y trace</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>15</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>P</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="powerMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Man</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="fixedPower">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Fixed power (dB)</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1500</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1500</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fixedPowerText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-100.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SpectrumMarkersDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>257</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SpectrumMarkersDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>314</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user