From befadabc2f18b483c71250adfd7dbf42f66b16f0 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 12:55:16 -0400 Subject: gr-qtgui: restructuring qtgui directory to new layout. --- gr-qtgui/lib/spectrumdisplayform.cc | 691 ++++++++++++++++++++++++++++++++++++ 1 file changed, 691 insertions(+) create mode 100644 gr-qtgui/lib/spectrumdisplayform.cc (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc new file mode 100644 index 000000000..e0509a294 --- /dev/null +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -0,0 +1,691 @@ +#include +#include +#include +#include + +int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1; + +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); + + _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame); + _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); + _numRealDataPoints = 1024; + _realFFTDataPoints = new double[_numRealDataPoints]; + _averagedValues = new double[_numRealDataPoints]; + _historyVector = new std::vector; + + AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 + MinHoldCheckBox_toggled( false ); + MaxHoldCheckBox_toggled( false ); + + WaterfallMaximumIntensityWheel->setRange(-200, 0); + WaterfallMaximumIntensityWheel->setTickCnt(50); + WaterfallMinimumIntensityWheel->setRange(-200, 0); + WaterfallMinimumIntensityWheel->setTickCnt(50); + WaterfallMinimumIntensityWheel->setValue(-200); + + _peakFrequency = 0; + _peakAmplitude = -HUGE_VAL; + + _noiseFloorAmplitude = -HUGE_VAL; + + connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), + _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); + connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), + _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); + + _frequencyDisplayPlot->SetLowerIntensityLevel(-200); + _frequencyDisplayPlot->SetUpperIntensityLevel(-200); + + // Load up the acceptable FFT sizes... + FFTSizeComboBox->clear(); + for(long fftSize = SpectrumGUIClass::MIN_FFT_SIZE; fftSize <= SpectrumGUIClass::MAX_FFT_SIZE; fftSize *= 2){ + FFTSizeComboBox->insertItem(FFTSizeComboBox->count(), QString("%1").arg(fftSize)); + } + Reset(); + + ToggleTabFrequency(false); + ToggleTabWaterfall(false); + ToggleTabTime(false); + ToggleTabConstellation(false); + + // Create a timer to update plots at the specified rate + displayTimer = new QTimer(this); + connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer())); +} + +SpectrumDisplayForm::~SpectrumDisplayForm() +{ + // Qt deletes children when parent is deleted + + // Don't worry about deleting Display Plots - they are deleted when parents are deleted + delete _intValidator; + + delete[] _realFFTDataPoints; + delete[] _averagedValues; + + for(unsigned int count = 0; count < _historyVector->size(); count++){ + delete[] _historyVector->operator[](count); + } + + delete _historyVector; + + displayTimer->stop(); + delete displayTimer; +} + +void +SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem, + const uint64_t numFFTDataPoints, + const uint64_t numTimeDomainDataPoints ) +{ + ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); + + if(newSystem != NULL){ + _system = newSystem; + _systemSpecifiedFlag = true; + } + else{ + _systemSpecifiedFlag = false; + } +} + +void +SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdateEvent) +{ + //_lastSpectrumEvent = (SpectrumUpdateEvent)(*spectrumUpdateEvent); + const std::complex* complexDataPoints = spectrumUpdateEvent->getFFTPoints(); + const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints(); + const double* realTimeDomainDataPoints = spectrumUpdateEvent->getRealTimeDomainPoints(); + const double* imagTimeDomainDataPoints = spectrumUpdateEvent->getImagTimeDomainPoints(); + const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints(); + const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); + const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag(); + const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag(); + const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); + + // REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true... + ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); + + // Calculate the Magnitude of the complex point + const std::complex* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2; + double* realFFTDataPointsPtr = _realFFTDataPoints; + + double sumMean = 0.0; + double localPeakAmplitude = -HUGE_VAL; + double localPeakFrequency = 0.0; + const double fftBinSize = (_stopFrequency-_startFrequency) / + static_cast(numFFTDataPoints); + + // Run this twice to perform the fftshift operation on the data here as well + std::complex scaleFactor = std::complex((float)numFFTDataPoints); + for(uint64_t point = 0; point < numFFTDataPoints/2; point++){ + std::complex pt = (*complexDataPointsPtr) / scaleFactor; + *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20); + + if(*realFFTDataPointsPtr > localPeakAmplitude) { + localPeakFrequency = static_cast(point) * fftBinSize; + localPeakAmplitude = *realFFTDataPointsPtr; + } + sumMean += *realFFTDataPointsPtr; + + complexDataPointsPtr++; + realFFTDataPointsPtr++; + } + + // This loop takes the first half of the input data and puts it in the + // second half of the plotted data + complexDataPointsPtr = complexDataPoints; + for(uint64_t point = 0; point < numFFTDataPoints/2; point++){ + std::complex pt = (*complexDataPointsPtr) / scaleFactor; + *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20); + + if(*realFFTDataPointsPtr > localPeakAmplitude) { + localPeakFrequency = static_cast(point) * fftBinSize; + localPeakAmplitude = *realFFTDataPointsPtr; + } + sumMean += *realFFTDataPointsPtr; + + complexDataPointsPtr++; + realFFTDataPointsPtr++; + } + + // Don't update the averaging history if this is repeated data + if(!repeatDataFlag){ + _AverageHistory(_realFFTDataPoints); + + // Only use the local info if we are not repeating data + _peakAmplitude = localPeakAmplitude; + _peakFrequency = localPeakFrequency; + + // calculate the spectral mean + // +20 because for the comparison below we only want to throw out bins + // that are significantly higher (and would, thus, affect the mean more) + const double meanAmplitude = (sumMean / numFFTDataPoints) + 20.0; + + // now throw out any bins higher than the mean + sumMean = 0.0; + uint64_t newNumDataPoints = numFFTDataPoints; + for(uint64_t number = 0; number < numFFTDataPoints; number++){ + if (_realFFTDataPoints[number] <= meanAmplitude) + sumMean += _realFFTDataPoints[number]; + else + newNumDataPoints--; + } + + if (newNumDataPoints == 0) // in the odd case that all + _noiseFloorAmplitude = meanAmplitude; // amplitudes are equal! + else + _noiseFloorAmplitude = sumMean / newNumDataPoints; + } + + if(lastOfMultipleUpdatesFlag){ + int tabindex = SpectrumTypeTab->currentIndex(); + if(tabindex == d_plot_fft) { + _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, + _noiseFloorAmplitude, _peakFrequency, + _peakAmplitude, d_update_time); + } + if(tabindex == d_plot_time) { + _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints, + imagTimeDomainDataPoints, + numTimeDomainDataPoints, + d_update_time); + } + if(tabindex == d_plot_constellation) { + _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, + imagTimeDomainDataPoints, + numTimeDomainDataPoints, + d_update_time); + } + + // Don't update the repeated data for the waterfall + if(!repeatDataFlag){ + if(tabindex == d_plot_waterfall) { + _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, + d_update_time, dataTimestamp, + spectrumUpdateEvent->getDroppedFFTFrames()); + } + } + + + // Tell the system the GUI has been updated + if(_systemSpecifiedFlag){ + _system->SetLastGUIUpdateTime(generatedTimestamp); + _system->DecrementPendingGUIUpdateEvents(); + } + } +} + +void +SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) +{ + QSize s; + s.setWidth(FrequencyPlotDisplayFrame->width()); + s.setHeight(FrequencyPlotDisplayFrame->height()); + emit _frequencyDisplayPlot->resizeSlot(&s); + + s.setWidth(TimeDomainDisplayFrame->width()); + s.setHeight(TimeDomainDisplayFrame->height()); + emit _timeDomainDisplayPlot->resizeSlot(&s); + + s.setWidth(WaterfallPlotDisplayFrame->width()); + s.setHeight(WaterfallPlotDisplayFrame->height()); + emit _waterfallDisplayPlot->resizeSlot(&s); + + s.setWidth(ConstellationDisplayFrame->width()); + s.setHeight(ConstellationDisplayFrame->height()); + emit _constellationDisplayPlot->resizeSlot(&s); +} + +void +SpectrumDisplayForm::customEvent( QEvent * e) +{ + if(e->type() == QEvent::User+3){ + if(_systemSpecifiedFlag){ + WindowComboBox->setCurrentIndex(_system->GetWindowType()); + FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex()); + //FFTSizeComboBox->setCurrentIndex(1); + } + + waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); + waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); + + // Clear any previous display + Reset(); + } + else if(e->type() == 10005){ + SpectrumUpdateEvent* spectrumUpdateEvent = (SpectrumUpdateEvent*)e; + newFrequencyData(spectrumUpdateEvent); + } + else if(e->type() == 10008){ + setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel()); + } + else if(e->type() == 10009){ + Reset(); + if(_systemSpecifiedFlag){ + _system->ResetPendingGUIUpdateEvents(); + } + } + else if(e->type() == 10010){ + _startFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStartFrequency(); + _stopFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStopFrequency(); + _centerFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetCenterFrequency(); + + UseRFFrequenciesCB(UseRFFrequenciesCheckBox->isChecked()); + } +} + +void +SpectrumDisplayForm::UpdateGuiTimer() +{ + // This is called by the displayTimer and redraws the canvases of + // all of the plots. + _frequencyDisplayPlot->canvas()->update(); + _waterfallDisplayPlot->canvas()->update(); + _timeDomainDisplayPlot->canvas()->update(); + _constellationDisplayPlot->canvas()->update(); +} + + +void +SpectrumDisplayForm::AvgLineEdit_valueChanged( int value ) +{ + SetAverageCount(value); +} + + +void +SpectrumDisplayForm::MaxHoldCheckBox_toggled( bool newState ) +{ + MaxHoldResetBtn->setEnabled(newState); + _frequencyDisplayPlot->SetMaxFFTVisible(newState); + MaxHoldResetBtn_clicked(); +} + + +void +SpectrumDisplayForm::MinHoldCheckBox_toggled( bool newState ) +{ + MinHoldResetBtn->setEnabled(newState); + _frequencyDisplayPlot->SetMinFFTVisible(newState); + MinHoldResetBtn_clicked(); +} + + +void +SpectrumDisplayForm::MinHoldResetBtn_clicked() +{ + _frequencyDisplayPlot->ClearMinData(); + _frequencyDisplayPlot->replot(); +} + + +void +SpectrumDisplayForm::MaxHoldResetBtn_clicked() +{ + _frequencyDisplayPlot->ClearMaxData(); + _frequencyDisplayPlot->replot(); +} + + +void +SpectrumDisplayForm::TabChanged(int index) +{ + // This might be dangerous to call this with NULL + resizeEvent(NULL); +} + +void +SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency) +{ + double fdiff; + if(UseRFFrequenciesCheckBox->isChecked()) { + fdiff = newCenterFrequency; + } + else { + fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency)); + } + + if(fdiff > 0) { + std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; + std::string strtime[4] = {"sec", "ms", "us", "ns"}; + double units10 = floor(log10(fdiff)); + double units3 = std::max(floor(units10 / 3.0), 0.0); + double units = pow(10, (units10-fmod(units10, 3.0))); + int iunit = static_cast(units3); + + _startFrequency = newStartFrequency; + _stopFrequency = newStopFrequency; + _centerFrequency = newCenterFrequency; + + _frequencyDisplayPlot->SetFrequencyRange(_startFrequency, + _stopFrequency, + _centerFrequency, + UseRFFrequenciesCheckBox->isChecked(), + units, strunits[iunit]); + _waterfallDisplayPlot->SetFrequencyRange(_startFrequency, + _stopFrequency, + _centerFrequency, + UseRFFrequenciesCheckBox->isChecked(), + units, strunits[iunit]); + _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, + units, strtime[iunit]); + } +} + +int +SpectrumDisplayForm::GetAverageCount() +{ + return _historyVector->size(); +} + +void +SpectrumDisplayForm::SetAverageCount(const int newCount) +{ + if(newCount > -1){ + if(newCount != static_cast(_historyVector->size())){ + std::vector::iterator pos; + while(newCount < static_cast(_historyVector->size())){ + pos = _historyVector->begin(); + delete[] (*pos); + _historyVector->erase(pos); + } + + while(newCount > static_cast(_historyVector->size())){ + _historyVector->push_back(new double[_numRealDataPoints]); + } + AverageDataReset(); + } + } +} + +void +SpectrumDisplayForm::_AverageHistory(const double* newBuffer) +{ + if(_numRealDataPoints > 0){ + if(_historyVector->size() > 0){ + memcpy(_historyVector->operator[](_historyEntry), newBuffer, + _numRealDataPoints*sizeof(double)); + + // Increment the next location to store data + _historyEntryCount++; + if(_historyEntryCount > static_cast(_historyVector->size())){ + _historyEntryCount = _historyVector->size(); + } + _historyEntry = (++_historyEntry)%_historyVector->size(); + + // Total up and then average the values + double sum; + for(uint64_t location = 0; location < _numRealDataPoints; location++){ + sum = 0; + for(int number = 0; number < _historyEntryCount; number++){ + sum += _historyVector->operator[](number)[location]; + } + _averagedValues[location] = sum/static_cast(_historyEntryCount); + } + } + else{ + memcpy(_averagedValues, newBuffer, _numRealDataPoints*sizeof(double)); + } + } +} + +void +SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints, + const uint64_t /*numTimeDomainDataPoints*/ ) +{ + // Convert from Complex to Real for certain Displays + if(_numRealDataPoints != numFFTDataPoints){ + _numRealDataPoints = numFFTDataPoints; + delete[] _realFFTDataPoints; + delete[] _averagedValues; + + _realFFTDataPoints = new double[_numRealDataPoints]; + _averagedValues = new double[_numRealDataPoints]; + memset(_realFFTDataPoints, 0x0, _numRealDataPoints*sizeof(double)); + + const int historySize = _historyVector->size(); + SetAverageCount(0); // Clear the existing history + SetAverageCount(historySize); + + Reset(); + } +} + +void +SpectrumDisplayForm::Reset() +{ + AverageDataReset(); + + _waterfallDisplayPlot->Reset(); +} + + +void +SpectrumDisplayForm::AverageDataReset() +{ + _historyEntry = 0; + _historyEntryCount = 0; + + memset(_averagedValues, 0x0, _numRealDataPoints*sizeof(double)); + + MaxHoldResetBtn_clicked(); + MinHoldResetBtn_clicked(); +} + + +void +SpectrumDisplayForm::closeEvent( QCloseEvent *e ) +{ + if(_systemSpecifiedFlag){ + _system->SetWindowOpenFlag(false); + } + + qApp->processEvents(); + + QWidget::closeEvent(e); +} + + +void +SpectrumDisplayForm::WindowTypeChanged( int newItem ) +{ + if(_systemSpecifiedFlag){ + _system->SetWindowType(newItem); + } +} + + +void +SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) +{ + SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); +} + + +void +SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) +{ + if(newValue > WaterfallMinimumIntensityWheel->value()){ + WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); + } + else{ + WaterfallMaximumIntensityWheel->setValue(WaterfallMinimumIntensityWheel->value()); + } + + _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), + WaterfallMaximumIntensityWheel->value()); +} + + +void +SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) +{ + if(newValue < WaterfallMaximumIntensityWheel->value()){ + WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); + } + else{ + WaterfallMinimumIntensityWheel->setValue(WaterfallMaximumIntensityWheel->value()); + } + + _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), + WaterfallMaximumIntensityWheel->value()); +} + +void +SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) +{ + if(_systemSpecifiedFlag){ + _system->SetFFTSize(fftSizeString.toLong()); + } +} + + +void +SpectrumDisplayForm::WaterfallAutoScaleBtnCB() +{ + double minimumIntensity = _noiseFloorAmplitude - 5; + if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){ + minimumIntensity = WaterfallMinimumIntensityWheel->minValue(); + } + WaterfallMinimumIntensityWheel->setValue(minimumIntensity); + double maximumIntensity = _peakAmplitude + 10; + if(maximumIntensity > WaterfallMaximumIntensityWheel->maxValue()){ + maximumIntensity = WaterfallMaximumIntensityWheel->maxValue(); + } + WaterfallMaximumIntensityWheel->setValue(maximumIntensity); + waterfallMaximumIntensityChangedCB(maximumIntensity); +} + +void +SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) +{ + QColor lowIntensityColor; + QColor highIntensityColor; + if(newType == WaterfallDisplayPlot::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); + } + + _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor); +} + +void +SpectrumDisplayForm::ToggleTabFrequency(const bool state) +{ + if(state == true) { + if(d_plot_fft == -1) { + SpectrumTypeTab->addTab(FrequencyPage, "Frequency Display"); + d_plot_fft = SpectrumTypeTab->count()-1; + } + } + else { + SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(FrequencyPage)); + d_plot_fft = -1; + } +} + +void +SpectrumDisplayForm::ToggleTabWaterfall(const bool state) +{ + if(state == true) { + if(d_plot_waterfall == -1) { + SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display"); + d_plot_waterfall = SpectrumTypeTab->count()-1; + } + } + else { + SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage)); + d_plot_waterfall = -1; + } +} + +void +SpectrumDisplayForm::ToggleTabTime(const bool state) +{ + if(state == true) { + if(d_plot_time == -1) { + SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display"); + d_plot_time = SpectrumTypeTab->count()-1; + } + } + else { + SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage)); + d_plot_time = -1; + } +} + +void +SpectrumDisplayForm::ToggleTabConstellation(const bool state) +{ + if(state == true) { + if(d_plot_constellation == -1) { + SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display"); + d_plot_constellation = SpectrumTypeTab->count()-1; + } + } + else { + SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage)); + d_plot_constellation = -1; + } +} + + +void +SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) +{ + _timeDomainDisplayPlot->set_yaxis(min, max); +} + +void +SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax, + double ymin, double ymax) +{ + _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); +} + +void +SpectrumDisplayForm::SetConstellationPenSize(int size) +{ + _constellationDisplayPlot->set_pen_size( size ); +} + +void +SpectrumDisplayForm::SetFrequencyAxis(double min, double max) +{ + _frequencyDisplayPlot->set_yaxis(min, max); +} + +void +SpectrumDisplayForm::SetUpdateTime(double t) +{ + d_update_time = t; + // QTimer class takes millisecond input + displayTimer->start(d_update_time*1000); +} -- cgit From 7563ab82b34600219daf45555a00de79dd254fdb Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 19:21:58 -0400 Subject: gr-qtgui: tightening up and cleaning up some memory leaks. --- gr-qtgui/lib/spectrumdisplayform.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index e0509a294..b5d4bf4d7 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -74,6 +74,11 @@ SpectrumDisplayForm::~SpectrumDisplayForm() delete[] _realFFTDataPoints; delete[] _averagedValues; + delete _frequencyDisplayPlot; + delete _waterfallDisplayPlot; + delete _timeDomainDisplayPlot; + delete _constellationDisplayPlot; + for(unsigned int count = 0; count < _historyVector->size(); count++){ delete[] _historyVector->operator[](count); } -- cgit From 2653d20527b9c8b431b9bfcd396bc2a03a8a950b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 1 Apr 2011 10:59:33 -0400 Subject: gr-qtgui: wip trying to figure out segfaults. --- gr-qtgui/lib/spectrumdisplayform.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index b5d4bf4d7..d85637a67 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -74,10 +74,10 @@ SpectrumDisplayForm::~SpectrumDisplayForm() delete[] _realFFTDataPoints; delete[] _averagedValues; - delete _frequencyDisplayPlot; - delete _waterfallDisplayPlot; - delete _timeDomainDisplayPlot; - delete _constellationDisplayPlot; + //delete _frequencyDisplayPlot; + //delete _waterfallDisplayPlot; + //delete _timeDomainDisplayPlot; + //delete _constellationDisplayPlot; for(unsigned int count = 0; count < _historyVector->size(); count++){ delete[] _historyVector->operator[](count); -- cgit From b0f876b55549db96920c2b3bfee32de6748096af Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 6 Apr 2011 00:07:00 -0400 Subject: gr-qtgui: cleaning up unnecessary plotting calls. --- gr-qtgui/lib/spectrumdisplayform.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index d85637a67..d4fc03781 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -59,6 +59,9 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) ToggleTabTime(false); ToggleTabConstellation(false); + _historyEntry = 0; + _historyEntryCount = 0; + // Create a timer to update plots at the specified rate displayTimer = new QTimer(this); connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer())); @@ -74,11 +77,6 @@ SpectrumDisplayForm::~SpectrumDisplayForm() delete[] _realFFTDataPoints; delete[] _averagedValues; - //delete _frequencyDisplayPlot; - //delete _waterfallDisplayPlot; - //delete _timeDomainDisplayPlot; - //delete _constellationDisplayPlot; - for(unsigned int count = 0; count < _historyVector->size(); count++){ delete[] _historyVector->operator[](count); } -- cgit From 8f53f5a782a6500d191ba557b37e7e3785cf6e02 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 6 Apr 2011 00:22:29 -0400 Subject: gr-qtgui: removing references to 3D waterfall plot and changning QtGui API to remove bool that turns it on/off. --- gr-qtgui/lib/spectrumdisplayform.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index d4fc03781..101bbc52b 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -3,8 +3,6 @@ #include #include -int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1; - SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) : QWidget(parent) { -- cgit From c4050c5bdb55ce14565d0ade84bd518cc8c27ec5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 10 Apr 2011 17:13:15 -0400 Subject: gr-qtgui: removed OpenGL calls; we still link against the QTOPENGL_LIBS because of some dependencies in Qwt. --- gr-qtgui/lib/spectrumdisplayform.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 101bbc52b..804dbdd62 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -3,12 +3,11 @@ #include #include -SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) +SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QWidget(parent) { setupUi(this); - _useOpenGL = useOpenGL; _systemSpecifiedFlag = false; _intValidator = new QIntValidator(this); _intValidator->setBottom(0); -- cgit From 117bf31ca76a2751f7e9dfd06860211b7fc14205 Mon Sep 17 00:00:00 2001 From: Mike Cornelius Date: Tue, 12 Apr 2011 21:55:51 -0400 Subject: gr-qtgui: exposing double-click events through spectrumdisplayform and through to Python. --- gr-qtgui/lib/spectrumdisplayform.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 804dbdd62..238c9889f 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -62,6 +62,19 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) // Create a timer to update plots at the specified rate displayTimer = new QTimer(this); connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer())); + + // Connect double click signals up + connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onFFTPlotPointSelected(const QPointF))); + + connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onWFallPlotPointSelected(const QPointF))); + + connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onTimePlotPointSelected(const QPointF))); + + connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onConstPlotPointSelected(const QPointF))); } SpectrumDisplayForm::~SpectrumDisplayForm() @@ -689,3 +702,27 @@ SpectrumDisplayForm::SetUpdateTime(double t) // QTimer class takes millisecond input displayTimer->start(d_update_time*1000); } + +void +SpectrumDisplayForm::onFFTPlotPointSelected(const QPointF p) +{ + emit plotPointSelected(p, 1); +} + +void +SpectrumDisplayForm::onWFallPlotPointSelected(const QPointF p) +{ + emit plotPointSelected(p, 2); +} + +void +SpectrumDisplayForm::onTimePlotPointSelected(const QPointF p) +{ + emit plotPointSelected(p, 3); +} + +void +SpectrumDisplayForm::onConstPlotPointSelected(const QPointF p) +{ + emit plotPointSelected(p, 4); +} -- cgit From 7ba2647977f9b302969208fa8548d1ca8dcddd4b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 18 Apr 2011 23:07:31 -0400 Subject: gr-qtgui: adding copyright dates to qtgui files. --- gr-qtgui/lib/spectrumdisplayform.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 238c9889f..acc7a209d 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -1,3 +1,25 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + #include #include #include -- cgit From 01f44f64c916b4aa38bc81662d2c8b82c4cc0b57 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 14:30:32 -0400 Subject: gr-qtgui: moving towards allowing time plot to have multiple connections. --- gr-qtgui/lib/spectrumdisplayform.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index acc7a209d..2c666871d 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -36,7 +36,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame); + _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; _realFFTDataPoints = new double[_numRealDataPoints]; @@ -232,11 +232,15 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate _peakAmplitude, d_update_time); } if(tabindex == d_plot_time) { - _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints, - imagTimeDomainDataPoints, + _timeDomainDisplayPlot->PlotNewData(0, + realTimeDomainDataPoints, numTimeDomainDataPoints, d_update_time); - } + _timeDomainDisplayPlot->PlotNewData(1, + imagTimeDomainDataPoints, + numTimeDomainDataPoints, + d_update_time); + } if(tabindex == d_plot_constellation) { _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, imagTimeDomainDataPoints, -- cgit From 0877adb2e194c9dfad2484519b2979e2bed93958 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 15:11:17 -0400 Subject: gr-qtgui: Passing vectors of data to update plot for stability; also moving responsibility of keeping track of plot updates out to qtgui_sink instead of inside plot qidget. --- gr-qtgui/lib/spectrumdisplayform.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 2c666871d..2d2d8648f 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -141,13 +141,17 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate //_lastSpectrumEvent = (SpectrumUpdateEvent)(*spectrumUpdateEvent); const std::complex* complexDataPoints = spectrumUpdateEvent->getFFTPoints(); const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints(); - const double* realTimeDomainDataPoints = spectrumUpdateEvent->getRealTimeDomainPoints(); - const double* imagTimeDomainDataPoints = spectrumUpdateEvent->getImagTimeDomainPoints(); const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints(); const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag(); const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag(); const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); + double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints(); + double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints(); + + std::vector timeDomainDataPoints; + timeDomainDataPoints.push_back(realTimeDomainDataPoints); + timeDomainDataPoints.push_back(imagTimeDomainDataPoints); // REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true... ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); @@ -232,14 +236,9 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate _peakAmplitude, d_update_time); } if(tabindex == d_plot_time) { - _timeDomainDisplayPlot->PlotNewData(0, - realTimeDomainDataPoints, + _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, numTimeDomainDataPoints, d_update_time); - _timeDomainDisplayPlot->PlotNewData(1, - imagTimeDomainDataPoints, - numTimeDomainDataPoints, - d_update_time); } if(tabindex == d_plot_constellation) { _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, -- cgit From 43a3a7296412dc52216e7f63856a86945f4ba438 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 24 Apr 2011 01:30:08 -0400 Subject: gr-qtgui: clean up --- gr-qtgui/lib/spectrumdisplayform.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 2d2d8648f..991f51f47 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -43,6 +43,9 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector; + _timeDomainDisplayPlot->setTitle(0, "real"); + _timeDomainDisplayPlot->setTitle(1, "imag"); + AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); MaxHoldCheckBox_toggled( false ); @@ -698,7 +701,7 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) void SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) { - _timeDomainDisplayPlot->set_yaxis(min, max); + _timeDomainDisplayPlot->setYaxis(min, max); } void -- cgit From 697562c3d4319ab6f13e4c2910a853409731595d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 21:48:02 -0400 Subject: qtgui: replace timespec with typedef so its easier to replace --- gr-qtgui/lib/spectrumdisplayform.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 991f51f47..df1903391 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -145,10 +145,10 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate const std::complex* complexDataPoints = spectrumUpdateEvent->getFFTPoints(); const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints(); const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints(); - const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); + const highres_timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag(); const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag(); - const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); + const highres_timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints(); double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints(); -- cgit From bbf11bb338a4a88a1f270f77649212fea0b0cab0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 22:55:41 -0400 Subject: qtgui: removed all traces of highResTimeFunctions.h --- gr-qtgui/lib/spectrumdisplayform.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index df1903391..0e8594029 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -145,10 +145,10 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate const std::complex* complexDataPoints = spectrumUpdateEvent->getFFTPoints(); const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints(); const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints(); - const highres_timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); + const gruel::high_res_timer_type dataTimestamp = spectrumUpdateEvent->getDataTimestamp(); const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag(); const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag(); - const highres_timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); + const gruel::high_res_timer_type generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp(); double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints(); double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints(); -- cgit From 32ef4974395913878f252434c21a63a259bb9b97 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 15 Oct 2011 16:32:35 -0400 Subject: qtgui: avoids a simple warning. --- gr-qtgui/lib/spectrumdisplayform.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 0e8594029..d3ca01483 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -466,7 +466,8 @@ SpectrumDisplayForm::_AverageHistory(const double* newBuffer) if(_historyEntryCount > static_cast(_historyVector->size())){ _historyEntryCount = _historyVector->size(); } - _historyEntry = (++_historyEntry)%_historyVector->size(); + _historyEntry += 1; + _historyEntry = _historyEntry % _historyVector->size(); // Total up and then average the values double sum; -- cgit From 25fd6e0324dc8296b66a3c9b8e628d6738f15fe7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 15 Oct 2011 18:23:04 -0400 Subject: qtgui: wip: updating qtgui to work with QWT 6 (and trying to maintain backwards compatability to 5.2). This wip works for just the fft plots. --- gr-qtgui/lib/spectrumdisplayform.cc | 87 ++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 34 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index d3ca01483..f52f96241 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -34,37 +34,37 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _intValidator = new QIntValidator(this); _intValidator->setBottom(0); _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); - _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); + //_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); - _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); + //_timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); + //_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector; - _timeDomainDisplayPlot->setTitle(0, "real"); - _timeDomainDisplayPlot->setTitle(1, "imag"); + //_timeDomainDisplayPlot->setTitle(0, "real"); + //_timeDomainDisplayPlot->setTitle(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); MaxHoldCheckBox_toggled( false ); - WaterfallMaximumIntensityWheel->setRange(-200, 0); - WaterfallMaximumIntensityWheel->setTickCnt(50); - WaterfallMinimumIntensityWheel->setRange(-200, 0); - WaterfallMinimumIntensityWheel->setTickCnt(50); - WaterfallMinimumIntensityWheel->setValue(-200); + //WaterfallMaximumIntensityWheel->setRange(-200, 0); + //WaterfallMaximumIntensityWheel->setTickCnt(50); + //WaterfallMinimumIntensityWheel->setRange(-200, 0); + //WaterfallMinimumIntensityWheel->setTickCnt(50); + //WaterfallMinimumIntensityWheel->setValue(-200); _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; _noiseFloorAmplitude = -HUGE_VAL; - connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), - _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); - connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), - _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); + //connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), + // _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); + //connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), + // _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); _frequencyDisplayPlot->SetLowerIntensityLevel(-200); _frequencyDisplayPlot->SetUpperIntensityLevel(-200); @@ -77,9 +77,9 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) Reset(); ToggleTabFrequency(false); - ToggleTabWaterfall(false); - ToggleTabTime(false); - ToggleTabConstellation(false); + //ToggleTabWaterfall(false); + //ToggleTabTime(false); + //ToggleTabConstellation(false); _historyEntry = 0; _historyEntryCount = 0; @@ -90,16 +90,16 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) // Connect double click signals up connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onFFTPlotPointSelected(const QPointF))); + this, SLOT(onFFTPlotPointSelected(const QPointF))); - connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onWFallPlotPointSelected(const QPointF))); + //connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onWFallPlotPointSelected(const QPointF))); - connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onTimePlotPointSelected(const QPointF))); + //connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onTimePlotPointSelected(const QPointF))); - connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onConstPlotPointSelected(const QPointF))); + //connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onConstPlotPointSelected(const QPointF))); } SpectrumDisplayForm::~SpectrumDisplayForm() @@ -238,6 +238,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate _noiseFloorAmplitude, _peakFrequency, _peakAmplitude, d_update_time); } + /* if(tabindex == d_plot_time) { _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, numTimeDomainDataPoints, @@ -258,7 +259,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate spectrumUpdateEvent->getDroppedFFTFrames()); } } - + */ // Tell the system the GUI has been updated if(_systemSpecifiedFlag){ @@ -276,6 +277,7 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(FrequencyPlotDisplayFrame->height()); emit _frequencyDisplayPlot->resizeSlot(&s); + /* s.setWidth(TimeDomainDisplayFrame->width()); s.setHeight(TimeDomainDisplayFrame->height()); emit _timeDomainDisplayPlot->resizeSlot(&s); @@ -287,6 +289,7 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); emit _constellationDisplayPlot->resizeSlot(&s); + */ } void @@ -299,8 +302,8 @@ SpectrumDisplayForm::customEvent( QEvent * e) //FFTSizeComboBox->setCurrentIndex(1); } - waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); - waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); + //waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); + //waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); // Clear any previous display Reset(); @@ -333,9 +336,9 @@ SpectrumDisplayForm::UpdateGuiTimer() // This is called by the displayTimer and redraws the canvases of // all of the plots. _frequencyDisplayPlot->canvas()->update(); - _waterfallDisplayPlot->canvas()->update(); - _timeDomainDisplayPlot->canvas()->update(); - _constellationDisplayPlot->canvas()->update(); + //_waterfallDisplayPlot->canvas()->update(); + //_timeDomainDisplayPlot->canvas()->update(); + //_constellationDisplayPlot->canvas()->update(); } @@ -417,6 +420,7 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); + /* _waterfallDisplayPlot->SetFrequencyRange(_startFrequency, _stopFrequency, _centerFrequency, @@ -424,6 +428,7 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, units, strunits[iunit]); _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); + */ } } @@ -512,7 +517,7 @@ SpectrumDisplayForm::Reset() { AverageDataReset(); - _waterfallDisplayPlot->Reset(); + //_waterfallDisplayPlot->Reset(); } @@ -561,6 +566,7 @@ SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) void SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) { + /* if(newValue > WaterfallMinimumIntensityWheel->value()){ WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -570,12 +576,14 @@ SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); + */ } void SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) { + /* if(newValue < WaterfallMaximumIntensityWheel->value()){ WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -585,6 +593,7 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); + */ } void @@ -599,6 +608,7 @@ SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) void SpectrumDisplayForm::WaterfallAutoScaleBtnCB() { + /* double minimumIntensity = _noiseFloorAmplitude - 5; if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){ minimumIntensity = WaterfallMinimumIntensityWheel->minValue(); @@ -610,11 +620,13 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } WaterfallMaximumIntensityWheel->setValue(maximumIntensity); waterfallMaximumIntensityChangedCB(maximumIntensity); + */ } void SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) { + /* QColor lowIntensityColor; QColor highIntensityColor; if(newType == WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ @@ -636,6 +648,7 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor); + */ } void @@ -656,6 +669,7 @@ SpectrumDisplayForm::ToggleTabFrequency(const bool state) void SpectrumDisplayForm::ToggleTabWaterfall(const bool state) { + /* if(state == true) { if(d_plot_waterfall == -1) { SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display"); @@ -666,11 +680,13 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage)); d_plot_waterfall = -1; } + */ } void SpectrumDisplayForm::ToggleTabTime(const bool state) { + /* if(state == true) { if(d_plot_time == -1) { SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display"); @@ -681,11 +697,13 @@ SpectrumDisplayForm::ToggleTabTime(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage)); d_plot_time = -1; } + */ } void SpectrumDisplayForm::ToggleTabConstellation(const bool state) { + /* if(state == true) { if(d_plot_constellation == -1) { SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display"); @@ -696,26 +714,27 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage)); d_plot_constellation = -1; } + */ } void SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) { - _timeDomainDisplayPlot->setYaxis(min, max); + //_timeDomainDisplayPlot->setYaxis(min, max); } void SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax, double ymin, double ymax) { - _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); + //_constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); } void SpectrumDisplayForm::SetConstellationPenSize(int size) { - _constellationDisplayPlot->set_pen_size( size ); + //_constellationDisplayPlot->set_pen_size( size ); } void -- cgit From 33158da478cb0db5739663556e8dbeccbf08d7c9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 16 Oct 2011 00:19:10 -0400 Subject: qtgui: Time domain plot working againt under qwt6. --- gr-qtgui/lib/spectrumdisplayform.cc | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index f52f96241..8c9cc085f 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. + * Copyright 2008-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -35,16 +35,15 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _intValidator->setBottom(0); _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); //_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - - //_timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); + _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); //_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector; - //_timeDomainDisplayPlot->setTitle(0, "real"); - //_timeDomainDisplayPlot->setTitle(1, "imag"); + _timeDomainDisplayPlot->setTitle(0, "real"); + _timeDomainDisplayPlot->setTitle(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); @@ -78,7 +77,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) ToggleTabFrequency(false); //ToggleTabWaterfall(false); - //ToggleTabTime(false); + ToggleTabTime(false); //ToggleTabConstellation(false); _historyEntry = 0; @@ -95,8 +94,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) //connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), // this, SLOT(onWFallPlotPointSelected(const QPointF))); - //connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - // this, SLOT(onTimePlotPointSelected(const QPointF))); + connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onTimePlotPointSelected(const QPointF))); //connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), // this, SLOT(onConstPlotPointSelected(const QPointF))); @@ -238,12 +237,12 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate _noiseFloorAmplitude, _peakFrequency, _peakAmplitude, d_update_time); } - /* if(tabindex == d_plot_time) { _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, numTimeDomainDataPoints, d_update_time); - } + } + /* if(tabindex == d_plot_constellation) { _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, imagTimeDomainDataPoints, @@ -277,11 +276,11 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(FrequencyPlotDisplayFrame->height()); emit _frequencyDisplayPlot->resizeSlot(&s); - /* s.setWidth(TimeDomainDisplayFrame->width()); s.setHeight(TimeDomainDisplayFrame->height()); emit _timeDomainDisplayPlot->resizeSlot(&s); + /* s.setWidth(WaterfallPlotDisplayFrame->width()); s.setHeight(WaterfallPlotDisplayFrame->height()); emit _waterfallDisplayPlot->resizeSlot(&s); @@ -337,7 +336,7 @@ SpectrumDisplayForm::UpdateGuiTimer() // all of the plots. _frequencyDisplayPlot->canvas()->update(); //_waterfallDisplayPlot->canvas()->update(); - //_timeDomainDisplayPlot->canvas()->update(); + _timeDomainDisplayPlot->canvas()->update(); //_constellationDisplayPlot->canvas()->update(); } @@ -426,9 +425,9 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); + */ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); - */ } } @@ -686,7 +685,6 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) void SpectrumDisplayForm::ToggleTabTime(const bool state) { - /* if(state == true) { if(d_plot_time == -1) { SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display"); @@ -697,7 +695,6 @@ SpectrumDisplayForm::ToggleTabTime(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage)); d_plot_time = -1; } - */ } void @@ -721,7 +718,7 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) void SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) { - //_timeDomainDisplayPlot->setYaxis(min, max); + _timeDomainDisplayPlot->setYaxis(min, max); } void -- cgit From 4ba2c75f9109b750f8c04b60a04f2100e33e9416 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 16 Oct 2011 00:23:32 -0400 Subject: qtgui: constellation plot working again under qwt6. --- gr-qtgui/lib/spectrumdisplayform.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 8c9cc085f..6f82c03ff 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -36,7 +36,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); //_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); - //_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); + _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; @@ -78,7 +78,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) ToggleTabFrequency(false); //ToggleTabWaterfall(false); ToggleTabTime(false); - //ToggleTabConstellation(false); + ToggleTabConstellation(false); _historyEntry = 0; _historyEntryCount = 0; @@ -97,8 +97,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onTimePlotPointSelected(const QPointF))); - //connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - // this, SLOT(onConstPlotPointSelected(const QPointF))); + connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onConstPlotPointSelected(const QPointF))); } SpectrumDisplayForm::~SpectrumDisplayForm() @@ -242,7 +242,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate numTimeDomainDataPoints, d_update_time); } - /* if(tabindex == d_plot_constellation) { _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, imagTimeDomainDataPoints, @@ -250,6 +249,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate d_update_time); } + /* // Don't update the repeated data for the waterfall if(!repeatDataFlag){ if(tabindex == d_plot_waterfall) { @@ -284,11 +284,11 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setWidth(WaterfallPlotDisplayFrame->width()); s.setHeight(WaterfallPlotDisplayFrame->height()); emit _waterfallDisplayPlot->resizeSlot(&s); + */ s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); emit _constellationDisplayPlot->resizeSlot(&s); - */ } void @@ -337,7 +337,7 @@ SpectrumDisplayForm::UpdateGuiTimer() _frequencyDisplayPlot->canvas()->update(); //_waterfallDisplayPlot->canvas()->update(); _timeDomainDisplayPlot->canvas()->update(); - //_constellationDisplayPlot->canvas()->update(); + _constellationDisplayPlot->canvas()->update(); } @@ -700,7 +700,6 @@ SpectrumDisplayForm::ToggleTabTime(const bool state) void SpectrumDisplayForm::ToggleTabConstellation(const bool state) { - /* if(state == true) { if(d_plot_constellation == -1) { SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display"); @@ -711,7 +710,6 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage)); d_plot_constellation = -1; } - */ } @@ -725,13 +723,13 @@ void SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax, double ymin, double ymax) { - //_constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); + _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); } void SpectrumDisplayForm::SetConstellationPenSize(int size) { - //_constellationDisplayPlot->set_pen_size( size ); + _constellationDisplayPlot->set_pen_size( size ); } void -- cgit From 4496fae2deea200755225c007a26f4c7be0470e9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 16 Oct 2011 16:32:41 -0400 Subject: qtgui: waterfall plot mostly working under qwt6 (plots, but updates to scale and color not working yet). --- gr-qtgui/lib/spectrumdisplayform.cc | 51 +++++++++++++------------------------ 1 file changed, 17 insertions(+), 34 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 6f82c03ff..9fe553557 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -34,7 +34,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _intValidator = new QIntValidator(this); _intValidator->setBottom(0); _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); - //_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); + _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; @@ -49,21 +49,21 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) MinHoldCheckBox_toggled( false ); MaxHoldCheckBox_toggled( false ); - //WaterfallMaximumIntensityWheel->setRange(-200, 0); - //WaterfallMaximumIntensityWheel->setTickCnt(50); - //WaterfallMinimumIntensityWheel->setRange(-200, 0); - //WaterfallMinimumIntensityWheel->setTickCnt(50); - //WaterfallMinimumIntensityWheel->setValue(-200); + WaterfallMaximumIntensityWheel->setRange(-200, 0); + WaterfallMaximumIntensityWheel->setTickCnt(50); + WaterfallMinimumIntensityWheel->setRange(-200, 0); + WaterfallMinimumIntensityWheel->setTickCnt(50); + WaterfallMinimumIntensityWheel->setValue(-200); _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; _noiseFloorAmplitude = -HUGE_VAL; - //connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), - // _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); - //connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), - // _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); + connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), + _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); + connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), + _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); _frequencyDisplayPlot->SetLowerIntensityLevel(-200); _frequencyDisplayPlot->SetUpperIntensityLevel(-200); @@ -76,7 +76,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) Reset(); ToggleTabFrequency(false); - //ToggleTabWaterfall(false); + ToggleTabWaterfall(false); ToggleTabTime(false); ToggleTabConstellation(false); @@ -91,8 +91,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onFFTPlotPointSelected(const QPointF))); - //connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - // this, SLOT(onWFallPlotPointSelected(const QPointF))); + connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + this, SLOT(onWFallPlotPointSelected(const QPointF))); connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onTimePlotPointSelected(const QPointF))); @@ -249,7 +249,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate d_update_time); } - /* // Don't update the repeated data for the waterfall if(!repeatDataFlag){ if(tabindex == d_plot_waterfall) { @@ -258,7 +257,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate spectrumUpdateEvent->getDroppedFFTFrames()); } } - */ // Tell the system the GUI has been updated if(_systemSpecifiedFlag){ @@ -280,11 +278,9 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(TimeDomainDisplayFrame->height()); emit _timeDomainDisplayPlot->resizeSlot(&s); - /* s.setWidth(WaterfallPlotDisplayFrame->width()); s.setHeight(WaterfallPlotDisplayFrame->height()); emit _waterfallDisplayPlot->resizeSlot(&s); - */ s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); @@ -298,11 +294,10 @@ SpectrumDisplayForm::customEvent( QEvent * e) if(_systemSpecifiedFlag){ WindowComboBox->setCurrentIndex(_system->GetWindowType()); FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex()); - //FFTSizeComboBox->setCurrentIndex(1); } - //waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); - //waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); + waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); + waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); // Clear any previous display Reset(); @@ -335,7 +330,7 @@ SpectrumDisplayForm::UpdateGuiTimer() // This is called by the displayTimer and redraws the canvases of // all of the plots. _frequencyDisplayPlot->canvas()->update(); - //_waterfallDisplayPlot->canvas()->update(); + _waterfallDisplayPlot->canvas()->update(); _timeDomainDisplayPlot->canvas()->update(); _constellationDisplayPlot->canvas()->update(); } @@ -419,13 +414,11 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); - /* _waterfallDisplayPlot->SetFrequencyRange(_startFrequency, _stopFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); - */ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); } @@ -516,7 +509,7 @@ SpectrumDisplayForm::Reset() { AverageDataReset(); - //_waterfallDisplayPlot->Reset(); + _waterfallDisplayPlot->Reset(); } @@ -565,7 +558,6 @@ SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) void SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) { - /* if(newValue > WaterfallMinimumIntensityWheel->value()){ WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -575,14 +567,12 @@ SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); - */ } void SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) { - /* if(newValue < WaterfallMaximumIntensityWheel->value()){ WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -592,7 +582,6 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); - */ } void @@ -607,7 +596,6 @@ SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) void SpectrumDisplayForm::WaterfallAutoScaleBtnCB() { - /* double minimumIntensity = _noiseFloorAmplitude - 5; if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){ minimumIntensity = WaterfallMinimumIntensityWheel->minValue(); @@ -619,13 +607,11 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } WaterfallMaximumIntensityWheel->setValue(maximumIntensity); waterfallMaximumIntensityChangedCB(maximumIntensity); - */ } void SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) { - /* QColor lowIntensityColor; QColor highIntensityColor; if(newType == WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ @@ -647,7 +633,6 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor); - */ } void @@ -668,7 +653,6 @@ SpectrumDisplayForm::ToggleTabFrequency(const bool state) void SpectrumDisplayForm::ToggleTabWaterfall(const bool state) { - /* if(state == true) { if(d_plot_waterfall == -1) { SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display"); @@ -679,7 +663,6 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage)); d_plot_waterfall = -1; } - */ } void -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- gr-qtgui/lib/spectrumdisplayform.cc | 72 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'gr-qtgui/lib/spectrumdisplayform.cc') diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 9fe553557..dd9011dbd 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2008-2011 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -41,30 +41,30 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector; - + _timeDomainDisplayPlot->setTitle(0, "real"); _timeDomainDisplayPlot->setTitle(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); MaxHoldCheckBox_toggled( false ); - + WaterfallMaximumIntensityWheel->setRange(-200, 0); WaterfallMaximumIntensityWheel->setTickCnt(50); WaterfallMinimumIntensityWheel->setRange(-200, 0); WaterfallMinimumIntensityWheel->setTickCnt(50); WaterfallMinimumIntensityWheel->setValue(-200); - + _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; - + _noiseFloorAmplitude = -HUGE_VAL; - connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), + connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); - connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), + connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); - + _frequencyDisplayPlot->SetLowerIntensityLevel(-200); _frequencyDisplayPlot->SetUpperIntensityLevel(-200); @@ -90,13 +90,13 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) // Connect double click signals up connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onFFTPlotPointSelected(const QPointF))); - + connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onWFallPlotPointSelected(const QPointF))); - + connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onTimePlotPointSelected(const QPointF))); - + connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onConstPlotPointSelected(const QPointF))); } @@ -122,12 +122,12 @@ SpectrumDisplayForm::~SpectrumDisplayForm() } void -SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem, - const uint64_t numFFTDataPoints, +SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem, + const uint64_t numFFTDataPoints, const uint64_t numTimeDomainDataPoints ) { ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); - + if(newSystem != NULL){ _system = newSystem; _systemSpecifiedFlag = true; @@ -179,12 +179,12 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate localPeakAmplitude = *realFFTDataPointsPtr; } sumMean += *realFFTDataPointsPtr; - + complexDataPointsPtr++; realFFTDataPointsPtr++; } - - // This loop takes the first half of the input data and puts it in the + + // This loop takes the first half of the input data and puts it in the // second half of the plotted data complexDataPointsPtr = complexDataPoints; for(uint64_t point = 0; point < numFFTDataPoints/2; point++){ @@ -233,18 +233,18 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate if(lastOfMultipleUpdatesFlag){ int tabindex = SpectrumTypeTab->currentIndex(); if(tabindex == d_plot_fft) { - _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, - _noiseFloorAmplitude, _peakFrequency, + _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, + _noiseFloorAmplitude, _peakFrequency, _peakAmplitude, d_update_time); } if(tabindex == d_plot_time) { - _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, + _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, numTimeDomainDataPoints, d_update_time); } if(tabindex == d_plot_constellation) { - _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, - imagTimeDomainDataPoints, + _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, + imagTimeDomainDataPoints, numTimeDomainDataPoints, d_update_time); } @@ -252,12 +252,12 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate // Don't update the repeated data for the waterfall if(!repeatDataFlag){ if(tabindex == d_plot_waterfall) { - _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, - d_update_time, dataTimestamp, + _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, + d_update_time, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames()); } } - + // Tell the system the GUI has been updated if(_systemSpecifiedFlag){ _system->SetLastGUIUpdateTime(generatedTimestamp); @@ -381,12 +381,12 @@ void SpectrumDisplayForm::TabChanged(int index) { // This might be dangerous to call this with NULL - resizeEvent(NULL); + resizeEvent(NULL); } void SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, + const double newStartFrequency, const double newStopFrequency) { double fdiff; @@ -404,7 +404,7 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, double units3 = std::max(floor(units10 / 3.0), 0.0); double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast(units3); - + _startFrequency = newStartFrequency; _stopFrequency = newStopFrequency; _centerFrequency = newCenterFrequency; @@ -491,15 +491,15 @@ SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints, _numRealDataPoints = numFFTDataPoints; delete[] _realFFTDataPoints; delete[] _averagedValues; - + _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; memset(_realFFTDataPoints, 0x0, _numRealDataPoints*sizeof(double)); - + const int historySize = _historyVector->size(); SetAverageCount(0); // Clear the existing history SetAverageCount(historySize); - + Reset(); } } @@ -622,7 +622,7 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } 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()){ @@ -631,7 +631,7 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) 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); } - + _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor); } -- cgit