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/SpectrumGUIClass.cc | 468 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100644 gr-qtgui/lib/SpectrumGUIClass.cc (limited to 'gr-qtgui/lib/SpectrumGUIClass.cc') diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc new file mode 100644 index 000000000..052730fc2 --- /dev/null +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -0,0 +1,468 @@ +#ifndef SPECTRUM_GUI_CLASS_CPP +#define SPECTRUM_GUI_CLASS_CPP + +#include +//Added by qt3to4: +#include +#include + +const long SpectrumGUIClass::MAX_FFT_SIZE = 32768; +const long SpectrumGUIClass::MIN_FFT_SIZE = 1024; + +SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, + const uint64_t fftSize, + const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency) +{ + _dataPoints = maxDataSize; + if(_dataPoints < 2){ + _dataPoints = 2; + } + _lastDataPointCount = _dataPoints; + + _fftSize = fftSize; + + _pendingGUIUpdateEventsCount = 0; + _droppedEntriesCount = 0; + + _centerFrequency = newCenterFrequency; + _startFrequency = newStartFrequency; + _stopFrequency = newStopFrequency; + + _windowType = 5; + + timespec_reset(&_lastGUIUpdateTime); + + _windowOpennedFlag = false; + _fftBuffersCreatedFlag = false; + + // Create Mutex Lock + //_windowStateLock = new MutexClass("_windowStateLock"); + + _powerValue = 1; +} + +SpectrumGUIClass::~SpectrumGUIClass() +{ + if(GetWindowOpenFlag()){ + delete _spectrumDisplayForm; + } + + if(_fftBuffersCreatedFlag){ + delete[] _fftPoints; + delete[] _realTimeDomainPoints; + delete[] _imagTimeDomainPoints; + } + + //delete _windowStateLock; +} + +void +SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, + const bool frequency, const bool waterfall, + const bool time, const bool constellation, + const bool use_openGL) +{ + //_windowStateLock->Lock(); + + if(!_windowOpennedFlag){ + + if(!_fftBuffersCreatedFlag){ + _fftPoints = new std::complex[_dataPoints]; + _realTimeDomainPoints = new double[_dataPoints]; + _imagTimeDomainPoints = new double[_dataPoints]; + _fftBuffersCreatedFlag = true; + + + memset(_fftPoints, 0x0, _dataPoints*sizeof(std::complex)); + memset(_realTimeDomainPoints, 0x0, _dataPoints*sizeof(double)); + memset(_imagTimeDomainPoints, 0x0, _dataPoints*sizeof(double)); + } + + // Called from the Event Thread + _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); + + // Toggle Windows on/off + _spectrumDisplayForm->ToggleTabFrequency(frequency); + _spectrumDisplayForm->ToggleTabWaterfall(waterfall); + _spectrumDisplayForm->ToggleTabTime(time); + _spectrumDisplayForm->ToggleTabConstellation(constellation); + + _windowOpennedFlag = true; + + _spectrumDisplayForm->setSystem(this, _dataPoints, _fftSize); + + qApp->processEvents(); + } + + //_windowStateLock->Unlock(); + + SetDisplayTitle(_title); + Reset(); + + qApp->postEvent(_spectrumDisplayForm, + new QEvent(QEvent::Type(QEvent::User+3))); + + qApp->processEvents(); + + timespec_reset(&_lastGUIUpdateTime); + + // Draw Blank Display + UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, get_highres_clock(), true); + + // Set up the initial frequency axis settings + SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); + + // GUI Thread only + qApp->processEvents(); +} + +void +SpectrumGUIClass::Reset() +{ + if(GetWindowOpenFlag()) { + qApp->postEvent(_spectrumDisplayForm, + new SpectrumFrequencyRangeEvent(_centerFrequency, + _startFrequency, + _stopFrequency)); + qApp->postEvent(_spectrumDisplayForm, new SpectrumWindowResetEvent()); + } + _droppedEntriesCount = 0; + // Call the following function the the Spectrum Window Reset Event window + // ResetPendingGUIUpdateEvents(); +} + +void +SpectrumGUIClass::SetDisplayTitle(const std::string newString) +{ + _title.assign(newString); + + if(GetWindowOpenFlag()){ + qApp->postEvent(_spectrumDisplayForm, + new SpectrumWindowCaptionEvent(_title.c_str())); + } +} + +bool +SpectrumGUIClass::GetWindowOpenFlag() +{ + bool returnFlag = false; + //_windowStateLock->Lock(); + returnFlag = _windowOpennedFlag; + //_windowStateLock->Unlock(); + return returnFlag; +} + + +void +SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag) +{ + //_windowStateLock->Lock(); + _windowOpennedFlag = newFlag; + //_windowStateLock->Unlock(); +} + +void +SpectrumGUIClass::SetFrequencyRange(const double centerFreq, + const double startFreq, + const double stopFreq) +{ + //_windowStateLock->Lock(); + _centerFrequency = centerFreq; + _startFrequency = startFreq; + _stopFrequency = stopFreq; + + _spectrumDisplayForm->SetFrequencyRange(_centerFrequency, + _startFrequency, + _stopFrequency); + //_windowStateLock->Unlock(); +} + +double +SpectrumGUIClass::GetStartFrequency() const +{ + double returnValue = 0.0; + //_windowStateLock->Lock(); + returnValue = _startFrequency; + //_windowStateLock->Unlock(); + return returnValue; +} + +double +SpectrumGUIClass::GetStopFrequency() const +{ + double returnValue = 0.0; + //_windowStateLock->Lock(); + returnValue = _stopFrequency; + //_windowStateLock->Unlock(); + return returnValue; +} + +double +SpectrumGUIClass::GetCenterFrequency() const +{ + double returnValue = 0.0; + //_windowStateLock->Lock(); + returnValue = _centerFrequency; + //_windowStateLock->Unlock(); + return returnValue; +} + + +void +SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, + const std::complex* fftBuffer, + const uint64_t inputBufferSize, + const float* realTimeDomainData, + const uint64_t realTimeDomainDataSize, + const float* complexTimeDomainData, + const uint64_t complexTimeDomainDataSize, + const timespec timestamp, + const bool lastOfMultipleFFTUpdateFlag) +{ + int64_t bufferSize = inputBufferSize; + bool repeatDataFlag = false; + if(bufferSize > _dataPoints){ + bufferSize = _dataPoints; + } + int64_t timeDomainBufferSize = 0; + + if(updateDisplayFlag){ + if((fftBuffer != NULL) && (bufferSize > 0)){ + memcpy(_fftPoints, fftBuffer, bufferSize * sizeof(std::complex)); + } + + // Can't do a memcpy since ths is going from float to double data type + if((realTimeDomainData != NULL) && (realTimeDomainDataSize > 0)){ + const float* realTimeDomainDataPtr = realTimeDomainData; + + double* realTimeDomainPointsPtr = _realTimeDomainPoints; + timeDomainBufferSize = realTimeDomainDataSize; + + memset( _imagTimeDomainPoints, 0x0, realTimeDomainDataSize*sizeof(double)); + for( uint64_t number = 0; number < realTimeDomainDataSize; number++){ + *realTimeDomainPointsPtr++ = *realTimeDomainDataPtr++; + } + } + + // Can't do a memcpy since ths is going from float to double data type + if((complexTimeDomainData != NULL) && (complexTimeDomainDataSize > 0)){ + const float* complexTimeDomainDataPtr = complexTimeDomainData; + + double* realTimeDomainPointsPtr = _realTimeDomainPoints; + double* imagTimeDomainPointsPtr = _imagTimeDomainPoints; + + timeDomainBufferSize = complexTimeDomainDataSize; + for( uint64_t number = 0; number < complexTimeDomainDataSize; number++){ + *realTimeDomainPointsPtr++ = *complexTimeDomainDataPtr++; + *imagTimeDomainPointsPtr++ = *complexTimeDomainDataPtr++; + } + } + } + + // If bufferSize is zero, then just update the display by sending over the old data + if(bufferSize < 1){ + bufferSize = _lastDataPointCount; + repeatDataFlag = true; + } + else{ + // Since there is data this time, update the count + _lastDataPointCount = bufferSize; + } + + const timespec currentTime = get_highres_clock(); + const timespec lastUpdateGUITime = GetLastGUIUpdateTime(); + + 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++; + } + else{ + // Draw the Data + IncrementPendingGUIUpdateEvents(); + qApp->postEvent(_spectrumDisplayForm, + new SpectrumUpdateEvent(_fftPoints, bufferSize, + _realTimeDomainPoints, + _imagTimeDomainPoints, + timeDomainBufferSize, + timestamp, + repeatDataFlag, + lastOfMultipleFFTUpdateFlag, + currentTime, + _droppedEntriesCount)); + + // Only reset the dropped entries counter if this is not + // repeat data since repeat data is dropped by the display systems + if(!repeatDataFlag){ + _droppedEntriesCount = 0; + } + } +} + +float +SpectrumGUIClass::GetPowerValue() const +{ + float returnValue = 0; + //_windowStateLock->Lock(); + returnValue = _powerValue; + //_windowStateLock->Unlock(); + return returnValue; +} + +void +SpectrumGUIClass::SetPowerValue(const float value) +{ + //_windowStateLock->Lock(); + _powerValue = value; + //_windowStateLock->Unlock(); +} + +int +SpectrumGUIClass::GetWindowType() const +{ + int returnValue = 0; + //_windowStateLock->Lock(); + returnValue = _windowType; + //_windowStateLock->Unlock(); + return returnValue; +} + +void +SpectrumGUIClass::SetWindowType(const int newType) +{ + //_windowStateLock->Lock(); + _windowType = newType; + //_windowStateLock->Unlock(); +} + +int +SpectrumGUIClass::GetFFTSize() const +{ + int returnValue = 0; + //_windowStateLock->Lock(); + returnValue = _fftSize; + //_windowStateLock->Unlock(); + return returnValue; +} + +int +SpectrumGUIClass::GetFFTSizeIndex() const +{ + int fftsize = GetFFTSize(); + switch(fftsize) { + case(1024): return 0; break; + case(2048): return 1; break; + case(4096): return 2; break; + case(8192): return 3; break; + case(16384): return 3; break; + case(32768): return 3; break; + default: return 0; + } +} + +void +SpectrumGUIClass::SetFFTSize(const int newSize) +{ + //_windowStateLock->Lock(); + _fftSize = newSize; + //_windowStateLock->Unlock(); +} + +timespec +SpectrumGUIClass::GetLastGUIUpdateTime() const +{ + timespec returnValue; + //_windowStateLock->Lock(); + returnValue = _lastGUIUpdateTime; + //_windowStateLock->Unlock(); + return returnValue; +} + +void +SpectrumGUIClass::SetLastGUIUpdateTime(const timespec newTime) +{ + //_windowStateLock->Lock(); + _lastGUIUpdateTime = newTime; + //_windowStateLock->Unlock(); +} + +unsigned int +SpectrumGUIClass::GetPendingGUIUpdateEvents() const +{ + unsigned int returnValue = 0; + //_windowStateLock->Lock(); + returnValue = _pendingGUIUpdateEventsCount; + //_windowStateLock->Unlock(); + return returnValue; +} + +void +SpectrumGUIClass::IncrementPendingGUIUpdateEvents() +{ + //_windowStateLock->Lock(); + _pendingGUIUpdateEventsCount++; + //_windowStateLock->Unlock(); +} + +void +SpectrumGUIClass::DecrementPendingGUIUpdateEvents() +{ + //_windowStateLock->Lock(); + if(_pendingGUIUpdateEventsCount > 0){ + _pendingGUIUpdateEventsCount--; + } + //_windowStateLock->Unlock(); +} + +void +SpectrumGUIClass::ResetPendingGUIUpdateEvents() +{ + //_windowStateLock->Lock(); + _pendingGUIUpdateEventsCount = 0; + //_windowStateLock->Unlock(); +} + + +QWidget* +SpectrumGUIClass::qwidget() +{ + return (QWidget*)_spectrumDisplayForm; +} + +void +SpectrumGUIClass::SetTimeDomainAxis(double min, double max) +{ + _spectrumDisplayForm->SetTimeDomainAxis(min, max); +} + +void +SpectrumGUIClass::SetConstellationAxis(double xmin, double xmax, + double ymin, double ymax) +{ + _spectrumDisplayForm->SetConstellationAxis(xmin, xmax, ymin, ymax); + +} + +void +SpectrumGUIClass::SetConstellationPenSize(int size){ + _spectrumDisplayForm->SetConstellationPenSize(size); +} + + +void +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 */ -- 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/SpectrumGUIClass.cc | 96 +++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 55 deletions(-) (limited to 'gr-qtgui/lib/SpectrumGUIClass.cc') diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index 052730fc2..c62f34290 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -37,15 +37,13 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, _windowOpennedFlag = false; _fftBuffersCreatedFlag = false; - // Create Mutex Lock - //_windowStateLock = new MutexClass("_windowStateLock"); - _powerValue = 1; } SpectrumGUIClass::~SpectrumGUIClass() { if(GetWindowOpenFlag()){ + printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); delete _spectrumDisplayForm; } @@ -54,8 +52,6 @@ SpectrumGUIClass::~SpectrumGUIClass() delete[] _realTimeDomainPoints; delete[] _imagTimeDomainPoints; } - - //delete _windowStateLock; } void @@ -64,7 +60,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool time, const bool constellation, const bool use_openGL) { - //_windowStateLock->Lock(); + d_mutex.lock(); if(!_windowOpennedFlag){ @@ -82,6 +78,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Called from the Event Thread _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); + printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); @@ -95,8 +92,8 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->processEvents(); } + d_mutex.unlock(); - //_windowStateLock->Unlock(); SetDisplayTitle(_title); Reset(); @@ -104,7 +101,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->postEvent(_spectrumDisplayForm, new QEvent(QEvent::Type(QEvent::User+3))); - qApp->processEvents(); + //qApp->processEvents(); timespec_reset(&_lastGUIUpdateTime); @@ -147,10 +144,9 @@ SpectrumGUIClass::SetDisplayTitle(const std::string newString) bool SpectrumGUIClass::GetWindowOpenFlag() { + gruel::scoped_lock lock(d_mutex); bool returnFlag = false; - //_windowStateLock->Lock(); returnFlag = _windowOpennedFlag; - //_windowStateLock->Unlock(); return returnFlag; } @@ -158,9 +154,8 @@ SpectrumGUIClass::GetWindowOpenFlag() void SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _windowOpennedFlag = newFlag; - //_windowStateLock->Unlock(); } void @@ -168,7 +163,7 @@ SpectrumGUIClass::SetFrequencyRange(const double centerFreq, const double startFreq, const double stopFreq) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _centerFrequency = centerFreq; _startFrequency = startFreq; _stopFrequency = stopFreq; @@ -176,36 +171,32 @@ SpectrumGUIClass::SetFrequencyRange(const double centerFreq, _spectrumDisplayForm->SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); - //_windowStateLock->Unlock(); } double -SpectrumGUIClass::GetStartFrequency() const +SpectrumGUIClass::GetStartFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _startFrequency; - //_windowStateLock->Unlock(); return returnValue; } double -SpectrumGUIClass::GetStopFrequency() const +SpectrumGUIClass::GetStopFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _stopFrequency; - //_windowStateLock->Unlock(); return returnValue; } double -SpectrumGUIClass::GetCenterFrequency() const +SpectrumGUIClass::GetCenterFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _centerFrequency; - //_windowStateLock->Unlock(); return returnValue; } @@ -221,6 +212,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, const timespec timestamp, const bool lastOfMultipleFFTUpdateFlag) { + //gruel::scoped_lock lock(d_mutex); int64_t bufferSize = inputBufferSize; bool repeatDataFlag = false; if(bufferSize > _dataPoints){ @@ -302,54 +294,49 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, } float -SpectrumGUIClass::GetPowerValue() const +SpectrumGUIClass::GetPowerValue() { + gruel::scoped_lock lock(d_mutex); float returnValue = 0; - //_windowStateLock->Lock(); returnValue = _powerValue; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetPowerValue(const float value) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _powerValue = value; - //_windowStateLock->Unlock(); } int -SpectrumGUIClass::GetWindowType() const +SpectrumGUIClass::GetWindowType() { + gruel::scoped_lock lock(d_mutex); int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _windowType; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetWindowType(const int newType) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _windowType = newType; - //_windowStateLock->Unlock(); } int -SpectrumGUIClass::GetFFTSize() const +SpectrumGUIClass::GetFFTSize() { int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _fftSize; - //_windowStateLock->Unlock(); return returnValue; } int -SpectrumGUIClass::GetFFTSizeIndex() const +SpectrumGUIClass::GetFFTSizeIndex() { + gruel::scoped_lock lock(d_mutex); int fftsize = GetFFTSize(); switch(fftsize) { case(1024): return 0; break; @@ -365,75 +352,70 @@ SpectrumGUIClass::GetFFTSizeIndex() const void SpectrumGUIClass::SetFFTSize(const int newSize) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _fftSize = newSize; - //_windowStateLock->Unlock(); } timespec -SpectrumGUIClass::GetLastGUIUpdateTime() const +SpectrumGUIClass::GetLastGUIUpdateTime() { + gruel::scoped_lock lock(d_mutex); timespec returnValue; - //_windowStateLock->Lock(); returnValue = _lastGUIUpdateTime; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetLastGUIUpdateTime(const timespec newTime) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _lastGUIUpdateTime = newTime; - //_windowStateLock->Unlock(); } unsigned int -SpectrumGUIClass::GetPendingGUIUpdateEvents() const +SpectrumGUIClass::GetPendingGUIUpdateEvents() { + gruel::scoped_lock lock(d_mutex); unsigned int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _pendingGUIUpdateEventsCount; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::IncrementPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount++; - //_windowStateLock->Unlock(); } void SpectrumGUIClass::DecrementPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); if(_pendingGUIUpdateEventsCount > 0){ _pendingGUIUpdateEventsCount--; } - //_windowStateLock->Unlock(); } void SpectrumGUIClass::ResetPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount = 0; - //_windowStateLock->Unlock(); } QWidget* SpectrumGUIClass::qwidget() { + gruel::scoped_lock lock(d_mutex); return (QWidget*)_spectrumDisplayForm; } void SpectrumGUIClass::SetTimeDomainAxis(double min, double max) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetTimeDomainAxis(min, max); } @@ -441,12 +423,14 @@ void SpectrumGUIClass::SetConstellationAxis(double xmin, double xmax, double ymin, double ymax) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetConstellationAxis(xmin, xmax, ymin, ymax); - } void -SpectrumGUIClass::SetConstellationPenSize(int size){ +SpectrumGUIClass::SetConstellationPenSize(int size) +{ + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetConstellationPenSize(size); } @@ -454,12 +438,14 @@ SpectrumGUIClass::SetConstellationPenSize(int size){ void SpectrumGUIClass::SetFrequencyAxis(double min, double max) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetFrequencyAxis(min, max); } void SpectrumGUIClass::SetUpdateTime(double t) { + gruel::scoped_lock lock(d_mutex); _updateTime = t; _spectrumDisplayForm->SetUpdateTime(_updateTime); } -- cgit From 484b6a0715f2ed6e4f460ee05887e1e5c98c1e2f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 6 Apr 2011 00:05:05 -0400 Subject: gr-qtgui: don't delete the SpectrumDisplayWindow; as a QWidget, it takes care of itself when the parent is deleted. --- gr-qtgui/lib/SpectrumGUIClass.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gr-qtgui/lib/SpectrumGUIClass.cc') diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index c62f34290..3342c0cb3 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -42,10 +42,12 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, SpectrumGUIClass::~SpectrumGUIClass() { - if(GetWindowOpenFlag()){ - printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); - delete _spectrumDisplayForm; - } + // We don't need to delete this since as a QWidget, it is supposed to be destroyed + // with it's parent. Deleting it causes a segmentation fault, and not deleting it + // does not leave any extra memory. + //if(GetWindowOpenFlag()){ + //delete _spectrumDisplayForm; + //} if(_fftBuffersCreatedFlag){ delete[] _fftPoints; @@ -78,7 +80,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Called from the Event Thread _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); - printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); @@ -101,8 +102,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->postEvent(_spectrumDisplayForm, new QEvent(QEvent::Type(QEvent::User+3))); - //qApp->processEvents(); - timespec_reset(&_lastGUIUpdateTime); // Draw Blank Display -- 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/SpectrumGUIClass.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gr-qtgui/lib/SpectrumGUIClass.cc') diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index 3342c0cb3..1a519591d 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -59,8 +59,7 @@ SpectrumGUIClass::~SpectrumGUIClass() void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool frequency, const bool waterfall, - const bool time, const bool constellation, - const bool use_openGL) + const bool time, const bool constellation) { d_mutex.lock(); @@ -79,7 +78,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, } // Called from the Event Thread - _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); + _spectrumDisplayForm = new SpectrumDisplayForm(parent); // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); -- cgit