summaryrefslogtreecommitdiff
path: root/gr-qtgui
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui')
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.cc5
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.h3
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.cc10
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.h9
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.cc207
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.h5
6 files changed, 138 insertions, 101 deletions
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc
index e3af3b76d..f35062ea0 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc
@@ -62,7 +62,8 @@ void
SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
const bool frequency, const bool waterfall,
const bool waterfall3d, const bool time,
- const bool constellation)
+ const bool constellation,
+ const bool use_openGL)
{
//_windowStateLock->Lock();
@@ -81,7 +82,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
}
// Called from the Event Thread
- _spectrumDisplayForm = new SpectrumDisplayForm(parent);
+ _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent);
// Toggle Windows on/off
_spectrumDisplayForm->ToggleTabFrequency(frequency);
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h
index 2bc5fb34c..b87b50cab 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.h
@@ -30,7 +30,8 @@ public:
void OpenSpectrumWindow(QWidget*,
const bool frequency=true, const bool waterfall=true,
const bool waterfall3d=true, const bool time=true,
- const bool constellation=true);
+ const bool constellation=true,
+ const bool use_openGL=true);
void SetDisplayTitle(const std::string);
bool GetWindowOpenFlag();
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc
index bfdb25e32..08cfdab76 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_c.cc
@@ -37,6 +37,7 @@ qtgui_make_sink_c (int fftsize, int wintype,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
{
return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype,
@@ -44,6 +45,7 @@ qtgui_make_sink_c (int fftsize, int wintype,
plotfreq, plotwaterfall,
plotwaterfall3d, plottime,
plotconst,
+ use_openGL,
parent));
}
@@ -53,6 +55,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
: gr_block ("sink_c",
gr_make_io_signature (1, -1, sizeof(gr_complex)),
@@ -82,7 +85,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
buildwindow();
- initialize();
+ initialize(use_openGL);
}
qtgui_sink_c::~qtgui_sink_c()
@@ -105,7 +108,7 @@ void qtgui_sink_c::unlock()
void
-qtgui_sink_c::initialize()
+qtgui_sink_c::initialize(const bool opengl)
{
if(qApp != NULL) {
d_qApplication = qApp;
@@ -127,7 +130,8 @@ qtgui_sink_c::initialize()
d_main_gui->OpenSpectrumWindow(d_parent,
d_plotfreq, d_plotwaterfall,
d_plotwaterfall3d, d_plottime,
- d_plotconst);
+ d_plotconst,
+ opengl);
d_object = new qtgui_obj(d_qApplication);
qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h
index 7618bae95..0b3ba99e2 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.h
+++ b/gr-qtgui/src/lib/qtgui_sink_c.h
@@ -40,6 +40,7 @@ qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
bool plotfreq=true, bool plotwaterfall=true,
bool plotwaterfall3d=true, bool plottime=true,
bool plotconst=true,
+ bool use_openGL=true,
QWidget *parent=NULL);
class qtgui_sink_c : public gr_block
@@ -51,6 +52,7 @@ private:
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
float fmin, float fmax,
@@ -58,9 +60,12 @@ private:
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
- void initialize();
+ // use opengl to force OpenGL on or off
+ // this might be necessary for sessions over SSH
+ void initialize(const bool opengl);
int d_fftsize;
gr_firdes::win_type d_wintype;
@@ -79,7 +84,7 @@ private:
gr_complex *d_residbuf;
bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst;
-
+
QWidget *d_parent;
SpectrumGUIClass *d_main_gui;
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc
index b8e3982df..f82961191 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/src/lib/spectrumdisplayform.cc
@@ -5,17 +5,22 @@
int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1;
-SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
+SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent)
: QWidget(parent)
{
setupUi(this);
+ _useOpenGL = useOpenGL;
_systemSpecifiedFlag = false;
_intValidator = new QIntValidator(this);
_intValidator->setBottom(0);
_frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
- _waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+ }
+
_timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame);
_numRealDataPoints = 1024;
@@ -34,12 +39,14 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
WaterfallMinimumIntensityWheel->setTickCnt(50);
WaterfallMinimumIntensityWheel->setValue(-200);
- Waterfall3DMaximumIntensityWheel->setRange(-200, 0);
- Waterfall3DMaximumIntensityWheel->setTickCnt(50);
- Waterfall3DMinimumIntensityWheel->setRange(-200, 0);
- Waterfall3DMinimumIntensityWheel->setTickCnt(50);
- Waterfall3DMinimumIntensityWheel->setValue(-200);
-
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ Waterfall3DMaximumIntensityWheel->setRange(-200, 0);
+ Waterfall3DMaximumIntensityWheel->setTickCnt(50);
+ Waterfall3DMinimumIntensityWheel->setRange(-200, 0);
+ Waterfall3DMinimumIntensityWheel->setTickCnt(50);
+ Waterfall3DMinimumIntensityWheel->setValue(-200);
+ }
+
_peakFrequency = 0;
_peakAmplitude = -HUGE_VAL;
@@ -203,10 +210,12 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
timePerFFT, dataTimestamp,
spectrumUpdateEvent->getDroppedFFTFrames());
}
- if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
- _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
- timePerFFT, dataTimestamp,
- spectrumUpdateEvent->getDroppedFFTFrames());
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
+ _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
+ timePerFFT, dataTimestamp,
+ spectrumUpdateEvent->getDroppedFFTFrames());
+ }
}
}
@@ -281,27 +290,29 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e )
WaterfallAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
e->size().height()-115);
- Waterfall3DPlotDisplayFrame->resize(e->size().width()-4,
- e->size().height()-140);
- _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4,
- e->size().height()-140);
-
- Waterfall3DMaximumIntensityLabel->move(width() - 5 -
- Waterfall3DMaximumIntensityLabel->width(),
- Waterfall3DMaximumIntensityLabel->y());
- Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x() - 5 -
- Waterfall3DMaximumIntensityWheel->x(),
- Waterfall3DMaximumIntensityWheel->height());
- Waterfall3DMinimumIntensityLabel->move(width() - 5 -
- Waterfall3DMinimumIntensityLabel->width(),
- height() - 115);
- Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x() - 5 -
- Waterfall3DMinimumIntensityWheel->x(),
- Waterfall3DMaximumIntensityWheel->height());
- Waterfall3DMinimumIntensityWheel->move(Waterfall3DMinimumIntensityWheel->x(),
- height() - 115);
- Waterfall3DAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
- e->size().height()-115);
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ Waterfall3DPlotDisplayFrame->resize(e->size().width()-4,
+ e->size().height()-140);
+ _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4,
+ e->size().height()-140);
+
+ Waterfall3DMaximumIntensityLabel->move(width() - 5 -
+ Waterfall3DMaximumIntensityLabel->width(),
+ Waterfall3DMaximumIntensityLabel->y());
+ Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x() - 5 -
+ Waterfall3DMaximumIntensityWheel->x(),
+ Waterfall3DMaximumIntensityWheel->height());
+ Waterfall3DMinimumIntensityLabel->move(width() - 5 -
+ Waterfall3DMinimumIntensityLabel->width(),
+ height() - 115);
+ Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x() - 5 -
+ Waterfall3DMinimumIntensityWheel->x(),
+ Waterfall3DMaximumIntensityWheel->height());
+ Waterfall3DMinimumIntensityWheel->move(Waterfall3DMinimumIntensityWheel->x(),
+ height() - 115);
+ Waterfall3DAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
+ e->size().height()-115);
+ }
TimeDomainDisplayFrame->resize(e->size().width()-4,
e->size().height()-140);
@@ -340,11 +351,11 @@ SpectrumDisplayForm::customEvent( QEvent * e)
waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
- waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value());
- waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
-
// If the video card doesn't support OpenGL then don't display the 3D Waterfall
- if(QGLFormat::hasOpenGL()){
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value());
+ waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
+
// Check for Hardware Acceleration of the OpenGL
if(!_waterfall3DDisplayPlot->format().directRendering()){
// Only ask this once while the program is running...
@@ -485,11 +496,13 @@ SpectrumDisplayForm::SetFrequencyRange(const double newStartFrequency,
newCenterFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
- _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
- newStopFrequency,
- newCenterFrequency,
- UseRFFrequenciesCheckBox->isChecked(),
- units, strunits[iunit]);
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
+ newStopFrequency,
+ newCenterFrequency,
+ UseRFFrequenciesCheckBox->isChecked(),
+ units, strunits[iunit]);
+ }
}
}
@@ -578,7 +591,9 @@ SpectrumDisplayForm::Reset()
AverageDataReset();
_waterfallDisplayPlot->Reset();
- _waterfall3DDisplayPlot->Reset();
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot->Reset();
+ }
}
@@ -661,30 +676,34 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue )
void
SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double newValue )
{
- if(newValue > Waterfall3DMinimumIntensityWheel->value()){
- Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
- }
- else{
- Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(newValue > Waterfall3DMinimumIntensityWheel->value()){
+ Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
+ }
+ else{
+ Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
+ }
+
+ _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+ Waterfall3DMaximumIntensityWheel->value());
}
-
- _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
- Waterfall3DMaximumIntensityWheel->value());
}
void
SpectrumDisplayForm::waterfall3DMinimumIntensityChangedCB( double newValue )
{
- if(newValue < Waterfall3DMaximumIntensityWheel->value()){
- Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
- }
- else{
- Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(newValue < Waterfall3DMaximumIntensityWheel->value()){
+ Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
+ }
+ else{
+ Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
+ }
+
+ _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+ Waterfall3DMaximumIntensityWheel->value());
}
-
- _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
- Waterfall3DMaximumIntensityWheel->value());
}
@@ -716,17 +735,19 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB()
void
SpectrumDisplayForm::Waterfall3DAutoScaleBtnCB()
{
- double minimumIntensity = _noiseFloorAmplitude - 5;
- if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){
- minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue();
- }
- Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity);
- double maximumIntensity = _peakAmplitude + 10;
- if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){
- maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue();
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ double minimumIntensity = _noiseFloorAmplitude - 5;
+ if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){
+ minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue();
+ }
+ Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity);
+ double maximumIntensity = _peakAmplitude + 10;
+ if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){
+ maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue();
+ }
+ Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity);
+ waterfallMaximumIntensityChangedCB(maximumIntensity);
}
- Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity);
- waterfallMaximumIntensityChangedCB(maximumIntensity);
}
void
@@ -758,27 +779,29 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType )
void
SpectrumDisplayForm::Waterfall3DIntensityColorTypeChanged( int newType )
{
- QColor lowIntensityColor;
- QColor highIntensityColor;
- if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
- // Select the Low Intensity Color
- lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
- if(!lowIntensityColor.isValid()){
- lowIntensityColor = Qt::black;
- }
- QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok);
- lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
-
- // Select the High Intensity Color
- highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
- if(!highIntensityColor.isValid()){
- highIntensityColor = Qt::white;
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ QColor lowIntensityColor;
+ QColor highIntensityColor;
+ if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
+ // Select the Low Intensity Color
+ lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
+ if(!lowIntensityColor.isValid()){
+ lowIntensityColor = Qt::black;
+ }
+ QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok);
+ lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
+
+ // Select the High Intensity Color
+ highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
+ if(!highIntensityColor.isValid()){
+ highIntensityColor = Qt::white;
+ }
+ QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
+ highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
}
- QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
- highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
+ _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
+ highIntensityColor);
}
- _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
- highIntensityColor);
}
@@ -816,9 +839,11 @@ void
SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state)
{
if(state == true) {
- if(d_plot_waterfall3d == -1) {
- SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
- d_plot_waterfall3d = SpectrumTypeTab->count()-1;
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(d_plot_waterfall3d == -1) {
+ SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
+ d_plot_waterfall3d = SpectrumTypeTab->count()-1;
+ }
}
}
else {
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h
index aed5d728e..a7c5201fe 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.h
+++ b/gr-qtgui/src/lib/spectrumdisplayform.h
@@ -20,7 +20,7 @@ class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
Q_OBJECT
public:
- SpectrumDisplayForm(QWidget* parent = 0);
+ SpectrumDisplayForm(bool useOpenGL = true, QWidget* parent = 0);
~SpectrumDisplayForm();
void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints,
@@ -75,8 +75,9 @@ private slots:
protected:
private:
- void _AverageHistory( const double * newBuffer );
+ void _AverageHistory( const double * newBuffer );
+ bool _useOpenGL;
int _historyEntryCount;
int _historyEntry;
std::vector<double*>* _historyVector;