summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2013-12-17 19:22:03 -0500
committerTom Rondeau <tom@trondeau.com>2013-12-17 19:22:03 -0500
commit4e8fe5fab16c13967994167c5d9b4713dd82ff58 (patch)
tree88d6f56cd2bb6e18614cc278ee7480bc44e277ae
parentd183361a4bff5d9dfe232a5df9b23811d2774b94 (diff)
qtgui: enables use of QWT 6.1.
-rw-r--r--cmake/Modules/FindQwt.cmake2
-rw-r--r--gr-qtgui/include/gnuradio/qtgui/utils.h5
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc7
-rw-r--r--gr-qtgui/lib/DisplayPlot.cc6
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc20
-rw-r--r--gr-qtgui/lib/HistogramDisplayPlot.cc23
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc18
-rw-r--r--gr-qtgui/lib/TimeRasterDisplayPlot.cc13
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc12
-rw-r--r--gr-qtgui/lib/qtgui_util.cc4
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc24
11 files changed, 126 insertions, 8 deletions
diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake
index d3dc7a5be2..a94055876a 100644
--- a/cmake/Modules/FindQwt.cmake
+++ b/cmake/Modules/FindQwt.cmake
@@ -39,7 +39,7 @@ if(QWT_INCLUDE_DIRS)
QWT_STRING_VERSION REGEX "QWT_VERSION_STR")
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" QWT_VERSION ${QWT_STRING_VERSION})
string(COMPARE LESS ${QWT_VERSION} "5.2.0" QWT_WRONG_VERSION)
- string(COMPARE GREATER ${QWT_VERSION} "6.0.2" QWT_WRONG_VERSION)
+ string(COMPARE GREATER ${QWT_VERSION} "6.1.2" QWT_WRONG_VERSION)
message(STATUS "QWT Version: ${QWT_VERSION}")
if(NOT QWT_WRONG_VERSION)
diff --git a/gr-qtgui/include/gnuradio/qtgui/utils.h b/gr-qtgui/include/gnuradio/qtgui/utils.h
index c4271288fa..7794feb06d 100644
--- a/gr-qtgui/include/gnuradio/qtgui/utils.h
+++ b/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 a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
index af27fc4ea4..47e6b0b0de 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.cc
+++ b/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 a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc
index 5c29381906..50661aba02 100644
--- a/gr-qtgui/lib/DisplayPlot.cc
+++ b/gr-qtgui/lib/DisplayPlot.cc
@@ -81,7 +81,13 @@ 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);
+#else /* QWT_VERSION < 0x060100 */
+ legendDisplay->setDefaultItemMode(QwtLegendData::Checkable);
+#endif /* QWT_VERSION < 0x060100 */
+
insertLegend(legendDisplay);
connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)),
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 85fd14f5b9..60cfcd26fb 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/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 a/gr-qtgui/lib/HistogramDisplayPlot.cc b/gr-qtgui/lib/HistogramDisplayPlot.cc
index 301cb13f17..ce9ed3c00d 100644
--- a/gr-qtgui/lib/HistogramDisplayPlot.cc
+++ b/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 a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index 8d6563003e..296964046c 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/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);
@@ -490,7 +494,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 +508,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 a/gr-qtgui/lib/TimeRasterDisplayPlot.cc b/gr-qtgui/lib/TimeRasterDisplayPlot.cc
index b26f7f071b..afe326bdbb 100644
--- a/gr-qtgui/lib/TimeRasterDisplayPlot.cc
+++ b/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 a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 47d6624798..92fcb38eaa 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/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 a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc
index 539f7bac8f..bb06f58e97 100644
--- a/gr-qtgui/lib/qtgui_util.cc
+++ b/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 a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
index 0d16b957a6..aeda7d06ab 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/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);
}