Last active
January 4, 2016 21:28
-
-
Save FlorianFranzen/8680756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h | |
index 3b31191..517f69f 100644 | |
--- gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h | |
+++ gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h | |
@@ -269,6 +269,7 @@ signals: | |
protected slots: | |
virtual void legendEntryChecked(QwtPlotItem *plotItem, bool on); | |
+ virtual void legendEntryChecked(const QVariant &plotItem, bool on, int index); | |
protected: | |
int d_nplots; | |
diff --git gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h | |
index 4e0d0bd..8874a7e 100644 | |
--- gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h | |
+++ gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h | |
@@ -59,6 +59,7 @@ public slots: | |
void setSemilogy(bool en); | |
void legendEntryChecked(QwtPlotItem *plotItem, bool on); | |
+ void legendEntryChecked(const QVariant &plotItem, bool on, int index); | |
void enableTagMarker(int which, bool en); | |
diff --git gr-qtgui/include/gnuradio/qtgui/utils.h gr-qtgui/include/gnuradio/qtgui/utils.h | |
index c427128..7794feb 100644 | |
--- gr-qtgui/include/gnuradio/qtgui/utils.h | |
+++ gr-qtgui/include/gnuradio/qtgui/utils.h | |
@@ -31,7 +31,12 @@ | |
class QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
QwtDblClickPlotPicker(QwtPlotCanvas *); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ QwtDblClickPlotPicker(QWidget *); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
~QwtDblClickPlotPicker(); | |
virtual QwtPickerMachine * stateMachine(int) const; | |
diff --git gr-qtgui/lib/ConstellationDisplayPlot.cc gr-qtgui/lib/ConstellationDisplayPlot.cc | |
index af27fc4..47e6b0b 100644 | |
--- gr-qtgui/lib/ConstellationDisplayPlot.cc | |
+++ gr-qtgui/lib/ConstellationDisplayPlot.cc | |
@@ -33,7 +33,12 @@ | |
class ConstellationDisplayZoomer: public QwtPlotZoomer | |
{ | |
public: | |
- ConstellationDisplayZoomer(QwtPlotCanvas* canvas):QwtPlotZoomer(canvas) | |
+#if QWT_VERSION < 0x060100 | |
+ ConstellationDisplayZoomer(QwtPlotCanvas* canvas) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ ConstellationDisplayZoomer(QWidget* canvas) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ : QwtPlotZoomer(canvas) | |
{ | |
setTrackerMode(QwtPicker::AlwaysOn); | |
} | |
diff --git gr-qtgui/lib/DisplayPlot.cc gr-qtgui/lib/DisplayPlot.cc | |
index 5c29381..6f1f106 100644 | |
--- gr-qtgui/lib/DisplayPlot.cc | |
+++ gr-qtgui/lib/DisplayPlot.cc | |
@@ -27,6 +27,7 @@ | |
#include <QColor> | |
#include <cmath> | |
#include <iostream> | |
+#include <stdexcept> | |
#include <QDebug> | |
DisplayPlot::DisplayPlot(int nplots, QWidget* parent) | |
@@ -81,11 +82,19 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) | |
sd->setMinimumExtent( fm.width("100.00") ); | |
QwtLegend* legendDisplay = new QwtLegend(this); | |
+ | |
+#if QWT_VERSION < 0x060100 | |
legendDisplay->setItemMode(QwtLegend::CheckableItem); | |
insertLegend(legendDisplay); | |
- | |
connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), | |
this, SLOT(legendEntryChecked(QwtPlotItem *, bool))); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ legendDisplay->setDefaultItemMode(QwtLegendData::Checkable); | |
+ insertLegend(legendDisplay); | |
+ connect(legendDisplay, SIGNAL(checked(const QVariant&, bool, int)), | |
+ this, SLOT(legendEntryChecked(const QVariant&, bool, int))); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
} | |
DisplayPlot::~DisplayPlot() | |
@@ -403,6 +412,16 @@ void DisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) | |
replot(); | |
} | |
+void DisplayPlot::legendEntryChecked(const QVariant &plotItem, bool on, int index) | |
+{ | |
+#if QWT_VERSION < 0x060100 | |
+ std::runtime_error("DisplayPlot::legendEntryChecked with QVariant not enabled in this version of QWT.\n"); | |
+#else | |
+ QwtPlotItem *p = infoToItem(plotItem); | |
+ legendEntryChecked(p, on); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+} | |
+ | |
void | |
DisplayPlot::onPickerPointSelected(const QwtDoublePoint & p) | |
{ | |
diff --git gr-qtgui/lib/FrequencyDisplayPlot.cc gr-qtgui/lib/FrequencyDisplayPlot.cc | |
index 85fd14f..60cfcd2 100644 | |
--- gr-qtgui/lib/FrequencyDisplayPlot.cc | |
+++ gr-qtgui/lib/FrequencyDisplayPlot.cc | |
@@ -28,17 +28,27 @@ | |
#include <gnuradio/qtgui/qtgui_types.h> | |
#include <qwt_scale_draw.h> | |
#include <qwt_legend.h> | |
-#include <qwt_legend_item.h> | |
#include <QColor> | |
#include <iostream> | |
+#if QWT_VERSION < 0x060100 | |
+#include <qwt_legend_item.h> | |
+#else /* QWT_VERSION < 0x060100 */ | |
+#include <qwt_legend_data.h> | |
+#include <qwt_legend_label.h> | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
/*********************************************************************** | |
* Widget to provide mouse pointer coordinate text | |
**********************************************************************/ | |
class FreqDisplayZoomer: public QwtPlotZoomer, public FreqOffsetAndPrecisionClass | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
FreqDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int freqPrecision) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ FreqDisplayZoomer(QWidget* canvas, const unsigned int freqPrecision) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotZoomer(canvas), | |
FreqOffsetAndPrecisionClass(freqPrecision) | |
{ | |
@@ -205,12 +215,20 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) | |
_resetXAxisPoints(); | |
// Turn off min/max hold plots in legend | |
+#if QWT_VERSION < 0x060100 | |
QWidget *w; | |
QwtLegend* legendDisplay = legend(); | |
w = legendDisplay->find(d_min_fft_plot_curve); | |
((QwtLegendItem*)w)->setChecked(true); | |
w = legendDisplay->find(d_max_fft_plot_curve); | |
((QwtLegendItem*)w)->setChecked(true); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ QWidget *w; | |
+ w = ((QwtLegend*)legend())->legendWidget(itemToInfo(d_min_fft_plot_curve)); | |
+ ((QwtLegendLabel*)w)->setChecked(true); | |
+ w = ((QwtLegend*)legend())->legendWidget(itemToInfo(d_max_fft_plot_curve)); | |
+ ((QwtLegendLabel*)w)->setChecked(true); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
replot(); | |
} | |
diff --git gr-qtgui/lib/HistogramDisplayPlot.cc gr-qtgui/lib/HistogramDisplayPlot.cc | |
index 301cb13..ce9ed3c 100644 | |
--- gr-qtgui/lib/HistogramDisplayPlot.cc | |
+++ gr-qtgui/lib/HistogramDisplayPlot.cc | |
@@ -67,7 +67,11 @@ protected: | |
class HistogramDisplayZoomer: public QwtPlotZoomer, public TimePrecisionClass | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
HistogramDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timeprecision) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ HistogramDisplayZoomer(QWidget* canvas, const unsigned int timeprecision) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotZoomer(canvas),TimePrecisionClass(timeprecision) | |
{ | |
setTrackerMode(QwtPicker::AlwaysOn); | |
@@ -273,7 +277,12 @@ HistogramDisplayPlot::_resetXAxisPoints(double left, double right) | |
for(long loc = 0; loc < d_bins; loc++){ | |
d_xdata[loc] = d_left + loc*d_width; | |
} | |
+#if QWT_VERSION < 0x060100 | |
axisScaleDiv(QwtPlot::xBottom)->setInterval(d_left, d_right); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ QwtScaleDiv scalediv(d_left, d_right); | |
+ setAxisScaleDiv(QwtPlot::xBottom, scalediv); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
// Set up zoomer base for maximum unzoom x-axis | |
// and reset to maximum unzoom level | |
@@ -333,7 +342,11 @@ HistogramDisplayPlot::setSemilogx(bool en) | |
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); | |
} | |
else { | |
+#if QWT_VERSION < 0x060100 | |
setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ setAxisScaleEngine(QwtPlot::xBottom, new QwtLogScaleEngine); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
} | |
} | |
@@ -342,13 +355,23 @@ HistogramDisplayPlot::setSemilogy(bool en) | |
{ | |
if(d_semilogy != en) { | |
d_semilogy = en; | |
+ | |
+#if QWT_VERSION < 0x060100 | |
double max = axisScaleDiv(QwtPlot::yLeft)->upperBound(); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ double max = axisScaleDiv(QwtPlot::yLeft).upperBound(); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
if(!d_semilogy) { | |
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); | |
setYaxis(-pow(10.0, max/10.0), pow(10.0, max/10.0)); | |
} | |
else { | |
+#if QWT_VERSION < 0x060100 | |
setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
setYaxis(1e-10, 10.0*log10(100*max)); | |
} | |
} | |
diff --git gr-qtgui/lib/TimeDomainDisplayPlot.cc gr-qtgui/lib/TimeDomainDisplayPlot.cc | |
index 8d65630..8be3f90 100644 | |
--- gr-qtgui/lib/TimeDomainDisplayPlot.cc | |
+++ gr-qtgui/lib/TimeDomainDisplayPlot.cc | |
@@ -61,7 +61,11 @@ protected: | |
class TimeDomainDisplayZoomer: public QwtPlotZoomer, public TimePrecisionClass | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
TimeDomainDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timePrecision) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ TimeDomainDisplayZoomer(QWidget* canvas, const unsigned int timePrecision) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotZoomer(canvas),TimePrecisionClass(timePrecision) | |
{ | |
setTrackerMode(QwtPicker::AlwaysOn); | |
@@ -394,6 +398,17 @@ TimeDomainDisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) | |
} | |
void | |
+TimeDomainDisplayPlot::legendEntryChecked(const QVariant &plotItem, bool on, int index) | |
+{ | |
+#if QWT_VERSION < 0x060100 | |
+ std::runtime_error("TimeDomainDisplayPlot::legendEntryChecked with QVariant not enabled in this version of QWT.\n"); | |
+#else | |
+ QwtPlotItem *p = infoToItem(plotItem); | |
+ legendEntryChecked(p, on); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+} | |
+ | |
+void | |
TimeDomainDisplayPlot::_resetXAxisPoints() | |
{ | |
double delt = 1.0/d_sample_rate; | |
@@ -490,7 +505,11 @@ TimeDomainDisplayPlot::setSemilogx(bool en) | |
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); | |
} | |
else { | |
+#if QWT_VERSION < 0x060100 | |
setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ setAxisScaleEngine(QwtPlot::xBottom, new QwtLogScaleEngine); | |
+#endif /*QWT_VERSION < 0x060100 */ | |
} | |
_resetXAxisPoints(); | |
} | |
@@ -500,13 +519,23 @@ TimeDomainDisplayPlot::setSemilogy(bool en) | |
{ | |
if(d_semilogy != en) { | |
d_semilogy = en; | |
+ | |
+#if QWT_VERSION < 0x060100 | |
double max = axisScaleDiv(QwtPlot::yLeft)->upperBound(); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ double max = axisScaleDiv(QwtPlot::yLeft).upperBound(); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
if(!d_semilogy) { | |
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); | |
setYaxis(-pow(10.0, max/10.0), pow(10.0, max/10.0)); | |
} | |
else { | |
+#if QWT_VERSION < 0x060100 | |
setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine); | |
+#endif /*QWT_VERSION < 0x060100 */ | |
setYaxis(1e-10, 10.0*log10(max)); | |
} | |
} | |
diff --git gr-qtgui/lib/TimeRasterDisplayPlot.cc gr-qtgui/lib/TimeRasterDisplayPlot.cc | |
index b26f7f0..afe326b 100644 | |
--- gr-qtgui/lib/TimeRasterDisplayPlot.cc | |
+++ gr-qtgui/lib/TimeRasterDisplayPlot.cc | |
@@ -29,11 +29,17 @@ | |
#include <qwt_color_map.h> | |
#include <qwt_scale_draw.h> | |
#include <qwt_legend.h> | |
-#include <qwt_legend_item.h> | |
#include <qwt_plot_layout.h> | |
#include <QColor> | |
#include <iostream> | |
+#if QWT_VERSION < 0x060100 | |
+#include <qwt_legend_item.h> | |
+#else /* QWT_VERSION < 0x060100 */ | |
+#include <qwt_legend_data.h> | |
+#include <qwt_legend_label.h> | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
#include <boost/date_time/posix_time/posix_time.hpp> | |
namespace pt = boost::posix_time; | |
@@ -125,8 +131,13 @@ class TimeRasterZoomer: public QwtPlotZoomer, public TimePrecisionClass, | |
public TimeScaleData | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
TimeRasterZoomer(QwtPlotCanvas* canvas, double rows, double cols, | |
const unsigned int timePrecision) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ TimeRasterZoomer(QWidget* canvas, double rows, double cols, | |
+ const unsigned int timePrecision) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotZoomer(canvas), TimePrecisionClass(timePrecision), TimeScaleData(), | |
d_rows(static_cast<double>(rows)), d_cols(static_cast<double>(cols)) | |
{ | |
diff --git gr-qtgui/lib/WaterfallDisplayPlot.cc gr-qtgui/lib/WaterfallDisplayPlot.cc | |
index 47d6624..92fcb38 100644 | |
--- gr-qtgui/lib/WaterfallDisplayPlot.cc | |
+++ gr-qtgui/lib/WaterfallDisplayPlot.cc | |
@@ -29,11 +29,17 @@ | |
#include <qwt_color_map.h> | |
#include <qwt_scale_draw.h> | |
#include <qwt_legend.h> | |
-#include <qwt_legend_item.h> | |
#include <qwt_plot_layout.h> | |
#include <QColor> | |
#include <iostream> | |
+#if QWT_VERSION < 0x060100 | |
+#include <qwt_legend_item.h> | |
+#else /* QWT_VERSION < 0x060100 */ | |
+#include <qwt_legend_data.h> | |
+#include <qwt_legend_label.h> | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
#include <boost/date_time/posix_time/posix_time.hpp> | |
namespace pt = boost::posix_time; | |
@@ -79,7 +85,11 @@ class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData, | |
public FreqOffsetAndPrecisionClass | |
{ | |
public: | |
+#if QWT_VERSION < 0x060100 | |
WaterfallZoomer(QwtPlotCanvas* canvas, const unsigned int freqPrecision) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ WaterfallZoomer(QWidget* canvas, const unsigned int freqPrecision) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotZoomer(canvas), TimeScaleData(), | |
FreqOffsetAndPrecisionClass(freqPrecision) | |
{ | |
diff --git gr-qtgui/lib/qtgui_util.cc gr-qtgui/lib/qtgui_util.cc | |
index 539f7ba..bb06f58 100644 | |
--- gr-qtgui/lib/qtgui_util.cc | |
+++ gr-qtgui/lib/qtgui_util.cc | |
@@ -61,7 +61,11 @@ QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern, | |
return cmdList; | |
} | |
+#if QWT_VERSION < 0x060100 | |
QwtDblClickPlotPicker::QwtDblClickPlotPicker(QwtPlotCanvas* canvas) | |
+#else /* QWT_VERSION < 0x060100 */ | |
+QwtDblClickPlotPicker::QwtDblClickPlotPicker(QWidget* canvas) | |
+#endif /* QWT_VERSION < 0x060100 */ | |
: QwtPlotPicker(canvas) | |
{ | |
#if QWT_VERSION < 0x060000 | |
diff --git gr-qtgui/lib/spectrumdisplayform.cc gr-qtgui/lib/spectrumdisplayform.cc | |
index 0d16b95..aeda7d0 100644 | |
--- gr-qtgui/lib/spectrumdisplayform.cc | |
+++ gr-qtgui/lib/spectrumdisplayform.cc | |
@@ -50,9 +50,15 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) | |
minHoldCheckBox_toggled( false ); | |
maxHoldCheckBox_toggled( false ); | |
+#if QWT_VERSION < 0x060100 | |
WaterfallMaximumIntensitySlider->setRange(-200, 0); | |
WaterfallMinimumIntensitySlider->setRange(-200, 0); | |
WaterfallMinimumIntensitySlider->setValue(-200); | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ WaterfallMaximumIntensitySlider->setScale(-200, 0); | |
+ WaterfallMinimumIntensitySlider->setScale(-200, 0); | |
+ WaterfallMinimumIntensitySlider->setValue(-200); | |
+#endif /* QWT_VERSION < 0x060100 */ | |
_peakFrequency = 0; | |
_peakAmplitude = -HUGE_VAL; | |
@@ -606,14 +612,26 @@ void | |
SpectrumDisplayForm::waterfallAutoScaleBtnCB() | |
{ | |
double minimumIntensity = _noiseFloorAmplitude - 5; | |
- if(minimumIntensity < WaterfallMinimumIntensitySlider->minValue()){ | |
+ double maximumIntensity = _peakAmplitude + 10; | |
+ | |
+#if QWT_VERSION < 0x060100 | |
+ if(minimumIntensity < WaterfallMinimumIntensitySlider->minValue()) { | |
minimumIntensity = WaterfallMinimumIntensitySlider->minValue(); | |
} | |
WaterfallMinimumIntensitySlider->setValue(minimumIntensity); | |
- double maximumIntensity = _peakAmplitude + 10; | |
- if(maximumIntensity > WaterfallMaximumIntensitySlider->maxValue()){ | |
+ if(maximumIntensity > WaterfallMaximumIntensitySlider->maxValue()) { | |
maximumIntensity = WaterfallMaximumIntensitySlider->maxValue(); | |
} | |
+#else /* QWT_VERSION < 0x060100 */ | |
+ if(minimumIntensity < WaterfallMinimumIntensitySlider->lowerBound()) { | |
+ minimumIntensity = WaterfallMinimumIntensitySlider->lowerBound(); | |
+ } | |
+ WaterfallMinimumIntensitySlider->setValue(minimumIntensity); | |
+ if(maximumIntensity > WaterfallMaximumIntensitySlider->upperBound()) { | |
+ maximumIntensity = WaterfallMaximumIntensitySlider->upperBound(); | |
+ } | |
+#endif /* QWT_VERSION < 0x060100 */ | |
+ | |
WaterfallMaximumIntensitySlider->setValue(maximumIntensity); | |
waterfallMaximumIntensityChangedCB(maximumIntensity); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment