diff options
Diffstat (limited to 'gr-qtgui/src')
25 files changed, 704 insertions, 597 deletions
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc index 80bf4503f..e8e6288f5 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc @@ -26,8 +26,8 @@ public: protected: virtual QwtText trackerText( const QwtDoublePoint& p ) const { - QwtText t(QString("Sample %1, %2 V").arg(p.x(), 0, 'f', 0).arg(p.y(), 0, 'f', 4)); - + QwtText t(QString("(%1, %2)").arg(p.x(), 0, 'f', 4). + arg(p.y(), 0, 'f', 4)); return t; } }; @@ -39,8 +39,6 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) resize(parent->width(), parent->height()); - _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates - _numPoints = 1024; _penSize = 5; _realDataPoints = new double[_numPoints]; @@ -58,12 +56,10 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) canvas()->setPalette(palette); setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); - //setAxisScale(QwtPlot::xBottom, -1.0, 1.0); set_xaxis(-2.0, 2.0); setAxisTitle(QwtPlot::xBottom, "In-phase"); setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - //setAxisScale(QwtPlot::yLeft, -1.0, 1.0); set_yaxis(-2.0, 2.0); setAxisTitle(QwtPlot::yLeft, "Quadrature"); @@ -148,19 +144,9 @@ ConstellationDisplayPlot::set_axis(double xmin, double xmax, set_yaxis(ymin, ymax); } -void ConstellationDisplayPlot::replot(){ - - const timespec startTime = get_highres_clock(); - +void ConstellationDisplayPlot::replot() +{ QwtPlot::replot(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - differenceTime *= 99.0; - // Require at least a 10% duty cycle - if(differenceTime > (1.0/10.0)){ - _displayIntervalTime = differenceTime; - } } void @@ -171,10 +157,12 @@ ConstellationDisplayPlot::resizeSlot( QSize *s ) void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, const double* imagDataPoints, - const int64_t numDataPoints) + const int64_t numDataPoints, + const double timeInterval) { - if(numDataPoints > 0){ - + if((numDataPoints > 0) && + (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) { + if(numDataPoints != _numPoints){ _numPoints = numDataPoints; @@ -185,17 +173,12 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints); } + memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double)); - } - - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - // Only replot the screen if it is visible - if(isVisible()){ - replot(); - } + replot(); + _lastReplot = get_highres_clock(); } } diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/src/lib/ConstellationDisplayPlot.h index 99ae566e0..a441a8bfe 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.h @@ -24,7 +24,8 @@ public: void PlotNewData(const double* realDataPoints, const double* imagDataPoints, - const int64_t numDataPoints); + const int64_t numDataPoints, + const double timeInterval); virtual void replot(); @@ -55,8 +56,6 @@ private: int64_t _numPoints; int64_t _penSize; - - double _displayIntervalTime; }; #endif /* CONSTELLATION_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc index 7deff8543..f2cde322e 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc @@ -73,15 +73,22 @@ public: updateDisplay(); } + void SetUnitType(const std::string &type) + { + _unitType = type; + } + protected: virtual QwtText trackerText( const QwtDoublePoint& p ) const { - QString strunits = (GetFrequencyPrecision() == 0) ? "Hz" : "kHz"; - QwtText t(QString("%1 %2, %3 dB").arg(p.x(), 0, 'f', - GetFrequencyPrecision()).arg(strunits).arg(p.y(), 0, 'f', 2)); - + QwtText t(QString("%1 %2, %3 dB"). + arg(p.x(), 0, 'f', GetFrequencyPrecision()). + arg(_unitType.c_str()).arg(p.y(), 0, 'f', 2)); return t; } + +private: + std::string _unitType; }; FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) @@ -94,8 +101,6 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) resize(parent->width(), parent->height()); - _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates - _useCenterFrequencyFlag = false; _numPoints = 1024; @@ -115,9 +120,8 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) palette.setColor(canvas()->backgroundRole(), QColor("white")); canvas()->setPalette(palette); - setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0)); - setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)"); + setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0)); _minYAxis = -120; _maxYAxis = 10; @@ -150,7 +154,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _upper_intensity_marker = new QwtPlotMarker(); _upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); - _upper_intensity_marker->setLinePen(QPen(Qt::green)); + _upper_intensity_marker->setLinePen(QPen(Qt::green, 0, Qt::DotLine)); _upper_intensity_marker->attach(this); memset(_dataPoints, 0x0, _numPoints*sizeof(double)); @@ -161,9 +165,6 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _maxFFTPoints[number] = -280.0; } - _resetXAxisPoints(); - - // set up peak marker QwtSymbol symbol; @@ -213,6 +214,9 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) const QColor c(Qt::darkRed); _zoomer->setRubberBandPen(c); _zoomer->setTrackerPen(c); + + // Do this after the zoomer has been built + _resetXAxisPoints(); } FrequencyDisplayPlot::~FrequencyDisplayPlot() @@ -258,21 +262,26 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, stopFreq = (stopFreq + centerFreq); } - _startFrequency = startFreq; - _stopFrequency = stopFreq; - _resetXAxisPoints(); - - double display_units = ceil(log10(units)/2.0); - setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); - setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units)); - setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); - ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units); - - // Load up the new base zoom settings - _zoomer->setZoomBase(); - - // Zooms back to the base and clears any other zoom levels - _zoomer->zoom(0); + bool reset = false; + if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) + reset = true; + + if(stopFreq > startFreq) { + _startFrequency = startFreq; + _stopFrequency = stopFreq; + + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){ + double display_units = ceil(log10(units)/2.0); + setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units)); + setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); + + if(reset) + _resetXAxisPoints(); + + ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units); + ((FreqDisplayZoomer*)_zoomer)->SetUnitType(strunits); + } + } } @@ -291,8 +300,6 @@ FrequencyDisplayPlot::GetStopFrequency() const void FrequencyDisplayPlot::replot() { - const timespec startTime = get_highres_clock(); - _markerNoiseFloorAmplitude->setYValue(_noiseFloorAmplitude); // Make sure to take into account the start frequency @@ -305,14 +312,6 @@ FrequencyDisplayPlot::replot() _markerPeakAmplitude->setYValue(_peakAmplitude); QwtPlot::replot(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - differenceTime *= 99.0; - // Require at least a 10% duty cycle - if(differenceTime > (1.0/10.0)){ - _displayIntervalTime = differenceTime; - } } void @@ -324,13 +323,15 @@ FrequencyDisplayPlot::resizeSlot( QSize *s ) void FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, - const double peakAmplitude) + const double peakAmplitude, const double timeInterval) { - if(numDataPoints > 0){ - - if(numDataPoints != _numPoints){ + // Only update plot if there is data and if the time interval has elapsed + if((numDataPoints > 0) && + (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) { + + if(numDataPoints != _numPoints) { _numPoints = numDataPoints; - + delete[] _dataPoints; delete[] _minFFTPoints; delete[] _maxFFTPoints; @@ -343,12 +344,12 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat _fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints); _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); - + _resetXAxisPoints(); ClearMaxData(); ClearMinData(); } - + memcpy(_dataPoints, dataPoints, numDataPoints*sizeof(double)); for(int64_t point = 0; point < numDataPoints; point++){ if(dataPoints[point] < _minFFTPoints[point]){ @@ -363,14 +364,10 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat _peakFrequency = peakFrequency; _peakAmplitude = peakAmplitude; - } + SetUpperIntensityLevel(_peakAmplitude); - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - // Only replot the screen if it is visible - if(isVisible()){ - replot(); - } + replot(); + _lastReplot = get_highres_clock(); } } @@ -412,6 +409,17 @@ FrequencyDisplayPlot::_resetXAxisPoints() _xAxisPoints[loc] = freqValue; freqValue += fft_bin_size; } + + setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); + + // Set up zoomer base for maximum unzoom x-axis + // and reset to maximum unzoom level + QwtDoubleRect zbase = _zoomer->zoomBase(); + zbase.setLeft(_startFrequency); + zbase.setRight(_stopFrequency); + _zoomer->zoom(zbase); + _zoomer->setZoomBase(zbase); + _zoomer->zoom(0); } void diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/src/lib/FrequencyDisplayPlot.h index 785efe694..c78e1667e 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.h @@ -30,7 +30,7 @@ public: void PlotNewData(const double* dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, - const double peakAmplitude); + const double peakAmplitude, const double timeInterval); void ClearMaxData(); void ClearMinData(); @@ -86,8 +86,6 @@ private: timespec _lastReplot; bool _useCenterFrequencyFlag; - - double _displayIntervalTime; }; #endif /* FREQUENCY_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc index 4cb71a31a..8c1b36703 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc @@ -111,7 +111,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, timespec_reset(&_lastGUIUpdateTime); // Draw Blank Display - UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, 1.0, get_highres_clock(), true); + UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, get_highres_clock(), true); // Set up the initial frequency axis settings SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); @@ -220,7 +220,6 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, const uint64_t realTimeDomainDataSize, const float* complexTimeDomainData, const uint64_t complexTimeDomainDataSize, - const double timePerFFT, const timespec timestamp, const bool lastOfMultipleFFTUpdateFlag) { @@ -277,7 +276,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, const timespec currentTime = get_highres_clock(); const timespec lastUpdateGUITime = GetLastGUIUpdateTime(); - if((diff_timespec(currentTime, lastUpdateGUITime) > (4*timePerFFT)) && + if((diff_timespec(currentTime, lastUpdateGUITime) > (4*_updateTime)) && (GetPendingGUIUpdateEvents() > 0) && !timespec_empty(&lastUpdateGUITime)) { // Do not update the display if too much data is pending to be displayed _droppedEntriesCount++; @@ -290,7 +289,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, _realTimeDomainPoints, _imagTimeDomainPoints, timeDomainBufferSize, - timePerFFT, timestamp, + timestamp, repeatDataFlag, lastOfMultipleFFTUpdateFlag, currentTime, @@ -460,4 +459,12 @@ SpectrumGUIClass::SetFrequencyAxis(double min, double max) _spectrumDisplayForm->SetFrequencyAxis(min, max); } +void +SpectrumGUIClass::SetUpdateTime(double t) +{ + _updateTime = t; + _spectrumDisplayForm->SetUpdateTime(_updateTime); +} + + #endif /* SPECTRUM_GUI_CLASS_CPP */ diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h index d8dcb2769..17d3a54c1 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.h +++ b/gr-qtgui/src/lib/SpectrumGUIClass.h @@ -47,7 +47,7 @@ public: void UpdateWindow(const bool, const std::complex<float>*, const uint64_t, const float*, const uint64_t, const float*, - const uint64_t, const double, + const uint64_t, const timespec, const bool); float GetPowerValue()const; @@ -79,6 +79,8 @@ public: void SetConstellationPenSize(int size); void SetFrequencyAxis(double min, double max); + void SetUpdateTime(double t); + protected: private: @@ -98,6 +100,7 @@ private: unsigned int _pendingGUIUpdateEventsCount; int _droppedEntriesCount; bool _fftBuffersCreatedFlag; + double _updateTime; SpectrumDisplayForm* _spectrumDisplayForm; diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc index cb18b4418..c299f83a4 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc @@ -7,10 +7,37 @@ #include <qwt_legend.h> -class TimeDomainDisplayZoomer: public QwtPlotZoomer +class TimePrecisionClass { public: - TimeDomainDisplayZoomer(QwtPlotCanvas* canvas):QwtPlotZoomer(canvas) + TimePrecisionClass(const int timePrecision) + { + _timePrecision = timePrecision; + } + + virtual ~TimePrecisionClass() + { + } + + virtual unsigned int GetTimePrecision() const + { + return _timePrecision; + } + + virtual void SetTimePrecision(const unsigned int newPrecision) + { + _timePrecision = newPrecision; + } +protected: + unsigned int _timePrecision; +}; + + +class TimeDomainDisplayZoomer: public QwtPlotZoomer, public TimePrecisionClass +{ +public: + TimeDomainDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timePrecision) + : QwtPlotZoomer(canvas),TimePrecisionClass(timePrecision) { setTrackerMode(QwtPicker::AlwaysOn); } @@ -23,28 +50,37 @@ public: updateDisplay(); } + void SetUnitType(const std::string &type) + { + _unitType = type; + } + protected: virtual QwtText trackerText( const QwtDoublePoint& p ) const { - QwtText t(QString("Sample %1, %2 V").arg(p.x(), 0, 'f', 0).arg(p.y(), 0, 'f', 4)); + QwtText t(QString("%1 %2, %3 V").arg(p.x(), 0, 'f', GetTimePrecision()). + arg(_unitType.c_str()). + arg(p.y(), 0, 'f', 4)); return t; } + +private: + std::string _unitType; }; -TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ +TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent) +{ timespec_reset(&_lastReplot); resize(parent->width(), parent->height()); - _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates - _numPoints = 1024; _realDataPoints = new double[_numPoints]; _imagDataPoints = new double[_numPoints]; _xAxisPoints = new double[_numPoints]; - _zoomer = new TimeDomainDisplayZoomer(canvas()); + _zoomer = new TimeDomainDisplayZoomer(canvas(), 0); // Disable polygon clipping QwtPainter::setDeviceClipping(false); @@ -59,7 +95,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); set_xaxis(0, _numPoints); - setAxisTitle(QwtPlot::xBottom, "Sample Number"); + setAxisTitle(QwtPlot::xBottom, "Time (sec)"); setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); set_yaxis(-2.0, 2.0); @@ -81,6 +117,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ memset(_imagDataPoints, 0x0, _numPoints*sizeof(double)); memset(_xAxisPoints, 0x0, _numPoints*sizeof(double)); + _sampleRate = 1; _resetXAxisPoints(); replot(); @@ -114,7 +151,8 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ legendDisplay->setItemMode(QwtLegend::CheckableItem); insertLegend(legendDisplay); - connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ), this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) )); + connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ), + this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) )); } TimeDomainDisplayPlot::~TimeDomainDisplayPlot(){ @@ -143,17 +181,7 @@ TimeDomainDisplayPlot::set_xaxis(double min, double max) void TimeDomainDisplayPlot::replot() { - const timespec startTime = get_highres_clock(); - QwtPlot::replot(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - differenceTime *= 99.0; - // Require at least a 10% duty cycle - if(differenceTime > (1.0/10.0)){ - _displayIntervalTime = differenceTime; - } } void @@ -164,10 +192,12 @@ TimeDomainDisplayPlot::resizeSlot( QSize *s ) void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, const double* imagDataPoints, - const int64_t numDataPoints) + const int64_t numDataPoints, + const double timeInterval) { - if(numDataPoints > 0){ - + if((numDataPoints > 0) && + (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) { + if(numDataPoints != _numPoints){ _numPoints = numDataPoints; @@ -185,34 +215,61 @@ void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, _resetXAxisPoints(); } + memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double)); - } + replot(); - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - // Only replot the screen if it is visible - if(isVisible()){ - replot(); - } _lastReplot = get_highres_clock(); } } -void TimeDomainDisplayPlot::SetImaginaryDataVisible(const bool visibleFlag){ +void TimeDomainDisplayPlot::SetImaginaryDataVisible(const bool visibleFlag) +{ _imag_plot_curve->setVisible(visibleFlag); } -void TimeDomainDisplayPlot::_resetXAxisPoints(){ +void TimeDomainDisplayPlot::_resetXAxisPoints() +{ + double delt = 1.0/_sampleRate; for(long loc = 0; loc < _numPoints; loc++){ - _xAxisPoints[loc] = loc; + _xAxisPoints[loc] = loc*delt; } - setAxisScale(QwtPlot::xBottom, 0, _numPoints); + setAxisScale(QwtPlot::xBottom, 0, _numPoints*delt); + + // Set up zoomer base for maximum unzoom x-axis + // and reset to maximum unzoom level + QwtDoubleRect zbase = _zoomer->zoomBase(); + zbase.setLeft(0); + zbase.setRight(_numPoints*delt); + _zoomer->zoom(zbase); + _zoomer->setZoomBase(zbase); + _zoomer->zoom(0); } -void TimeDomainDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on){ +void TimeDomainDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) +{ plotItem->setVisible(!on); } +void +TimeDomainDisplayPlot::SetSampleRate(double sr, double units, + const std::string &strunits) +{ + double newsr = sr/units; + if(newsr != _sampleRate) { + _sampleRate = sr/units; + _resetXAxisPoints(); + + // While we could change the displayed sigfigs based on the unit being + // displayed, I think it looks better by just setting it to 4 regardless. + //double display_units = ceil(log10(units)/2.0); + double display_units = 4; + setAxisTitle(QwtPlot::xBottom, QString("Time (%1)").arg(strunits.c_str())); + ((TimeDomainDisplayZoomer*)_zoomer)->SetTimePrecision(display_units); + ((TimeDomainDisplayZoomer*)_zoomer)->SetUnitType(strunits); + } +} + #endif /* TIME_DOMAIN_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h index 8d98abac6..5525bbabe 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h @@ -21,7 +21,8 @@ public: TimeDomainDisplayPlot(QWidget*); virtual ~TimeDomainDisplayPlot(); - void PlotNewData(const double* realDataPoints, const double* imagDataPoints, const int64_t numDataPoints); + void PlotNewData(const double* realDataPoints, const double* imagDataPoints, + const int64_t numDataPoints, const double timeInterval); void SetImaginaryDataVisible(const bool); @@ -32,6 +33,8 @@ public: public slots: void resizeSlot( QSize *s ); + void SetSampleRate(double sr, double units, + const std::string &strunits); protected slots: void LegendEntryChecked(QwtPlotItem *plotItem, bool on); @@ -51,11 +54,11 @@ private: double* _imagDataPoints; double* _xAxisPoints; + double _sampleRate; + timespec _lastReplot; int64_t _numPoints; - - double _displayIntervalTime; }; #endif /* TIME_DOMAIN_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc index f6d0cc0ba..e0804fa64 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc @@ -66,8 +66,7 @@ public: QwtText label(double value) const { - return QString("%1").arg((value + GetCenterFrequency()) / ((GetFrequencyPrecision() == 0) ? 1.0 : 1000.0), - 0, 'f', GetFrequencyPrecision()); + return QString("%1").arg(value, 0, 'f', GetFrequencyPrecision()); } virtual void initiateUpdate() @@ -161,7 +160,8 @@ private: }; -class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData, public FreqOffsetAndPrecisionClass +class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData, + public FreqOffsetAndPrecisionClass { public: WaterfallZoomer(QwtPlotCanvas* canvas, const unsigned int freqPrecision) @@ -180,6 +180,11 @@ public: updateDisplay(); } + void SetUnitType(const std::string &type) + { + _unitType = type; + } + protected: virtual QwtText trackerText( const QwtDoublePoint& p ) const { @@ -193,10 +198,14 @@ protected: timeTm.tm_mday, timeTm.tm_hour, timeTm.tm_min, timeTm.tm_sec, lineTime.tv_nsec/1000000)); - QwtText t(QString("%1 %2, %3").arg((p.x() + GetCenterFrequency()) / ((GetFrequencyPrecision() == 0) ? 1.0 : 1000.0), 0, 'f', GetFrequencyPrecision()).arg( (GetFrequencyPrecision() == 0) ? "Hz" : "kHz").arg(yLabel)); - + QwtText t(QString("%1 %2, %3"). + arg(p.x(), 0, 'f', GetFrequencyPrecision()). + arg(_unitType.c_str()).arg(yLabel)); return t; } + +private: + std::string _unitType; }; @@ -216,8 +225,6 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) resize(parent->width(), parent->height()); _numPoints = 1024; - _displayIntervalTime = (1.0/5.0); // 1/5 of a second between updates - _waterfallData = new WaterfallData(_startFrequency, _stopFrequency, _numPoints, 200); QPalette palette; @@ -282,6 +289,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) WaterfallDisplayPlot::~WaterfallDisplayPlot() { delete _waterfallData; + delete d_spectrogram; } void @@ -290,6 +298,8 @@ WaterfallDisplayPlot::Reset() _waterfallData->ResizeData(_startFrequency, _stopFrequency, _numPoints); _waterfallData->Reset(); + setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); + // Load up the new base zoom settings QwtDoubleRect newSize = _zoomer->zoomBase(); newSize.setLeft(_startFrequency); @@ -310,27 +320,32 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq, double stopFreq = constStopFreq / units; double centerFreq = constCenterFreq / units; - if(stopFreq > startFreq) { - _startFrequency = 1000*startFreq; - _stopFrequency = 1000*stopFreq; + _useCenterFrequencyFlag = useCenterFrequencyFlag; - setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); + if(_useCenterFrequencyFlag){ + startFreq = (startFreq + centerFreq); + stopFreq = (stopFreq + centerFreq); + } - if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){ - WaterfallFreqDisplayScaleDraw* freqScale = ((WaterfallFreqDisplayScaleDraw*)axisScaleDraw(QwtPlot::xBottom)); - freqScale->SetCenterFrequency(centerFreq); - ((WaterfallZoomer*)_zoomer)->SetCenterFrequency(centerFreq); + bool reset = false; + if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) + reset = true; - freqScale->SetFrequencyPrecision( 2 ); - ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision( 2 ); + if(stopFreq > startFreq) { + _startFrequency = startFreq; + _stopFrequency = stopFreq; + + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){ + double display_units = ceil(log10(units)/2.0); + setAxisScaleDraw(QwtPlot::xBottom, new WaterfallFreqDisplayScaleDraw(display_units)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); - } - Reset(); + if(reset) { + Reset(); + } - // Only replot if screen is visible - if(isVisible()){ - replot(); + ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision(display_units); + ((WaterfallZoomer*)_zoomer)->SetUnitType(strunits); } } } @@ -350,50 +365,46 @@ WaterfallDisplayPlot::GetStopFrequency() const void WaterfallDisplayPlot::PlotNewData(const double* dataPoints, - const int64_t numDataPoints, - const double timePerFFT, - const timespec timestamp, - const int droppedFrames) + const int64_t numDataPoints, + const double timePerFFT, + const timespec timestamp, + const int droppedFrames) { if(numDataPoints > 0){ if(numDataPoints != _numPoints){ _numPoints = numDataPoints; - + Reset(); - + d_spectrogram->invalidateCache(); d_spectrogram->itemChanged(); - + if(isVisible()){ replot(); } - + _lastReplot = get_highres_clock(); } - _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames); - _waterfallData->IncrementNumLinesToUpdate(); - - QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft); - timeScale->SetSecondsPerLine(timePerFFT); - timeScale->SetZeroTime(timestamp); - - ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT); - ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp); - } - - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - - d_spectrogram->invalidateCache(); - d_spectrogram->itemChanged(); - - // Only update when window is visible - if(isVisible()){ + if(diff_timespec(get_highres_clock(), _lastReplot) > timePerFFT) { + //FIXME: We may want to average the data between these updates to smooth display + _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames); + _waterfallData->IncrementNumLinesToUpdate(); + + QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft); + timeScale->SetSecondsPerLine(timePerFFT); + timeScale->SetZeroTime(timestamp); + + ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT); + ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp); + + d_spectrogram->invalidateCache(); + d_spectrogram->itemChanged(); + replot(); - } - _lastReplot = get_highres_clock(); + _lastReplot = get_highres_clock(); + } } } @@ -412,8 +423,6 @@ WaterfallDisplayPlot::SetIntensityRange(const double minIntensity, void WaterfallDisplayPlot::replot() { - const timespec startTime = get_highres_clock(); - QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft); timeScale->initiateUpdate(); @@ -435,14 +444,6 @@ WaterfallDisplayPlot::replot() } QwtPlot::replot(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - // Require at least a 5% duty cycle - differenceTime *= 19.0; - if(differenceTime > (1.0/5.0)){ - _displayIntervalTime = differenceTime; - } } void diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h index bb87fb09f..a5ccaec40 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h @@ -69,9 +69,9 @@ private: timespec _lastReplot; - int64_t _numPoints; + bool _useCenterFrequencyFlag; - double _displayIntervalTime; + int64_t _numPoints; int _intensityColorMapType; QColor _userDefinedLowIntensityColor; diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc index 7340141a6..a148cf501 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/src/lib/qtgui_sink_c.cc @@ -88,7 +88,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, qtgui_sink_c::~qtgui_sink_c() { - delete d_object; + delete d_main_gui; delete [] d_residbuf; delete d_fft; } @@ -145,6 +145,9 @@ qtgui_sink_c::initialize(const bool opengl) d_plotconst, opengl); + // initialize update time to 10 times a second + set_update_time(0.1); + d_object = new qtgui_obj(d_qApplication); qApp->postEvent(d_object, new qtgui_event(&d_pmutex)); } @@ -208,6 +211,13 @@ qtgui_sink_c::set_frequency_axis(double min, double max) } void +qtgui_sink_c::set_update_time(double t) +{ + d_update_time = t; + d_main_gui->SetUpdateTime(d_update_time); +} + +void qtgui_sink_c::fft(const gr_complex *data_in, int size) { if (d_window.size()) { @@ -300,7 +310,7 @@ qtgui_sink_c::general_work (int noutput_items, d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize, NULL, 0, (float*)d_residbuf, d_fftsize, - 1.0/4.0, currentTime, true); + currentTime, true); } // Otherwise, copy what we received into the residbuf for next time else { diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h index 91c6b03e6..1f6c28473 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/src/lib/qtgui_sink_c.h @@ -86,6 +86,8 @@ private: bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + double d_update_time; + QWidget *d_parent; SpectrumGUIClass *d_main_gui; @@ -111,6 +113,8 @@ public: void set_constellation_pen_size(int size); void set_frequency_axis(double min, double max); + void set_update_time(double t); + QApplication *d_qApplication; qtgui_obj *d_object; diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc index 6fbb2f381..8eb0a0347 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/src/lib/qtgui_sink_f.cc @@ -88,7 +88,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, qtgui_sink_f::~qtgui_sink_f() { - delete d_object; + delete d_main_gui; delete [] d_residbuf; delete d_fft; } @@ -140,6 +140,9 @@ qtgui_sink_f::initialize(const bool opengl) d_plotconst, opengl); + // initialize update time to 10 times a second + set_update_time(0.1); + d_object = new qtgui_obj(d_qApplication); qApp->postEvent(d_object, new qtgui_event(&d_pmutex)); } @@ -202,6 +205,13 @@ qtgui_sink_f::set_frequency_axis(double min, double max) } void +qtgui_sink_f::set_update_time(double t) +{ + d_update_time = t; + d_main_gui->SetUpdateTime(d_update_time); +} + +void qtgui_sink_f::fft(const float *data_in, int size) { if (d_window.size()) { @@ -295,7 +305,7 @@ qtgui_sink_f::general_work (int noutput_items, d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize, (float*)d_residbuf, d_fftsize, NULL, 0, - 1.0/4.0, currentTime, true); + currentTime, true); } // Otherwise, copy what we received into the residbuf for next time else { diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h index 47c928d17..f603da7b6 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/src/lib/qtgui_sink_f.h @@ -84,6 +84,8 @@ private: bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + double d_update_time; + QWidget *d_parent; SpectrumGUIClass *d_main_gui; @@ -109,6 +111,8 @@ public: void set_constellation_pen_size(int size); void set_frequency_axis(double min, double max); + void set_update_time(double t); + QApplication *d_qApplication; qtgui_obj *d_object; diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.cc b/gr-qtgui/src/lib/spectrumUpdateEvents.cc index 2da37d350..53a205fb7 100644 --- a/gr-qtgui/src/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/src/lib/spectrumUpdateEvents.cc @@ -8,7 +8,6 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, - const double timePerFFT, const timespec dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, @@ -16,15 +15,19 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints, const int droppedFFTFrames) : QEvent(QEvent::Type(10005)) { - _numFFTDataPoints = numFFTDataPoints; - if(_numFFTDataPoints < 1){ + if(numFFTDataPoints < 1) { _numFFTDataPoints = 1; } + else { + _numFFTDataPoints = numFFTDataPoints; + } - _numTimeDomainDataPoints = numTimeDomainDataPoints; - if(_numTimeDomainDataPoints < 1){ + if(numTimeDomainDataPoints < 1) { _numTimeDomainDataPoints = 1; } + else { + _numTimeDomainDataPoints = numTimeDomainDataPoints; + } _fftPoints = new std::complex<float>[_numFFTDataPoints]; _fftPoints[0] = std::complex<float>(0,0); @@ -32,26 +35,26 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints, _realDataTimeDomainPoints = new double[_numTimeDomainDataPoints]; memset(_realDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); - if(numTimeDomainDataPoints > 0){ + if(numTimeDomainDataPoints > 0) { memcpy(_realDataTimeDomainPoints, realTimeDomainPoints, numTimeDomainDataPoints*sizeof(double)); } _imagDataTimeDomainPoints = new double[_numTimeDomainDataPoints]; memset(_imagDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); - if(numTimeDomainDataPoints > 0){ + if(numTimeDomainDataPoints > 0) { memcpy(_imagDataTimeDomainPoints, imagTimeDomainPoints, numTimeDomainDataPoints*sizeof(double)); } _dataTimestamp = dataTimestamp; - _timePerFFT = timePerFFT; _repeatDataFlag = repeatDataFlag; _lastOfMultipleUpdateFlag = lastOfMultipleUpdateFlag; _eventGeneratedTimestamp = generatedTimestamp; _droppedFFTFrames = droppedFFTFrames; } -SpectrumUpdateEvent::~SpectrumUpdateEvent(){ +SpectrumUpdateEvent::~SpectrumUpdateEvent() +{ delete[] _fftPoints; delete[] _realDataTimeDomainPoints; delete[] _imagDataTimeDomainPoints; @@ -87,12 +90,6 @@ SpectrumUpdateEvent::getNumTimeDomainDataPoints() const return _numTimeDomainDataPoints; } -double -SpectrumUpdateEvent::getTimePerFFT() const -{ - return _timePerFFT; -} - timespec SpectrumUpdateEvent::getDataTimestamp() const { diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/src/lib/spectrumUpdateEvents.h index 75fa27324..ccc072c3e 100644 --- a/gr-qtgui/src/lib/spectrumUpdateEvents.h +++ b/gr-qtgui/src/lib/spectrumUpdateEvents.h @@ -10,19 +10,29 @@ class SpectrumUpdateEvent:public QEvent{ public: - SpectrumUpdateEvent(const std::complex<float>* fftPoints, const uint64_t numFFTDataPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, const double timePerFFT, const timespec dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, const timespec generatedTimestamp, const int droppedFFTFrames); + SpectrumUpdateEvent(const std::complex<float>* fftPoints, + const uint64_t numFFTDataPoints, + const double* realTimeDomainPoints, + const double* imagTimeDomainPoints, + const uint64_t numTimeDomainDataPoints, + const timespec dataTimestamp, + const bool repeatDataFlag, + const bool lastOfMultipleUpdateFlag, + const timespec generatedTimestamp, + const int droppedFFTFrames); + ~SpectrumUpdateEvent(); - const std::complex<float>* getFFTPoints()const; - const double* getRealTimeDomainPoints()const; - const double* getImagTimeDomainPoints()const; - uint64_t getNumFFTDataPoints()const; - uint64_t getNumTimeDomainDataPoints()const; - double getTimePerFFT()const; - timespec getDataTimestamp()const; - bool getRepeatDataFlag()const; - bool getLastOfMultipleUpdateFlag()const; - timespec getEventGeneratedTimestamp()const; - int getDroppedFFTFrames()const; + + const std::complex<float>* getFFTPoints() const; + const double* getRealTimeDomainPoints() const; + const double* getImagTimeDomainPoints() const; + uint64_t getNumFFTDataPoints() const; + uint64_t getNumTimeDomainDataPoints() const; + timespec getDataTimestamp() const; + bool getRepeatDataFlag() const; + bool getLastOfMultipleUpdateFlag() const; + timespec getEventGeneratedTimestamp() const; + int getDroppedFFTFrames() const; protected: @@ -32,7 +42,6 @@ private: double* _imagDataTimeDomainPoints; uint64_t _numFFTDataPoints; uint64_t _numTimeDomainDataPoints; - double _timePerFFT; timespec _dataTimestamp; bool _repeatDataFlag; bool _lastOfMultipleUpdateFlag; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc Binary files differindex b27292193..f52a63d1f 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/src/lib/spectrumdisplayform.cc diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h index d89141f1e..bf2af7033 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/src/lib/spectrumdisplayform.h @@ -13,6 +13,7 @@ class SpectrumGUIClass; #include <TimeDomainDisplayPlot.h> #include <ConstellationDisplayPlot.h> #include <QValidator> +#include <QTimer> #include <vector> class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm @@ -43,7 +44,6 @@ public slots: void MaxHoldResetBtn_clicked(); void TabChanged(int index); - void PowerLineEdit_textChanged( const QString& valueString ); void SetFrequencyRange( const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency ); @@ -71,9 +71,11 @@ public slots: double ymin, double ymax); void SetConstellationPenSize(int size); void SetFrequencyAxis(double min, double max); + void SetUpdateTime(double t); private slots: void newFrequencyData( const SpectrumUpdateEvent* ); + void UpdateGuiTimer(); protected: @@ -111,6 +113,9 @@ private: int d_plot_waterfall3d; int d_plot_time; int d_plot_constellation; + + QTimer *displayTimer; + double d_update_time; }; #endif /* SPECTRUM_DISPLAY_FORM_H */ diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui index cb7b4f996..0e652d833 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/src/lib/spectrumdisplayform.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>657</width> + <width>712</width> <height>543</height> </rect> </property> @@ -183,7 +183,7 @@ <property name="minimumSize"> <size> <width>400</width> - <height>332</height> + <height>350</height> </size> </property> <property name="sizeIncrement"> @@ -222,31 +222,6 @@ </property> </widget> </item> - <item row="1" column="3"> - <widget class="QLabel" name="PowerLabel"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Power</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="QPushButton" name="MaxHoldResetBtn"> <property name="sizePolicy"> @@ -266,7 +241,7 @@ </property> </widget> </item> - <item row="1" column="4"> + <item row="1" column="3"> <widget class="QLabel" name="AvgLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> @@ -298,33 +273,8 @@ </property> </widget> </item> - <item row="2" column="4"> - <widget class="QSpinBox" name="AvgLineEdit"/> - </item> <item row="2" column="3"> - <widget class="QLineEdit" name="PowerLineEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>1</string> - </property> - </widget> + <widget class="QSpinBox" name="AvgLineEdit"/> </item> <item row="1" column="2"> <spacer name="horizontalSpacer_2"> @@ -844,22 +794,6 @@ </hints> </connection> <connection> - <sender>PowerLineEdit</sender> - <signal>textChanged(QString)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>PowerLineEdit_textChanged(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>482</x> - <y>344</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> <sender>WindowComboBox</sender> <signal>activated(int)</signal> <receiver>SpectrumDisplayForm</receiver> diff --git a/gr-qtgui/src/python/pyqt_example.py b/gr-qtgui/src/python/pyqt_example.py index 4fa8cdd92..7c0cfc698 100755 --- a/gr-qtgui/src/python/pyqt_example.py +++ b/gr-qtgui/src/python/pyqt_example.py @@ -131,9 +131,9 @@ class my_top_block(gr.top_block): # Wrap the pointer as a PyQt SIP object # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - self.main_box = dialog_box(pyWin, self.ctrl_win) + self.main_box = dialog_box(self.pyWin, self.ctrl_win) self.main_box.show() diff --git a/gr-qtgui/src/python/pyqt_example_f.py b/gr-qtgui/src/python/pyqt_example_f.py index 46fe07e0d..4e36ccca5 100755 --- a/gr-qtgui/src/python/pyqt_example_f.py +++ b/gr-qtgui/src/python/pyqt_example_f.py @@ -130,9 +130,9 @@ class my_top_block(gr.top_block): # Wrap the pointer as a PyQt SIP object # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - self.main_box = dialog_box(pyWin, self.ctrl_win) + self.main_box = dialog_box(self.pyWin, self.ctrl_win) self.main_box.show() diff --git a/gr-qtgui/src/python/qt_digital.py b/gr-qtgui/src/python/qt_digital.py index ceb492c8d..679f144ef 100755 --- a/gr-qtgui/src/python/qt_digital.py +++ b/gr-qtgui/src/python/qt_digital.py @@ -139,7 +139,7 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - self._sample_rate = 200e3 + self._sample_rate = 2000e3 self.sps = 2 self.excess_bw = 0.35 @@ -182,11 +182,13 @@ class my_top_block(gr.top_block): self.to = 1.0 self.channel = gr.channel_model(noise, self.fo, self.to) - self.thr = gr.throttle(gr.sizeof_char, 10*fftsize) - self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, 1, + self.thr = gr.throttle(gr.sizeof_char, self._sample_rate) + self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, self._sample_rate*self.sps, "Tx", True, True, False, True, True) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, 1, + self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, self._sample_rate, "Rx", True, True, False, True, True) self.connect(self.src, self.thr, self.mod, self.channel, self.snk_tx) diff --git a/gr-qtgui/src/python/qt_digital_window.py b/gr-qtgui/src/python/qt_digital_window.py index 9e4c57a89..50dd53a92 100644 --- a/gr-qtgui/src/python/qt_digital_window.py +++ b/gr-qtgui/src/python/qt_digital_window.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'qt_digital_window.ui' # -# Created: Thu Jun 18 07:57:58 2009 -# by: PyQt4 UI code generator 4.4.3 +# Created: Sat May 1 20:14:02 2010 +# by: PyQt4 UI code generator 4.6.1 # # WARNING! All changes made in this file will be lost! @@ -12,73 +12,118 @@ from PyQt4 import QtCore, QtGui class Ui_DigitalWindow(object): def setupUi(self, DigitalWindow): DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1236, 739) + DigitalWindow.resize(1236, 741) self.centralwidget = QtGui.QWidget(DigitalWindow) self.centralwidget.setObjectName("centralwidget") - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setGeometry(QtCore.QRect(1120, 650, 101, 31)) - self.closeButton.setObjectName("closeButton") + self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName("verticalLayout") self.sinkFrame = QtGui.QFrame(self.centralwidget) - self.sinkFrame.setGeometry(QtCore.QRect(10, 10, 1221, 501)) + self.sinkFrame.setMinimumSize(QtCore.QSize(0, 550)) self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) self.sinkFrame.setObjectName("sinkFrame") - self.horizontalLayoutWidget = QtGui.QWidget(self.sinkFrame) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 1201, 481)) - self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") - self.sinkLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.sinkFrame) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() self.sinkLayout.setObjectName("sinkLayout") - self.channelModeBox = QtGui.QGroupBox(self.centralwidget) - self.channelModeBox.setGeometry(QtCore.QRect(290, 520, 291, 161)) - self.channelModeBox.setObjectName("channelModeBox") - self.timeLabel = QtGui.QLabel(self.channelModeBox) - self.timeLabel.setGeometry(QtCore.QRect(10, 90, 101, 17)) - self.timeLabel.setObjectName("timeLabel") - self.timeEdit = QtGui.QLineEdit(self.channelModeBox) - self.timeEdit.setGeometry(QtCore.QRect(160, 90, 113, 23)) - self.timeEdit.setObjectName("timeEdit") - self.snrEdit = QtGui.QLineEdit(self.channelModeBox) - self.snrEdit.setGeometry(QtCore.QRect(160, 30, 113, 23)) - self.snrEdit.setObjectName("snrEdit") - self.snrLabel = QtGui.QLabel(self.channelModeBox) - self.snrLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) - self.snrLabel.setObjectName("snrLabel") - self.freqEdit = QtGui.QLineEdit(self.channelModeBox) - self.freqEdit.setGeometry(QtCore.QRect(160, 60, 113, 23)) - self.freqEdit.setObjectName("freqEdit") - self.freqLabel = QtGui.QLabel(self.channelModeBox) - self.freqLabel.setGeometry(QtCore.QRect(10, 60, 141, 17)) - self.freqLabel.setObjectName("freqLabel") - self.rxBox = QtGui.QGroupBox(self.centralwidget) - self.rxBox.setGeometry(QtCore.QRect(590, 520, 251, 161)) - self.rxBox.setObjectName("rxBox") - self.gainMuEdit = QtGui.QLineEdit(self.rxBox) - self.gainMuEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.gainMuEdit.setObjectName("gainMuEdit") - self.gainMuLabel = QtGui.QLabel(self.rxBox) - self.gainMuLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) - self.gainMuLabel.setObjectName("gainMuLabel") - self.alphaEdit = QtGui.QLineEdit(self.rxBox) - self.alphaEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.alphaEdit.setObjectName("alphaEdit") - self.alphaLabel = QtGui.QLabel(self.rxBox) - self.alphaLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) - self.alphaLabel.setObjectName("alphaLabel") + self.horizontalLayout_2.addLayout(self.sinkLayout) + self.verticalLayout.addWidget(self.sinkFrame) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") self.sysBox = QtGui.QGroupBox(self.centralwidget) - self.sysBox.setGeometry(QtCore.QRect(20, 520, 261, 161)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) + self.sysBox.setSizePolicy(sizePolicy) + self.sysBox.setMinimumSize(QtCore.QSize(0, 0)) + self.sysBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.sysBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.sysBox.setObjectName("sysBox") + self.gridLayout_2 = QtGui.QGridLayout(self.sysBox) + self.gridLayout_2.setObjectName("gridLayout_2") self.sampleRateEdit = QtGui.QLineEdit(self.sysBox) - self.sampleRateEdit.setGeometry(QtCore.QRect(140, 30, 113, 23)) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.sampleRateEdit.setObjectName("sampleRateEdit") + self.gridLayout_2.addWidget(self.sampleRateEdit, 0, 3, 1, 1) self.sampleRateLabel = QtGui.QLabel(self.sysBox) - self.sampleRateLabel.setGeometry(QtCore.QRect(10, 30, 121, 20)) self.sampleRateLabel.setObjectName("sampleRateLabel") + self.gridLayout_2.addWidget(self.sampleRateLabel, 0, 2, 1, 1) + self.horizontalLayout.addWidget(self.sysBox) + self.rxBox = QtGui.QGroupBox(self.centralwidget) + self.rxBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.rxBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.rxBox.setObjectName("rxBox") + self.gridLayout_3 = QtGui.QGridLayout(self.rxBox) + self.gridLayout_3.setObjectName("gridLayout_3") + self.alphaLabel = QtGui.QLabel(self.rxBox) + self.alphaLabel.setObjectName("alphaLabel") + self.gridLayout_3.addWidget(self.alphaLabel, 1, 0, 1, 1) + self.alphaEdit = QtGui.QLineEdit(self.rxBox) + self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.alphaEdit.setObjectName("alphaEdit") + self.gridLayout_3.addWidget(self.alphaEdit, 1, 1, 1, 1) + self.gainMuLabel = QtGui.QLabel(self.rxBox) + self.gainMuLabel.setObjectName("gainMuLabel") + self.gridLayout_3.addWidget(self.gainMuLabel, 0, 0, 1, 1) + self.gainMuEdit = QtGui.QLineEdit(self.rxBox) + self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.gainMuEdit.setObjectName("gainMuEdit") + self.gridLayout_3.addWidget(self.gainMuEdit, 0, 1, 1, 1) + self.horizontalLayout.addWidget(self.rxBox) + self.channelModeBox = QtGui.QGroupBox(self.centralwidget) + self.channelModeBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.channelModeBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.channelModeBox.setObjectName("channelModeBox") + self.gridLayout = QtGui.QGridLayout(self.channelModeBox) + self.gridLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) + self.gridLayout.setObjectName("gridLayout") + self.snrLabel = QtGui.QLabel(self.channelModeBox) + self.snrLabel.setObjectName("snrLabel") + self.gridLayout.addWidget(self.snrLabel, 0, 1, 1, 1) + self.snrEdit = QtGui.QLineEdit(self.channelModeBox) + self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.snrEdit.setObjectName("snrEdit") + self.gridLayout.addWidget(self.snrEdit, 0, 2, 1, 1) + self.freqLabel = QtGui.QLabel(self.channelModeBox) + self.freqLabel.setObjectName("freqLabel") + self.gridLayout.addWidget(self.freqLabel, 1, 1, 1, 1) + self.freqEdit = QtGui.QLineEdit(self.channelModeBox) + self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.freqEdit.setObjectName("freqEdit") + self.gridLayout.addWidget(self.freqEdit, 1, 2, 1, 1) + self.timeLabel = QtGui.QLabel(self.channelModeBox) + self.timeLabel.setObjectName("timeLabel") + self.gridLayout.addWidget(self.timeLabel, 2, 1, 1, 1) + self.timeEdit = QtGui.QLineEdit(self.channelModeBox) + self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.timeEdit.setObjectName("timeEdit") + self.gridLayout.addWidget(self.timeEdit, 2, 2, 1, 1) + self.horizontalLayout.addWidget(self.channelModeBox) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem1) self.pauseButton = QtGui.QPushButton(self.centralwidget) - self.pauseButton.setGeometry(QtCore.QRect(1120, 520, 101, 31)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth()) + self.pauseButton.setSizePolicy(sizePolicy) + self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) self.pauseButton.setObjectName("pauseButton") + self.verticalLayout_2.addWidget(self.pauseButton) + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout_2.addWidget(self.closeButton) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout.addLayout(self.horizontalLayout) DigitalWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 25)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 23)) self.menubar.setObjectName("menubar") self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -95,23 +140,22 @@ class Ui_DigitalWindow(object): QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - DigitalWindow.setTabOrder(self.closeButton, self.snrEdit) DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) def retranslateUi(self, DigitalWindow): DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) - self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/gr-qtgui/src/python/qt_digital_window.ui b/gr-qtgui/src/python/qt_digital_window.ui index 79ba01286..967252181 100644 --- a/gr-qtgui/src/python/qt_digital_window.ui +++ b/gr-qtgui/src/python/qt_digital_window.ui @@ -7,243 +7,273 @@ <x>0</x> <y>0</y> <width>1236</width> - <height>739</height> + <height>741</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> - <widget class="QPushButton" name="closeButton"> - <property name="geometry"> - <rect> - <x>1120</x> - <y>650</y> - <width>101</width> - <height>31</height> - </rect> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - <widget class="QFrame" name="sinkFrame"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>1221</width> - <height>501</height> - </rect> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <widget class="QWidget" name="horizontalLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>1201</width> - <height>481</height> - </rect> - </property> - <layout class="QHBoxLayout" name="sinkLayout"/> - </widget> - </widget> - <widget class="QGroupBox" name="channelModeBox"> - <property name="geometry"> - <rect> - <x>290</x> - <y>520</y> - <width>291</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>Channel Model Parameters</string> - </property> - <widget class="QLabel" name="timeLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>101</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Timing Offset</string> - </property> - </widget> - <widget class="QLineEdit" name="timeEdit"> - <property name="geometry"> - <rect> - <x>160</x> - <y>90</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLineEdit" name="snrEdit"> - <property name="geometry"> - <rect> - <x>160</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="snrLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>SNR (dB)</string> - </property> - </widget> - <widget class="QLineEdit" name="freqEdit"> - <property name="geometry"> - <rect> - <x>160</x> - <y>60</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="freqLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>141</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Frequency Offset (Hz)</string> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="rxBox"> - <property name="geometry"> - <rect> - <x>590</x> - <y>520</y> - <width>251</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>Receiver Parameters</string> - </property> - <widget class="QLineEdit" name="gainMuEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="gainMuLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Gain mu</string> - </property> - </widget> - <widget class="QLineEdit" name="alphaEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>60</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="alphaLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Alpha</string> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="sysBox"> - <property name="geometry"> - <rect> - <x>20</x> - <y>520</y> - <width>261</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>System Parameters</string> - </property> - <widget class="QLineEdit" name="sampleRateEdit"> - <property name="geometry"> - <rect> - <x>140</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="sampleRateLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>121</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Sample Rate (sps)</string> - </property> - </widget> - </widget> - <widget class="QPushButton" name="pauseButton"> - <property name="geometry"> - <rect> - <x>1120</x> - <y>520</y> - <width>101</width> - <height>31</height> - </rect> - </property> - <property name="text"> - <string>Pause</string> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QFrame" name="sinkFrame"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>550</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QHBoxLayout" name="sinkLayout"/> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QGroupBox" name="sysBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>System Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="3"> + <widget class="QLineEdit" name="sampleRateEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="sampleRateLabel"> + <property name="text"> + <string>Sample Rate (sps)</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="rxBox"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>Receiver Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="alphaLabel"> + <property name="text"> + <string>Alpha</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="alphaEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="gainMuLabel"> + <property name="text"> + <string>Gain mu</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gainMuEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="channelModeBox"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>Channel Model Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinimumSize</enum> + </property> + <item row="0" column="1"> + <widget class="QLabel" name="snrLabel"> + <property name="text"> + <string>SNR (dB)</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLineEdit" name="snrEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="freqLabel"> + <property name="text"> + <string>Frequency Offset (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="freqEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="timeLabel"> + <property name="text"> + <string>Timing Offset</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLineEdit" name="timeEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pauseButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Pause</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="closeButton"> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> @@ -251,7 +281,7 @@ <x>0</x> <y>0</y> <width>1236</width> - <height>25</height> + <height>23</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -270,7 +300,6 @@ </action> </widget> <tabstops> - <tabstop>closeButton</tabstop> <tabstop>snrEdit</tabstop> <tabstop>freqEdit</tabstop> <tabstop>timeEdit</tabstop> diff --git a/gr-qtgui/src/python/usrp2_display.py b/gr-qtgui/src/python/usrp2_display.py index 46ebfe94a..75d374c2b 100755 --- a/gr-qtgui/src/python/usrp2_display.py +++ b/gr-qtgui/src/python/usrp2_display.py @@ -171,9 +171,9 @@ class my_top_block(gr.top_block): help="select Ethernet interface, default is eth0") parser.add_option("-m", "--mac-addr", type="string", default="", help="select USRP by MAC address, default is auto-select") - parser.add_option("-W", "--bw", type="float", default=1e6, + parser.add_option("-W", "--bw", type="eng_float", default=1e6, help="set bandwidth of receiver [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, + parser.add_option("-f", "--freq", type="eng_float", default=2412e6, help="set frequency to FREQ", metavar="FREQ") parser.add_option("-g", "--gain", type="eng_float", default=None, help="set gain in dB (default is midpoint)") |