diff options
Diffstat (limited to 'gr-qtgui/lib')
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.cc | 29 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.h | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 55 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.h | 16 | ||||
-rw-r--r-- | gr-qtgui/lib/Makefile.am | 25 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc | 18 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.h | 10 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.cc | 24 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.h | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.h | 3 |
10 files changed, 150 insertions, 46 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 71933cece..75dbe9c37 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -5,7 +5,7 @@ #include <qwt_scale_draw.h> #include <qwt_legend.h> - +#include <iostream> class ConstellationDisplayZoomer: public QwtPlotZoomer { @@ -75,15 +75,11 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) memset(_imagDataPoints, 0x0, _numPoints*sizeof(double)); _zoomer = new ConstellationDisplayZoomer(canvas()); -#if QT_VERSION < 0x040000 - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); -#else + _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); -#endif + Qt::RightButton, Qt::ControlModifier); _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + Qt::RightButton); _panner = new QwtPlotPanner(canvas()); _panner->setAxisEnabled(QwtPlot::yRight, false); @@ -100,8 +96,13 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) _zoomer->setRubberBandPen(c); _zoomer->setTrackerPen(c); - connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ), - this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) )); + // emit the position of clicks on widget + _picker = new QwtDblClickPlotPicker(canvas()); + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + + connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ), + this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) )); } ConstellationDisplayPlot::~ConstellationDisplayPlot() @@ -186,4 +187,12 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) plotItem->setVisible(!on); } +void +ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + emit plotPointSelected(point); +} + #endif /* CONSTELLATION_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index a441a8bfe..bf4531e0a 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/lib/ConstellationDisplayPlot.h @@ -13,6 +13,7 @@ #include <qwt_plot_marker.h> #include <highResTimeFunctions.h> #include <qwt_symbol.h> +#include <qtgui_util.h> class ConstellationDisplayPlot : public QwtPlot { @@ -38,6 +39,11 @@ public: public slots: void resizeSlot( QSize *s ); + void OnPickerPointSelected(const QwtDoublePoint & p); + +signals: + void plotPointSelected(const QPointF p); + protected slots: void LegendEntryChecked(QwtPlotItem *plotItem, bool on); @@ -49,6 +55,8 @@ private: QwtPlotPanner* _panner; QwtPlotZoomer* _zoomer; + QwtDblClickPlotPicker *_picker; + double* _realDataPoints; double* _imagDataPoints; diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 45e2e6c16..30b318184 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -148,7 +148,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); _max_fft_plot_curve->setVisible(false); - _lower_intensity_marker = new QwtPlotMarker(); + _lower_intensity_marker= new QwtPlotMarker(); _lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); _lower_intensity_marker->setLinePen(QPen(Qt::cyan)); _lower_intensity_marker->attach(this); @@ -183,6 +183,12 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _markerNoiseFloorAmplitude->setLinePen(QPen(Qt::darkRed, 0, Qt::DotLine)); _markerNoiseFloorAmplitude->attach(this); + _markerCF= new QwtPlotMarker(); + _markerCF->setLineStyle(QwtPlotMarker::VLine); + _markerCF->setLinePen(QPen(Qt::lightGray, 0, Qt::DotLine)); + _markerCF->attach(this); + _markerCF->hide(); + _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; @@ -190,14 +196,19 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) replot(); + // emit the position of clicks on widget + _picker = new QwtDblClickPlotPicker(canvas()); + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + + // Configure magnify on mouse wheel + _magnifier = new QwtPlotMagnifier(canvas()); + _magnifier->setAxisEnabled(QwtPlot::xBottom, false); + _zoomer = new FreqDisplayZoomer(canvas(), 0); -#if QT_VERSION < 0x040000 + _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); -#else - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); -#endif _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton); @@ -256,6 +267,7 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, double stopFreq = constStopFreq / units; double centerFreq = constCenterFreq / units; + _xAxisMultiplier = units; _useCenterFrequencyFlag = useCenterFrequencyFlag; if(_useCenterFrequencyFlag){ @@ -433,5 +445,36 @@ FrequencyDisplayPlot::SetUpperIntensityLevel(const double upperIntensityLevel) _upper_intensity_marker->setYValue( upperIntensityLevel ); } +void +FrequencyDisplayPlot::SetTraceColour (QColor c) +{ + _fft_plot_curve->setPen(QPen(c)); +} + +void +FrequencyDisplayPlot::SetBGColour (QColor c) +{ + QPalette palette; + palette.setColor(canvas()->backgroundRole(), c); + canvas()->setPalette(palette); +} + +void +FrequencyDisplayPlot::ShowCFMarker (const bool show) +{ + if (show) + _markerCF->show(); + else + _markerCF->hide(); +} + +void +FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + point.setX(point.x() * _xAxisMultiplier); + emit plotPointSelected(point); +} #endif /* FREQUENCY_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index 3c22c1397..7a207ab8d 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h @@ -12,8 +12,10 @@ #include <qwt_plot_zoomer.h> #include <qwt_plot_panner.h> #include <qwt_plot_marker.h> +#include <qwt_plot_magnifier.h> #include <highResTimeFunctions.h> #include <qwt_symbol.h> +#include <qtgui_util.h> class FrequencyDisplayPlot:public QwtPlot{ Q_OBJECT @@ -43,11 +45,20 @@ public: void set_yaxis(double min, double max); + void SetTraceColour (QColor); + void SetBGColour (QColor c); + void ShowCFMarker (const bool); + public slots: void resizeSlot( QSize *e ); void SetLowerIntensityLevel(const double); void SetUpperIntensityLevel(const double); + void OnPickerPointSelected(const QwtDoublePoint & p); + +signals: + void plotPointSelected(const QPointF p); + protected: private: @@ -71,9 +82,14 @@ private: QwtPlotMarker *_markerPeakAmplitude; QwtPlotMarker *_markerNoiseFloorAmplitude; + QwtPlotMarker *_markerCF; + + QwtDblClickPlotPicker *_picker; + QwtPlotMagnifier *_magnifier; double* _dataPoints; double* _xAxisPoints; + int _xAxisMultiplier; double* _minFFTPoints; double* _maxFFTPoints; diff --git a/gr-qtgui/lib/Makefile.am b/gr-qtgui/lib/Makefile.am index 26c9e64aa..7dee39eb4 100644 --- a/gr-qtgui/lib/Makefile.am +++ b/gr-qtgui/lib/Makefile.am @@ -86,25 +86,8 @@ QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) $(LTVERSIONFLAGS) libgnuradio_qtgui_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(BOOST_THREAD_LIB) \ - $(BOOST_DATE_TIME_LIB) \ - -lstdc++ \ + $(GNURADIO_CORE_LA) \ + $(BOOST_THREAD_LIB) \ + $(BOOST_DATE_TIME_LIB) \ + -lstdc++ \ $(QT_LIBS) - -############################## -# SWIG interfaces and libraries - -TOP_SWIG_IFILES = \ - qtgui.i - -# Install so that they end up available as: -# import gnuradio.qtgui -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio -qtgui_pythondir_category = \ - gnuradio/qtgui - -# additional libraries for linking with the SWIG-generated library -qtgui_la_swig_libadd = \ - libgnuradio-qtgui.la diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index da28d0304..be25a6cde 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -82,6 +82,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent) _xAxisPoints = new double[_numPoints]; _zoomer = new TimeDomainDisplayZoomer(canvas(), 0); + _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); // Disable polygon clipping QwtPainter::setDeviceClipping(false); @@ -135,6 +136,15 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent) _panner->setAxisEnabled(QwtPlot::yRight, false); _panner->setMouseButton(Qt::MidButton); + // emit the position of clicks on widget + _picker = new QwtDblClickPlotPicker(canvas()); + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + + // Configure magnify on mouse wheel + _magnifier = new QwtPlotMagnifier(canvas()); + _magnifier->setAxisEnabled(QwtPlot::xBottom, false); + // Avoid jumping when labels with more/less digits // appear/disappear when scrolling vertically @@ -269,4 +279,12 @@ TimeDomainDisplayPlot::SetSampleRate(double sr, double units, } } +void +TimeDomainDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + emit plotPointSelected(point); +} + #endif /* TIME_DOMAIN_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 952b5c8cf..01338300c 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h @@ -11,9 +11,11 @@ #include <qwt_scale_widget.h> #include <qwt_plot_zoomer.h> #include <qwt_plot_panner.h> +#include <qwt_plot_magnifier.h> #include <qwt_plot_marker.h> #include <highResTimeFunctions.h> #include <qwt_symbol.h> +#include <qtgui_util.h> class TimeDomainDisplayPlot:public QwtPlot{ Q_OBJECT @@ -37,6 +39,11 @@ public slots: void SetSampleRate(double sr, double units, const std::string &strunits); + void OnPickerPointSelected(const QwtDoublePoint & p); + +signals: + void plotPointSelected(const QPointF p); + protected slots: void LegendEntryChecked(QwtPlotItem *plotItem, bool on); @@ -51,6 +58,9 @@ private: QwtPlotPanner* _panner; QwtPlotZoomer* _zoomer; + QwtDblClickPlotPicker *_picker; + QwtPlotMagnifier *_magnifier; + double* _realDataPoints; double* _imagDataPoints; double* _xAxisPoints; diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index 08a71c023..2234f4238 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -253,13 +253,9 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) // Ctrl+RighButton: zoom out to full size _zoomer = new WaterfallZoomer(canvas(), 0); -#if QT_VERSION < 0x040000 + _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); -#else - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); -#endif _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton); @@ -267,6 +263,11 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) _panner->setAxisEnabled(QwtPlot::yRight, false); _panner->setMouseButton(Qt::MidButton); + // emit the position of clicks on widget + _picker = new QwtDblClickPlotPicker(canvas()); + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + // Avoid jumping when labels with more/less digits // appear/disappear when scrolling vertically @@ -279,6 +280,8 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) _zoomer->setTrackerPen(c); _UpdateIntensityRangeDisplay(); + + _xAxisMultiplier = 1; } WaterfallDisplayPlot::~WaterfallDisplayPlot() @@ -315,6 +318,8 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq, double stopFreq = constStopFreq / units; double centerFreq = constCenterFreq / units; + _xAxisMultiplier = units; + _useCenterFrequencyFlag = useCenterFrequencyFlag; if(_useCenterFrequencyFlag){ @@ -544,4 +549,13 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay() _lastReplot = get_highres_clock(); } +void +WaterfallDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + point.setX(point.x() * _xAxisMultiplier); + emit plotPointSelected(point); +} + #endif /* WATERFALL_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h index 6b4e978bb..faa48d6aa 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/lib/WaterfallDisplayPlot.h @@ -7,6 +7,7 @@ #include <qwt_plot_zoomer.h> #include <qwt_plot_panner.h> +#include <qtgui_util.h> #include <plot_waterfall.h> #include <highResTimeFunctions.h> @@ -50,10 +51,12 @@ public: public slots: void resizeSlot( QSize *s ); - + void OnPickerPointSelected(const QwtDoublePoint & p); + signals: void UpdatedLowerIntensityLevel(const double); void UpdatedUpperIntensityLevel(const double); + void plotPointSelected(const QPointF p); protected: @@ -62,12 +65,15 @@ private: double _startFrequency; double _stopFrequency; + int _xAxisMultiplier; PlotWaterfall *d_spectrogram; QwtPlotPanner* _panner; QwtPlotZoomer* _zoomer; + QwtDblClickPlotPicker *_picker; + WaterfallData* _waterfallData; timespec _lastReplot; diff --git a/gr-qtgui/lib/qtgui_sink_c.h b/gr-qtgui/lib/qtgui_sink_c.h index 1c9561704..fb0cb6c5f 100644 --- a/gr-qtgui/lib/qtgui_sink_c.h +++ b/gr-qtgui/lib/qtgui_sink_c.h @@ -67,8 +67,6 @@ private: double d_bandwidth; std::string d_name; - //gruel::mutex d_mutex; - bool d_shift; gri_fft_complex *d_fft; @@ -105,7 +103,6 @@ public: void set_update_time(double t); QApplication *d_qApplication; - //qtgui_obj *d_object; int general_work (int noutput_items, gr_vector_int &ninput_items, |