From 1c9cc7a989a0ffa3a8d45f2c8bff146807525cea Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 20 Dec 2022 14:39:39 +0000 Subject: [PATCH] GLSpectrum touchscreen updates Add "show all controls" button, that allows most of the "set once" controls to be hidden on small screens. Please feel free to make a better icon! Could also be hidden if !ANDROID, if you don't like it. Add pinch and pan gestures, for frequency scrolling and zooming in to spectrum. Queue frequencies requested by scrolling, so intermediate frequencies can be omitted, if device is slow to update its frequency. Support non-integer pixel ratios. Add popup sliders for dials. Add DialogPositioner for dialogs. Add layout to spectrum markers dialog, so that it can be resized, to fit on smaller screens. --- sdrbase/dsp/spectrumsettings.cpp | 11 + sdrbase/dsp/spectrumsettings.h | 1 + sdrgui/gui/glshadercolormap.cpp | 4 + sdrgui/gui/glshaderspectrogram.cpp | 6 +- sdrgui/gui/glshadertextured.cpp | 8 + sdrgui/gui/glspectrumgui.cpp | 51 +- sdrgui/gui/glspectrumgui.h | 2 + sdrgui/gui/glspectrumgui.ui | 23 + sdrgui/gui/glspectrumview.cpp | 174 +- sdrgui/gui/glspectrumview.h | 13 +- sdrgui/gui/spectrummarkersdialog.ui | 3395 ++++++++++++++------------- 11 files changed, 1998 insertions(+), 1690 deletions(-) diff --git a/sdrbase/dsp/spectrumsettings.cpp b/sdrbase/dsp/spectrumsettings.cpp index 122981c8c..5ab12a246 100644 --- a/sdrbase/dsp/spectrumsettings.cpp +++ b/sdrbase/dsp/spectrumsettings.cpp @@ -80,6 +80,11 @@ void SpectrumSettings::resetToDefaults() m_measurementsPosition = PositionBelow; m_measurementPrecision = 1; m_findHistogramPeaks = false; +#ifdef ANDROID + m_showAllControls = false; +#else + m_showAllControls = true; +#endif } QByteArray SpectrumSettings::serialize() const @@ -132,6 +137,7 @@ QByteArray SpectrumSettings::serialize() const s.writeS32(46, m_measurementCenterFrequencyOffset); s.writeBool(47, m_findHistogramPeaks); s.writeBool(48, m_truncateFreqScale); + s.writeBool(49, m_showAllControls); s.writeS32(100, m_histogramMarkers.size()); for (int i = 0; i < m_histogramMarkers.size(); i++) { @@ -236,6 +242,11 @@ bool SpectrumSettings::deserialize(const QByteArray& data) d.readS32(46, &m_measurementCenterFrequencyOffset, 0); d.readBool(47, &m_findHistogramPeaks, false); d.readBool(48, &m_truncateFreqScale, false); +#ifdef ANDROID + d.readBool(49, &m_showAllControls, false); +#else + d.readBool(49, &m_showAllControls, true); +#endif int histogramMarkersSize; d.readS32(100, &histogramMarkersSize, 0); diff --git a/sdrbase/dsp/spectrumsettings.h b/sdrbase/dsp/spectrumsettings.h index 04d1fe328..d88607d74 100644 --- a/sdrbase/dsp/spectrumsettings.h +++ b/sdrbase/dsp/spectrumsettings.h @@ -138,6 +138,7 @@ public: bool m_measurementHighlight; MeasurementsPosition m_measurementsPosition; int m_measurementPrecision; + bool m_showAllControls; static const int m_log2FFTSizeMin = 6; // 64 static const int m_log2FFTSizeMax = 15; // 32k diff --git a/sdrgui/gui/glshadercolormap.cpp b/sdrgui/gui/glshadercolormap.cpp index f1d2bb464..6582884de 100644 --- a/sdrgui/gui/glshadercolormap.cpp +++ b/sdrgui/gui/glshadercolormap.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef ANDROID +#include +#endif + #include "gui/glshadercolormap.h" #include "util/colormap.h" diff --git a/sdrgui/gui/glshaderspectrogram.cpp b/sdrgui/gui/glshaderspectrogram.cpp index 10d3d0dc4..47f08f137 100644 --- a/sdrgui/gui/glshaderspectrogram.cpp +++ b/sdrgui/gui/glshaderspectrogram.cpp @@ -26,6 +26,10 @@ #include #include +#ifdef ANDROID +#include +#endif + #include "gui/glshaderspectrogram.h" #include "util/colormap.h" @@ -314,7 +318,7 @@ void GLShaderSpectrogram::initTextureMutable(const QImage& image) glGenTextures(1, &m_textureId); glBindTexture(GL_TEXTURE_2D, m_textureId); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, + glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, image.width(), image.height(), 0, GL_RED, GL_UNSIGNED_BYTE, image.constScanLine(0)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/sdrgui/gui/glshadertextured.cpp b/sdrgui/gui/glshadertextured.cpp index 07fc43a8c..4105672f6 100644 --- a/sdrgui/gui/glshadertextured.cpp +++ b/sdrgui/gui/glshadertextured.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef ANDROID +#include +#endif + #include "gui/glshadertextured.h" GLShaderTextured::GLShaderTextured() : @@ -296,7 +300,11 @@ bool GLShaderTextured::useImmutableStorage() GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); +#ifdef ANDROID + glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1); +#else glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 1, 1); +#endif glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); GLenum err = glGetError(); glDeleteTextures(1, &textureId); diff --git a/sdrgui/gui/glspectrumgui.cpp b/sdrgui/gui/glspectrumgui.cpp index 4b655bfd9..f2a5923b4 100644 --- a/sdrgui/gui/glspectrumgui.cpp +++ b/sdrgui/gui/glspectrumgui.cpp @@ -37,6 +37,8 @@ #include "gui/spectrummeasurementsdialog.h" #include "gui/spectrummeasurements.h" #include "gui/flowlayout.h" +#include "gui/dialogpositioner.h" +#include "gui/dialpopup.h" #include "util/colormap.h" #include "util/simpleserializer.h" #include "util/db.h" @@ -94,6 +96,8 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) : CRightClickEnabler *calibrationPointsRightClickEnabler = new CRightClickEnabler(ui->calibration); connect(calibrationPointsRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openCalibrationPointsDialog(const QPoint &))); + DialPopup::addPopupsToChildDials(this); + displaySettings(); setAveragingCombo(); applySettings(); @@ -168,6 +172,7 @@ void GLSpectrumGUI::updateSettings() void GLSpectrumGUI::displaySettings() { blockApplySettings(true); + ui->showAllControls->setChecked(m_settings.m_showAllControls); ui->refLevel->setValue(m_settings.m_refLevel + m_calibrationShiftdB); ui->levelRange->setValue(m_settings.m_powerRange); ui->decay->setSliderPosition(m_settings.m_decay); @@ -176,7 +181,7 @@ void GLSpectrumGUI::displaySettings() ui->waterfall->setChecked(m_settings.m_displayWaterfall); ui->spectrogram->setChecked(m_settings.m_display3DSpectrogram); ui->spectrogramStyle->setCurrentIndex((int) m_settings.m_3DSpectrogramStyle); - ui->spectrogramStyle->setVisible(m_settings.m_display3DSpectrogram); + ui->spectrogramStyle->setVisible(m_settings.m_display3DSpectrogram && m_settings.m_showAllControls); ui->colorMap->setCurrentText(m_settings.m_colorMap); ui->currentLine->blockSignals(true); ui->currentFill->blockSignals(true); @@ -236,6 +241,7 @@ void GLSpectrumGUI::displaySettings() setAveragingToolitp(); ui->calibration->setChecked(m_settings.m_useCalibration); displayGotoMarkers(); + displayControls(); ui->fftWindow->blockSignals(false); ui->averaging->blockSignals(false); @@ -246,6 +252,37 @@ void GLSpectrumGUI::displaySettings() updateMeasurements(); } +void GLSpectrumGUI::displayControls() +{ + ui->grid->setVisible(m_settings.m_showAllControls); + ui->gridIntensity->setVisible(m_settings.m_showAllControls); + ui->truncateScale->setVisible(m_settings.m_showAllControls); + ui->clearSpectrum->setVisible(m_settings.m_showAllControls); + ui->histogram->setVisible(m_settings.m_showAllControls); + ui->maxHold->setVisible(m_settings.m_showAllControls); + ui->decay->setVisible(m_settings.m_showAllControls); + ui->decayDivisor->setVisible(m_settings.m_showAllControls); + ui->stroke->setVisible(m_settings.m_showAllControls); + ui->currentLine->setVisible(m_settings.m_showAllControls); + ui->currentFill->setVisible(m_settings.m_showAllControls); + ui->currentGradient->setVisible(m_settings.m_showAllControls); + ui->traceIntensity->setVisible(m_settings.m_showAllControls); + ui->colorMap->setVisible(m_settings.m_showAllControls); + ui->invertWaterfall->setVisible(m_settings.m_showAllControls); + ui->waterfall->setVisible(m_settings.m_showAllControls); + ui->spectrogram->setVisible(m_settings.m_showAllControls); + ui->spectrogramStyle->setVisible(m_settings.m_showAllControls); + ui->fftWindow->setVisible(m_settings.m_showAllControls); + ui->fftSize->setVisible(m_settings.m_showAllControls); + ui->fftOverlap->setVisible(m_settings.m_showAllControls); + ui->fps->setVisible(m_settings.m_showAllControls); + ui->linscale->setVisible(m_settings.m_showAllControls); + ui->save->setVisible(m_settings.m_showAllControls); + ui->wsSpectrum->setVisible(m_settings.m_showAllControls); + ui->calibration->setVisible(m_settings.m_showAllControls); + ui->markers->setVisible(m_settings.m_showAllControls); +} + void GLSpectrumGUI::displayGotoMarkers() { ui->gotoMarker->clear(); @@ -484,6 +521,7 @@ void GLSpectrumGUI::on_markers_clicked(bool checked) QRect mouseScreenGeometry = screen->geometry(); QPoint localCursorPos = globalCursorPos - mouseScreenGeometry.topLeft(); m_markersDialog->move(localCursorPos); + new DialogPositioner(m_markersDialog, false); m_markersDialog->show(); } @@ -616,7 +654,7 @@ void GLSpectrumGUI::on_spectrogram_toggled(bool checked) ui->waterfall->setChecked(false); blockApplySettings(false); } - ui->spectrogramStyle->setVisible(m_settings.m_display3DSpectrogram); + ui->spectrogramStyle->setVisible(m_settings.m_display3DSpectrogram && m_settings.m_showAllControls); applySettings(); } @@ -677,6 +715,13 @@ void GLSpectrumGUI::on_invertWaterfall_toggled(bool checked) applySettings(); } +void GLSpectrumGUI::on_showAllControls_toggled(bool checked) +{ + m_settings.m_showAllControls = checked; + displayControls(); + applySettings(); +} + void GLSpectrumGUI::on_grid_toggled(bool checked) { m_settings.m_displayGrid = checked; @@ -987,6 +1032,7 @@ void GLSpectrumGUI::openWebsocketSpectrumSettingsDialog(const QPoint& p) dialog.setPort(m_settings.m_wsSpectrumPort); dialog.move(p); + new DialogPositioner(&dialog, false); dialog.exec(); if (dialog.hasChanged()) @@ -1010,6 +1056,7 @@ void GLSpectrumGUI::openCalibrationPointsDialog(const QPoint& p) dialog.setCenterFrequency(m_glSpectrum->getCenterFrequency()); connect(&dialog, SIGNAL(updateCalibrationPoints()), this, SLOT(updateCalibrationPoints())); dialog.move(p); + new DialogPositioner(&dialog, false); dialog.exec(); m_settings.m_histogramMarkers = m_glSpectrum->getHistogramMarkers(); diff --git a/sdrgui/gui/glspectrumgui.h b/sdrgui/gui/glspectrumgui.h index 3d3f47c8e..ac55d0ebc 100644 --- a/sdrgui/gui/glspectrumgui.h +++ b/sdrgui/gui/glspectrumgui.h @@ -79,6 +79,7 @@ private: void applySettings(); void applySpectrumSettings(); void displaySettings(); + void displayControls(); void setAveragingCombo(); void setNumberStr(int n, QString& s); void setNumberStr(float v, int decimalPlaces, QString& s); @@ -125,6 +126,7 @@ private slots: void on_freeze_toggled(bool checked); void on_calibration_toggled(bool checked); void on_gotoMarker_currentIndexChanged(int index); + void on_showAllControls_toggled(bool checked); void on_measure_clicked(bool checked); diff --git a/sdrgui/gui/glspectrumgui.ui b/sdrgui/gui/glspectrumgui.ui index cc9ef8907..c389f5020 100644 --- a/sdrgui/gui/glspectrumgui.ui +++ b/sdrgui/gui/glspectrumgui.ui @@ -1130,6 +1130,29 @@ + + + + Toggle all controls + + + Grid + + + + :/listing.png:/listing.png + + + + 16 + 16 + + + + true + + + diff --git a/sdrgui/gui/glspectrumview.cpp b/sdrgui/gui/glspectrumview.cpp index 5532a3a28..7e9bd092b 100644 --- a/sdrgui/gui/glspectrumview.cpp +++ b/sdrgui/gui/glspectrumview.cpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include "maincore.h" #include "dsp/spectrumvis.h" #include "gui/glspectrumview.h" @@ -98,6 +101,10 @@ GLSpectrumView::GLSpectrumView(QWidget* parent) : m_colorMapName("Angel"), m_scrollFrequency(false), m_scrollStartCenterFreq(0), + m_pinching(false), + m_pinching3D(false), + m_frequencyRequested(false), + m_nextFrequencyValid(false), m_histogramBuffer(nullptr), m_histogram(nullptr), m_displayHistogram(true), @@ -223,6 +230,8 @@ GLSpectrumView::GLSpectrumView(QWidget* parent) : // Handle KeyEvents setFocusPolicy(Qt::StrongFocus); installEventFilter(this); + + grabGesture(Qt::PinchGesture); } GLSpectrumView::~GLSpectrumView() @@ -260,11 +269,37 @@ GLSpectrumView::~GLSpectrumView() } } +void GLSpectrumView::queueRequestCenterFrequency(qint64 frequency) +{ + if (!m_frequencyRequested) + { + m_frequencyRequested = true; + m_requestedFrequency = frequency; + emit requestCenterFrequency(frequency); + } + else + { + m_nextFrequencyValid = true; + m_nextFrequency = frequency; + } +} + void GLSpectrumView::setCenterFrequency(qint64 frequency) { m_mutex.lock(); m_centerFrequency = frequency; + // Handle queued frequency requests + if (m_frequencyRequested && (frequency == m_requestedFrequency)) + { + m_frequencyRequested = false; + if (m_nextFrequencyValid) + { + m_nextFrequencyValid = false; + queueRequestCenterFrequency(m_nextFrequency); + } + } + if (m_useCalibration) { updateCalibrationPoints(); } @@ -944,7 +979,7 @@ void GLSpectrumView::paintGL() glFunctions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QMatrix4x4 spectrogramGridMatrix; - int devicePixelRatio; + float devicePixelRatio; if (m_display3DSpectrogram) { @@ -972,7 +1007,7 @@ void GLSpectrumView::paintGL() if (window()->windowHandle()) { devicePixelRatio = window()->windowHandle()->devicePixelRatio(); } else { - devicePixelRatio = 1; + devicePixelRatio = 1.0f; } glFunctions->glViewport(0, m_3DSpectrogramBottom*devicePixelRatio, width()*devicePixelRatio, m_waterfallHeight*devicePixelRatio); m_glShaderSpectrogram.drawSurface(m_3DSpectrogramStyle, spectrogramGridMatrix, prop_y, m_invertedWaterfall); @@ -3676,9 +3711,81 @@ void GLSpectrumView::updateCalibrationPoints() m_changesPending = true; } +bool GLSpectrumView::event(QEvent* event) +{ + if (event->type() == QEvent::Gesture) + { + QGestureEvent *gestureEvent = static_cast(event); + + if (QPanGesture *pan = static_cast(gestureEvent->gesture(Qt::PanGesture))) + { + if (pan->state() == Qt::GestureStarted) + { + m_scrollStartCenterFreq = m_centerFrequency; + } + else if (pan->state() == Qt::GestureUpdated) + { + QPointF offset = pan->offset(); + float histogramWidth = width() - m_leftMargin - m_rightMargin; + qint64 frequency = (qint64)(m_scrollStartCenterFreq + -offset.x()/histogramWidth * m_frequencyScale.getRange()); + queueRequestCenterFrequency(frequency); + } + return true; + } + else if (QPinchGesture *pinch = static_cast(gestureEvent->gesture(Qt::PinchGesture))) + { + // Don't get GestureStarted and startCenterPoint is always 0,0 + // https://bugreports.qt.io/browse/QTBUG-109205 + if (!m_pinching) + { + m_scrollStartCenterFreq = m_centerFrequency; + m_pinchStart = pinch->centerPoint(); + m_pinching = true; + m_pinching3D = m_display3DSpectrogram && pointInWaterfallOrSpectrogram(mapFromGlobal(m_pinchStart.toPoint())); + } + else + { + if (pinch->changeFlags() & QPinchGesture::CenterPointChanged) + { + if (!m_pinching3D) + { + // Scroll frequency up or down + QPointF offset = pinch->centerPoint() - m_pinchStart; + float histogramWidth = width() - m_leftMargin - m_rightMargin; + qint64 frequency = (qint64)(m_scrollStartCenterFreq + -offset.x()/histogramWidth * m_frequencyScale.getRange()); + queueRequestCenterFrequency(frequency); + } + } + if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged) + { + if (!m_pinching3D) + { + // Zoom in/out of spectrum + QPoint p = mapFromGlobal(pinch->centerPoint().toPoint()); + zoomFactor(p, pinch->scaleFactor()); + } + else + { + // Scale Z axis of 3D spectragram + m_glShaderSpectrogram.userScaleZ(pinch->scaleFactor()); + } + } + if (pinch->state() == Qt::GestureFinished) + { + m_pinching = false; + m_pinching3D = false; + } + } + return true; + } + } + + return QOpenGLWidget::event(event); +} + void GLSpectrumView::mouseMoveEvent(QMouseEvent* event) { - if (m_rotate3DSpectrogram) + if (m_rotate3DSpectrogram && !m_pinching3D) { // Rotate 3D Spectrogram QPointF delta = m_mousePrevLocalPos - event->localPos(); @@ -3718,7 +3825,7 @@ void GLSpectrumView::mouseMoveEvent(QMouseEvent* event) QPointF delta = m_mousePrevLocalPos - event->localPos(); float histogramWidth = width() - m_leftMargin - m_rightMargin; qint64 frequency = (qint64)(m_scrollStartCenterFreq + delta.x()/histogramWidth * m_frequencyScale.getRange()); - emit requestCenterFrequency(frequency); + queueRequestCenterFrequency(frequency); return; } @@ -3775,13 +3882,14 @@ void GLSpectrumView::mouseMoveEvent(QMouseEvent* event) { // Determine if user is trying to move the channel outside of the current frequency range // and if so, request an adjustment to the center frequency + // FIXME: This doesn't take zoom into account, so only works when zoomed out Real freqAbs = m_frequencyScale.getValueFromPos(event->x() - m_leftMarginPixmap.width() - 1); Real freqMin = m_centerFrequency - m_sampleRate / 2.0f; Real freqMax = m_centerFrequency + m_sampleRate / 2.0f; if (freqAbs < freqMin) { - emit requestCenterFrequency(m_centerFrequency - (freqMin - freqAbs)); + queueRequestCenterFrequency(m_centerFrequency - (freqMin - freqAbs)); } else if (freqAbs > freqMax) { - emit requestCenterFrequency(m_centerFrequency + (freqAbs - freqMax)); + queueRequestCenterFrequency(m_centerFrequency + (freqAbs - freqMax)); } Real freq = freqAbs - m_centerFrequency; @@ -4174,14 +4282,8 @@ void GLSpectrumView::wheelEvent(QWheelEvent *event) } } -void GLSpectrumView::zoom(QWheelEvent *event) +void GLSpectrumView::zoomFactor(const QPointF& p, float factor) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - const QPointF& p = event->position(); -#else - const QPointF& p = event->pos(); -#endif - float pwx = (p.x() - m_leftMargin) / (width() - m_leftMargin - m_rightMargin); // x position in window if ((pwx >= 0.0f) && (pwx <= 1.0f)) @@ -4200,7 +4302,45 @@ void GLSpectrumView::zoom(QWheelEvent *event) // Calculate what that difference would be if there was no zoom float freqDiffZoom1 = freqDiff * m_frequencyZoomFactor; - if (event->angleDelta().y() > 0) // zoom in + m_frequencyZoomFactor *= factor; + m_frequencyZoomFactor = std::min(m_frequencyZoomFactor, m_maxFrequencyZoom); + m_frequencyZoomFactor = std::max(m_frequencyZoomFactor, 1.0f); + + // Calculate what frequency difference should be at new zoom + float zoomedFreqDiff = freqDiffZoom1 / m_frequencyZoomFactor; + // Then calculate what the center frequency should be + float zoomedCF = zoomFreq + zoomedFreqDiff; + + // Calculate zoom position which will set the desired center frequency + float zoomPos = (zoomedCF - m_centerFrequency) / m_sampleRate + 0.5; + zoomPos = std::max(0.0f, zoomPos); + zoomPos = std::min(1.0f, zoomPos); + + frequencyZoom(zoomPos); + } + } + +void GLSpectrumView::zoom(const QPointF& p, int y) +{ + float pwx = (p.x() - m_leftMargin) / (width() - m_leftMargin - m_rightMargin); // x position in window + + if ((pwx >= 0.0f) && (pwx <= 1.0f)) + { + // When we zoom, we want the frequency under the cursor to remain the same + + // Determine frequency at cursor position + float zoomFreq = m_frequencyScale.getRangeMin() + pwx*m_frequencyScale.getRange(); + + // Calculate current centre frequency + float currentCF = (m_frequencyZoomFactor == 1) ? m_centerFrequency : ((m_frequencyZoomPos - 0.5) * m_sampleRate + m_centerFrequency); + + // Calculate difference from frequency under cursor to centre frequency + float freqDiff = (currentCF - zoomFreq); + + // Calculate what that difference would be if there was no zoom + float freqDiffZoom1 = freqDiff * m_frequencyZoomFactor; + + if (y > 0) // zoom in { if (m_frequencyZoomFactor < m_maxFrequencyZoom) { m_frequencyZoomFactor += 0.5f; @@ -4247,11 +4387,11 @@ void GLSpectrumView::zoom(QWheelEvent *event) //qDebug("GLSpectrumView::zoom: pwyh: %f pwyw: %f", pwyh, pwyw); if ((pwyw >= 0.0f) && (pwyw <= 1.0f)) { - timeZoom(event->angleDelta().y() > 0); + timeZoom(y > 0); } if ((pwyh >= 0.0f) && (pwyh <= 1.0f) && !m_linear) { - powerZoom(pwyh, event->angleDelta().y() > 0); + powerZoom(pwyh, y > 0); } } } @@ -4427,7 +4567,7 @@ void GLSpectrumView::channelMarkerMove(QWheelEvent *event, int mul) } } - zoom(event); + zoom(event->position(), event->angleDelta().y()); } // Return if specified point is within the bounds of the waterfall / 3D spectrogram screen area diff --git a/sdrgui/gui/glspectrumview.h b/sdrgui/gui/glspectrumview.h index 74101b6a9..77bf8565c 100644 --- a/sdrgui/gui/glspectrumview.h +++ b/sdrgui/gui/glspectrumview.h @@ -358,6 +358,14 @@ private: bool m_scrollFrequency; qint64 m_scrollStartCenterFreq; + bool m_pinching; + bool m_pinching3D; + QPointF m_pinchStart; + + bool m_frequencyRequested; //!< Set when we have emitted requestCenterFrequency + qint64 m_requestedFrequency; + qint64 m_nextFrequency; //!< Next frequency to request when previous request completes + qint64 m_nextFrequencyValid; QRgb m_histogramPalette[240]; QImage* m_histogramBuffer; @@ -448,12 +456,14 @@ private: void stopDrag(); void applyChanges(); + bool event(QEvent* event); void mouseMoveEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); void wheelEvent(QWheelEvent*); void channelMarkerMove(QWheelEvent*, int mul); - void zoom(QWheelEvent*); + void zoomFactor(const QPointF& p, float factor); + void zoom(const QPointF& p, int y); void frequencyZoom(float pw); void frequencyPan(QMouseEvent*); void timeZoom(bool zoomInElseOut); @@ -494,6 +504,7 @@ private: const QRectF& glRect); void formatTextInfo(QString& info); void updateSortedAnnotationMarkers(); + void queueRequestCenterFrequency(qint64 frequency); static bool annotationDisplayLessThan(const SpectrumAnnotationMarker *m1, const SpectrumAnnotationMarker *m2) { diff --git a/sdrgui/gui/spectrummarkersdialog.ui b/sdrgui/gui/spectrummarkersdialog.ui index f8b2cd874..e3dfb1ed8 100644 --- a/sdrgui/gui/spectrummarkersdialog.ui +++ b/sdrgui/gui/spectrummarkersdialog.ui @@ -7,13 +7,13 @@ 0 0 480 - 300 + 250 - 480 - 300 + 410 + 250 @@ -38,490 +38,511 @@ Histogram (spectrum line) markers - - - - 0 - 10 - 391 - 74 - + + + 3 - - - 2 - - - - - - - F - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - DejaVu Sans Mono - 12 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - Set marker as reference (index 0) - - - C - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - Current marker color (click to change) - - - - - - - - - - Show this marker - - - - - - true - - - - - - - - - - - - 24 - 0 - - - - Mk - - - - - - - - 15 - 0 - - - - 0 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 24 - 24 - - - - Marker index (0 is reference) - - - 0 - - - 1 - - - - - - - - 24 - 24 - - - - Set marker as reference (index 0) - - - 0 - - - - - - - 0 - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Add a new marker - - - + - - - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Remove current marker - - - - - - - - - - - - - - 15 - 0 - - - - P - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 24 - 24 - - - - Reset power max hold - - - R - - - - - - - - 60 - 16777215 - - - - Man - Set marker power to fixed level + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + F + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + Set marker as reference (index 0) + + + C + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + Current marker color (click to change) + + + + + + + + + + Show this marker + + + + + + true + + + + + + + + + + + + 24 + 0 + + + + Mk + + + + + + + + 15 + 0 + + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 24 + 24 + + + + Marker index (0 is reference) + + + 0 + + + 1 + + + + + + + + 24 + 24 + + + + Set marker as reference (index 0) + + + 0 + + + + + + + 0 + + + + + + 18 + 18 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + Liberation Sans + 10 + + + + Add a new marker + + + + + + + + + + + + 18 + 18 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + Liberation Sans + 10 + + + + Remove current marker + + + - + + + + + + + + + + 15 + 0 + + + + P + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 24 + 24 + + + + Reset power max hold + + + R + + + + + + + + 50 + 0 + + + + + 60 + 16777215 + + + + Man - Set marker power to fixed level Cur - Marker will move according to current power at the marker frequency Max - Marker will move according to the maximum power at the marker frequency - - - - Man - - - - - Cur - - - - - Max - - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - DejaVu Sans Mono - 12 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Fixed power (dB) - - - - - - - - 32 - 0 - - + + - dB - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - Put markers in find peaks mode + Man + + - + Cur - - - :/dsb.png:/dsb.png + + + + Max - - - - - - + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Fixed power (dB) + + + + + + + + 32 + 0 + + + + dB + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + Put markers in find peaks mode + + + + + + + :/dsb.png:/dsb.png + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -530,517 +551,532 @@ Max - Marker will move according to the maximum power at the marker frequency Waterfall markers - - - - 0 - 10 - 391 - 93 - + + + 3 - - - 2 - - - - - - - F - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - DejaVu Sans Mono - 12 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - Set marker as reference (index 0) - - - C - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - Current marker color (click to change) - - - - - - - - - - Show this marker - - - - - - true - - - - - - - - - - - - 24 - 0 - - - - Mk - - - - - - - - 15 - 0 - - - - 0 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 24 - 24 - - - - Marker index (0 is reference) - - - 0 - - - 1 - - - - - - - - 24 - 24 - - - - Set marker as reference (index 0) - - - 0 - - - - - - - 0 - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Add a new marker - - - + - - - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Remove current marker - - - - - - - - - - - - - - 20 - 0 - - - - t(s) - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - 2 - - - - - - - - 36 - 0 - - - - Time mantissa - - - 0.000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 14 - - - - Time mantissa (fine) - - - 0 - - - 1000 - - - 1 - - - Qt::Horizontal - - - - - - - - 24 - 24 - - - - Time mantissa (coarse) - - - 0 - - - 9 - - - 1 - - - 0 - - - - - - - - - 6 - - - 6 - - - 6 - - - 6 - - - - - - 36 - 0 - - - - Time exponent - - - e+0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 14 - - - - Time exponent - - - -10 - - - 10 - - - 1 - - - Qt::Horizontal - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + F + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + Set marker as reference (index 0) + + + C + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + Current marker color (click to change) + + + + + + + + + + Show this marker + + + + + + true + + + + + + + + + + + + 24 + 0 + + + + Mk + + + + + + + + 15 + 0 + + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 24 + 24 + + + + Marker index (0 is reference) + + + 0 + + + 1 + + + + + + + + 24 + 24 + + + + Set marker as reference (index 0) + + + 0 + + + + + + + 0 + + + + + + 18 + 18 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + Liberation Sans + 10 + + + + Add a new marker + + + + + + + + + + + + 18 + 18 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + Liberation Sans + 10 + + + + Remove current marker + + + - + + + + + + + + + + 20 + 0 + + + + t(s) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 2 + + + + + + + + 36 + 0 + + + + Time mantissa + + + 0.000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 14 + + + + Time mantissa (fine) + + + 0 + + + 1000 + + + 1 + + + Qt::Horizontal + + + + + + + + 24 + 24 + + + + Time mantissa (coarse) + + + 0 + + + 9 + + + 1 + + + 0 + + + + + + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + 36 + 0 + + + + Time exponent + + + e+0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 14 + + + + Time exponent + + + -10 + + + 10 + + + 1 + + + Qt::Horizontal + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -1049,690 +1085,711 @@ Max - Marker will move according to the maximum power at the marker frequency Annotation markers - - - - 0 - 0 - 451 - 151 - + + + 3 - - - 2 - - - - - - - - 24 - 0 - - - - Mk - - - - - - - - 30 - 0 - - - - Marker index - - - 0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 24 - 24 - - - - Marker index selection - - - 0 - - - 1 - - - - - - - 0 - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Add a new marker - - - + - - - - - - - - 18 - 18 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - - - 190 - 190 - 190 - - - - - - - - - Liberation Sans - 10 - - - - Remove current marker - - - - - - - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - Current marker color (click to change) - - - - - - - - - - Marker text - - - 36 - - - - - - - Export annotation marks to .csv file - - - - - - - :/export.png:/export.png - - - - - - - Import annotation marks from .csv file - - - - - - - :/import.png:/import.png - - - - - - - - - - - Start - - - true - - - false - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - DejaVu Sans Mono - 12 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker start frequency (Hz) - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - - 24 - 24 - - - - Set marker frequency to center frequency - - - C - - - - - - - - 24 - 24 - - - - Duplicate current marker - - - - - - - :/duplicate.png:/duplicate.png - - - - - - - - 24 - 24 - - - - Sort markers by increasing start frequency - - - - - - - :/sort.png:/sort.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 30 - 0 - - - - Cent - - - - - - - - 140 - 0 - - - - - DejaVu Sans Mono - 12 - - - - Marker stop frequency (Hz) - - - 0,000,000,000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 30 - 0 - - - - Stop - - - - - - - - 140 - 0 - - - - - DejaVu Sans Mono - 12 - - - - Marker stop frequency (Hz) - - - 0,000,000,000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - - - - - - 15 - 0 - - - - BW - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - DejaVu Sans Mono - 12 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker width (Hz) - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - PointingHandCursor - - - Qt::StrongFocus - - - Marker frequency (Hz) - - - Hz - - - - - - - Marker show state - - - - Hidden + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + + 24 + 0 + + + + Mk + + + + + + + + 30 + 0 + + + + Marker index + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 24 + 24 + + + + Marker index selection + + + 0 + + + 1 + + + + + + + 0 + + + + + + 18 + 18 + - - - - Top + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + - - - - Full + + + Liberation Sans + 10 + - - - - Text + + Add a new marker - - - - - - - - 30 - 16777215 - - - - Apply current show state to all markers - + + + + + + + + + + + 18 + 18 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + Liberation Sans + 10 + + + + Remove current marker + + + - + + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + Current marker color (click to change) + + + + + + + + + + Marker text + + + 36 + + + + + + + Export annotation marks to .csv file + + + + + + + :/export.png:/export.png + + + + + + + Import annotation marks from .csv file + + + + + + + :/import.png:/import.png + + + + + + + + + + + Start + + + true + + + false + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker start frequency (Hz) + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + + 24 + 24 + + + + Set marker frequency to center frequency + + + C + + + + + + + + 24 + 24 + + + + Duplicate current marker + + + + + + + :/duplicate.png:/duplicate.png + + + + + + + + 24 + 24 + + + + Sort markers by increasing start frequency + + + + + + + :/sort.png:/sort.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 30 + 0 + + + + Cent + + + + + + + + 100 + 0 + + + + + DejaVu Sans Mono + 12 + + + + Marker stop frequency (Hz) + + + 0,000,000,000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 30 + 0 + + + + Stop + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + DejaVu Sans Mono + 12 + + + + Marker stop frequency (Hz) + + + 0,000,000,000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + + + + + + 15 + 0 + + + + BW + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker width (Hz) + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Marker frequency (Hz) + + + Hz + + + + + + + Marker show state + + - All + Hidden - - - - - - Qt::Horizontal + + + + Top - - - 40 - 20 - + + + + Full - - - - - - + + + + Text + + + + + + + + + 30 + 16777215 + + + + Apply current show state to all markers + + + All + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -1808,6 +1865,11 @@ All - Show all markers + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
ValueDialZ QWidget @@ -1819,11 +1881,6 @@ All - Show all markers QLabel
gui/clickablelabel.h
- - ButtonSwitch - QToolButton -
gui/buttonswitch.h
-
buttonBox