[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10584 - gnuradio/branches/developers/trondeau/qtdevel
From: |
trondeau |
Subject: |
[Commit-gnuradio] r10584 - gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib |
Date: |
Wed, 11 Mar 2009 19:31:31 -0600 (MDT) |
Author: trondeau
Date: 2009-03-11 19:31:31 -0600 (Wed, 11 Mar 2009)
New Revision: 10584
Modified:
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
Log:
wip: simpler solution.
Modified:
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
===================================================================
---
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
2009-03-12 01:05:31 UTC (rev 10583)
+++
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
2009-03-12 01:31:31 UTC (rev 10584)
@@ -8,25 +8,14 @@
SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QDialog(parent){
setupUi(this);
- d_plot_fft = true;
- d_plot_waterfall = true;
- d_plot_waterfall3d = true;
- d_plot_time = true;
- d_plot_constellation = true;
-
_systemSpecifiedFlag = false;
_intValidator = new QIntValidator(this);
_intValidator->setBottom(0);
- if(d_plot_fft)
- _frequencyDisplayPlot = new
FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
- if(d_plot_waterfall)
- _waterfallDisplayPlot = new
WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
- if(d_plot_waterfall3d)
- _waterfall3DDisplayPlot = new
Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
- if(d_plot_time)
- _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
- if(d_plot_constellation)
- _constellationDisplayPlot = new
ConstellationDisplayPlot(ConstellationDisplayFrame);
+ _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
+ _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
+ _waterfall3DDisplayPlot = new
Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+ _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
+ _constellationDisplayPlot = new
ConstellationDisplayPlot(ConstellationDisplayFrame);
_numRealDataPoints = 1024;
_realFFTDataPoints = new double[_numRealDataPoints];
_averagedValues = new double[_numRealDataPoints];
@@ -54,18 +43,14 @@
_noiseFloorAmplitude = -HUGE_VAL;
- if(d_plot_fft && d_plot_waterfall) {
- 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);
- if(d_plot_fft) {
- _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){
@@ -138,22 +123,8 @@
realFFTDataPointsPtr++;
}
- d_plot_fft = false;
- d_plot_waterfall = false;
- d_plot_waterfall3d = false;
- d_plot_time = false;
- d_plot_constellation = false;
+ int tabindex = SpectrumTypeTab->currentIndex();
- switch(SpectrumTypeTab->currentIndex()) {
- case(0): d_plot_fft = true; break;
- case(1): d_plot_waterfall = true; break;
- case(2): d_plot_waterfall3d = true; break;
- case(3): d_plot_time = true; break;
- case(4): d_plot_constellation = true; break;
- }
-
-
-
// Don't update the averaging history if this is repeated data
if(!repeatDataFlag){
_AverageHistory(_realFFTDataPoints);
@@ -198,17 +169,17 @@
}
if(lastOfMultipleUpdatesFlag){
- if(d_plot_fft) {
+ if(tabindex == d_plot_fft) {
_frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints,
_noiseFloorAmplitude, _peakFrequency,
_peakAmplitude);
}
- if(d_plot_time) {
+ if(tabindex == d_plot_time) {
_timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints,
imagTimeDomainDataPoints,
numTimeDomainDataPoints);
}
- if(d_plot_constellation) {
+ if(tabindex == d_plot_constellation) {
_constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints,
imagTimeDomainDataPoints,
numTimeDomainDataPoints);
@@ -216,12 +187,12 @@
}
// Don't update the repeated data for the waterfall
if(!repeatDataFlag){
- if(d_plot_waterfall) {
+ if(tabindex == d_plot_waterfall) {
_waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
timePerFFT, dataTimestamp,
spectrumUpdateEvent->getDroppedFFTFrames());
}
- if( _openGLWaterfall3DFlag == 1 && d_plot_waterfall3d){
+ if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
_waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints,
numFFTDataPoints,
timePerFFT, dataTimestamp,
spectrumUpdateEvent->getDroppedFFTFrames());
@@ -359,27 +330,25 @@
waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
// If the video card doesn't support OpenGL then don't display the 3D
Waterfall
- if(d_plot_waterfall3d) {
- if(QGLFormat::hasOpenGL()){
- // Check for Hardware Acceleration of the OpenGL
- if(!_waterfall3DDisplayPlot->format().directRendering()){
- // Only ask this once while the program is running...
- if(_openGLWaterfall3DFlag == -1){
- _openGLWaterfall3DFlag = 0;
- if(QMessageBox::warning(this, "OpenGL Direct Rendering NOT
Supported", "<center>The system's video card hardware or current drivers do not
support direct hardware rendering of the OpenGL
modules.</center><br><center>Software rendering is VERY processor
intensive.</center><br><center>Do you want to use software
rendering?</center>", QMessageBox::Yes, QMessageBox::No | QMessageBox::Default
| QMessageBox::Escape) == QMessageBox::Yes){
- _openGLWaterfall3DFlag = 1;
- }
+ if(QGLFormat::hasOpenGL()){
+ // Check for Hardware Acceleration of the OpenGL
+ if(!_waterfall3DDisplayPlot->format().directRendering()){
+ // Only ask this once while the program is running...
+ if(_openGLWaterfall3DFlag == -1){
+ _openGLWaterfall3DFlag = 0;
+ if(QMessageBox::warning(this, "OpenGL Direct Rendering NOT
Supported", "<center>The system's video card hardware or current drivers do not
support direct hardware rendering of the OpenGL
modules.</center><br><center>Software rendering is VERY processor
intensive.</center><br><center>Do you want to use software
rendering?</center>", QMessageBox::Yes, QMessageBox::No | QMessageBox::Default
| QMessageBox::Escape) == QMessageBox::Yes){
+ _openGLWaterfall3DFlag = 1;
}
}
- else{
- _openGLWaterfall3DFlag = 1;
- }
}
-
- if(_openGLWaterfall3DFlag != 1){
- SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
+ else{
+ _openGLWaterfall3DFlag = 1;
}
}
+
+ if(_openGLWaterfall3DFlag != 1){
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
+ }
// Clear any previous display
Reset();
@@ -424,9 +393,7 @@
void SpectrumDisplayForm::MaxHoldCheckBox_toggled( bool newState )
{
MaxHoldResetBtn->setEnabled(newState);
- if(d_plot_fft) {
- _frequencyDisplayPlot->SetMaxFFTVisible(newState);
- }
+ _frequencyDisplayPlot->SetMaxFFTVisible(newState);
MaxHoldResetBtn_clicked();
}
@@ -434,28 +401,22 @@
void SpectrumDisplayForm::MinHoldCheckBox_toggled( bool newState )
{
MinHoldResetBtn->setEnabled(newState);
- if(d_plot_fft) {
- _frequencyDisplayPlot->SetMinFFTVisible(newState);
- }
+ _frequencyDisplayPlot->SetMinFFTVisible(newState);
MinHoldResetBtn_clicked();
}
void SpectrumDisplayForm::MinHoldResetBtn_clicked()
{
- if(d_plot_fft) {
- _frequencyDisplayPlot->ClearMinData();
- _frequencyDisplayPlot->replot();
- }
+ _frequencyDisplayPlot->ClearMinData();
+ _frequencyDisplayPlot->replot();
}
void SpectrumDisplayForm::MaxHoldResetBtn_clicked()
{
- if(d_plot_fft) {
- _frequencyDisplayPlot->ClearMaxData();
- _frequencyDisplayPlot->replot();
- }
+ _frequencyDisplayPlot->ClearMaxData();
+ _frequencyDisplayPlot->replot();
}
@@ -484,18 +445,12 @@
void SpectrumDisplayForm::SetFrequencyRange(const double newStartFrequency,
const double newStopFrequency,
const double newCenterFrequency){
- if(d_plot_fft) {
- _frequencyDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
+ _frequencyDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
+
UseRFFrequenciesCheckBox->isChecked());
+ _waterfallDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
+
UseRFFrequenciesCheckBox->isChecked());
+ _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
UseRFFrequenciesCheckBox->isChecked());
- }
- if(d_plot_waterfall) {
- _waterfallDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
-
UseRFFrequenciesCheckBox->isChecked());
- }
- if(d_plot_waterfall3d) {
- _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency, newCenterFrequency,
-
UseRFFrequenciesCheckBox->isChecked());
- }
}
int SpectrumDisplayForm::GetAverageCount(){
@@ -570,12 +525,8 @@
void SpectrumDisplayForm::Reset(){
AverageDataReset();
- if(d_plot_waterfall) {
- _waterfallDisplayPlot->Reset();
- }
- if(d_plot_waterfall3d) {
- _waterfall3DDisplayPlot->Reset();
- }
+ _waterfallDisplayPlot->Reset();
+ _waterfall3DDisplayPlot->Reset();
}
@@ -630,10 +581,8 @@
WaterfallMaximumIntensityWheel->setValue(WaterfallMinimumIntensityWheel->value());
}
- if(d_plot_waterfall) {
-
_waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
-
WaterfallMaximumIntensityWheel->value());
- }
+
_waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
+
WaterfallMaximumIntensityWheel->value());
}
@@ -646,10 +595,8 @@
WaterfallMinimumIntensityWheel->setValue(WaterfallMaximumIntensityWheel->value());
}
- if(d_plot_waterfall) {
-
_waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
-
WaterfallMaximumIntensityWheel->value());
- }
+
_waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
+
WaterfallMaximumIntensityWheel->value());
}
void SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double
newValue )
@@ -661,10 +608,8 @@
Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
}
- if(d_plot_waterfall3d) {
-
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
-
Waterfall3DMaximumIntensityWheel->value());
- }
+
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+
Waterfall3DMaximumIntensityWheel->value());
}
@@ -677,10 +622,8 @@
Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
}
- if(d_plot_waterfall3d) {
-
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
-
Waterfall3DMaximumIntensityWheel->value());
- }
+
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+
Waterfall3DMaximumIntensityWheel->value());
}
@@ -726,51 +669,47 @@
{
QColor lowIntensityColor;
QColor highIntensityColor;
- if(d_plot_waterfall) {
- 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);
+ 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);
- _waterfallDisplayPlot->SetIntensityColorMapType(newType,
lowIntensityColor, highIntensityColor);
+ // 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::Waterfall3DIntensityColorTypeChanged( int newType )
{
QColor lowIntensityColor;
QColor highIntensityColor;
- if(d_plot_waterfall3d) {
- if(newType ==
Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
- // Select the Low Intensity Color
- lowIntensityColor =
_waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
- if(!lowIntensityColor.isValid()){
- lowIntensityColor = Qt::black;
- }
- QMessageBox::information(this, "Low Intensity Color Selection", "In the
next window, select the low intensity color for the waterfall display",
QMessageBox::Ok);
- lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
-
- // Select the High Intensity Color
- highIntensityColor =
_waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
- if(!highIntensityColor.isValid()){
- highIntensityColor = Qt::white;
- }
- QMessageBox::information(this, "High Intensity Color Selection", "In the
next window, select the high intensity color for the waterfall display",
QMessageBox::Ok);
- highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
+ if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
+ // Select the Low Intensity Color
+ lowIntensityColor =
_waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
+ if(!lowIntensityColor.isValid()){
+ lowIntensityColor = Qt::black;
}
- _waterfall3DDisplayPlot->SetIntensityColorMapType(newType,
lowIntensityColor, highIntensityColor);
+ 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);
}
+ _waterfall3DDisplayPlot->SetIntensityColorMapType(newType,
lowIntensityColor, highIntensityColor);
}
Modified:
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
===================================================================
---
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
2009-03-12 01:05:31 UTC (rev 10583)
+++
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
2009-03-12 01:31:31 UTC (rev 10584)
@@ -90,11 +90,13 @@
double _stopFrequency;
// whether or not to use a particular display
- bool d_plot_fft;
- bool d_plot_waterfall;
- bool d_plot_waterfall3d;
- bool d_plot_time;
- bool d_plot_constellation;
+ enum d_plot_tabs {
+ d_plot_fft = 0,
+ d_plot_waterfall,
+ d_plot_waterfall3d,
+ d_plot_time,
+ d_plot_constellation,
+ };
};
#endif /* SPECTRUM_DISPLAY_FORM_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10584 - gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib,
trondeau <=