diff options
author | Tom Rondeau | 2011-04-08 15:37:29 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-04-08 15:37:29 -0400 |
commit | 21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb (patch) | |
tree | 4e72909a051b0a4ac428252d15f34b53bcc986b6 /gr-qtgui/src | |
parent | d7093fd06d0ec37f6ba2841d202fe90f4fa3661e (diff) | |
parent | 5c358afd00347f5da7a59dd73ea79cd3df26659d (diff) | |
download | gnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.tar.gz gnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.tar.bz2 gnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.zip |
Merge branch 'master' into constell_obj
Conflicts:
gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
gr-audio-oss/src/Makefile.swig.gen
gr-audio/swig/Makefile.swig.gen
Diffstat (limited to 'gr-qtgui/src')
-rw-r--r-- | gr-qtgui/src/lib/qtgui.h | 17 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_c.cc | 13 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_c.h | 4 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_f.cc | 13 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_f.h | 4 | ||||
-rw-r--r-- | gr-qtgui/src/python/.gitignore | 1 | ||||
-rw-r--r-- | gr-qtgui/src/python/Makefile.am | 21 | ||||
-rwxr-xr-x | gr-qtgui/src/python/qa_qtgui.py | 46 | ||||
-rw-r--r-- | gr-qtgui/src/python/run_tests.in | 10 |
9 files changed, 94 insertions, 35 deletions
diff --git a/gr-qtgui/src/lib/qtgui.h b/gr-qtgui/src/lib/qtgui.h index 6edbca12c..9831697ac 100644 --- a/gr-qtgui/src/lib/qtgui.h +++ b/gr-qtgui/src/lib/qtgui.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,30 +23,31 @@ #ifndef INCLUDED_QTGUI_H #define INCLUDED_QTGUI_H +#include <gruel/thread.h> #include <qapplication.h> #include "SpectrumGUIClass.h" class qtgui_event : public QEvent { private: - pthread_mutex_t *pmutex; + gruel::mutex &d_mutex; public: - qtgui_event(pthread_mutex_t *mut) - : QEvent((QEvent::Type)(QEvent::User+101)) + qtgui_event(gruel::mutex &mutex) + : QEvent((QEvent::Type)(QEvent::User+101)), + d_mutex(mutex) { - pmutex = mut; + //nop } void lock() { - pthread_mutex_lock(pmutex); - + d_mutex.lock(); } void unlock() { - pthread_mutex_unlock(pmutex); + d_mutex.unlock(); } }; diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc index c12c451b0..05c7b28d5 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/src/lib/qtgui_sink_c.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -72,7 +72,6 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, } d_main_gui = NULL; - pthread_mutex_init(&d_pmutex, NULL); lock(); // Perform fftshift operation; @@ -107,12 +106,12 @@ qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) void qtgui_sink_c::lock() { - pthread_mutex_lock(&d_pmutex); + d_mutex.lock(); } void qtgui_sink_c::unlock() { - pthread_mutex_unlock(&d_pmutex); + d_mutex.unlock(); } @@ -151,7 +150,7 @@ qtgui_sink_c::initialize(const bool opengl) set_update_time(0.1); d_object = new qtgui_obj(d_qApplication); - qApp->postEvent(d_object, new qtgui_event(&d_pmutex)); + qApp->postEvent(d_object, new qtgui_event(d_mutex)); } @@ -289,7 +288,7 @@ qtgui_sink_c::general_work (int noutput_items, int j=0; const gr_complex *in = (const gr_complex*)input_items[0]; - pthread_mutex_lock(&d_pmutex); + gruel::scoped_lock lock(d_mutex); // Update the FFT size from the application fftresize(); @@ -322,8 +321,6 @@ qtgui_sink_c::general_work (int noutput_items, } } - pthread_mutex_unlock(&d_pmutex); - consume_each(j); return j; } diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h index 9aee66503..bbf9983b0 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/src/lib/qtgui_sink_c.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009 Free Software Foundation, Inc. + * Copyright 2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -76,7 +76,7 @@ private: double d_bandwidth; std::string d_name; - pthread_mutex_t d_pmutex; + gruel::mutex d_mutex; bool d_shift; gri_fft_complex *d_fft; diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc index ab4fd082d..984c2803c 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/src/lib/qtgui_sink_f.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -72,7 +72,6 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, } d_main_gui = NULL; - pthread_mutex_init(&d_pmutex, NULL); lock(); // Perform fftshift operation; @@ -107,12 +106,12 @@ qtgui_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required) void qtgui_sink_f::lock() { - pthread_mutex_lock(&d_pmutex); + d_mutex.lock(); } void qtgui_sink_f::unlock() { - pthread_mutex_unlock(&d_pmutex); + d_mutex.unlock(); } void @@ -146,7 +145,7 @@ qtgui_sink_f::initialize(const bool opengl) set_update_time(0.1); d_object = new qtgui_obj(d_qApplication); - qApp->postEvent(d_object, new qtgui_event(&d_pmutex)); + qApp->postEvent(d_object, new qtgui_event(d_mutex)); } void @@ -284,7 +283,7 @@ qtgui_sink_f::general_work (int noutput_items, int j=0; const float *in = (const float*)input_items[0]; - pthread_mutex_lock(&d_pmutex); + gruel::scoped_lock lock(d_mutex); // Update the FFT size from the application fftresize(); @@ -317,8 +316,6 @@ qtgui_sink_f::general_work (int noutput_items, } } - pthread_mutex_unlock(&d_pmutex); - consume_each(j); return j; } diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h index 0cac35d90..d80a6a198 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/src/lib/qtgui_sink_f.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009 Free Software Foundation, Inc. + * Copyright 2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -74,7 +74,7 @@ private: double d_bandwidth; std::string d_name; - pthread_mutex_t d_pmutex; + gruel::mutex d_mutex; bool d_shift; gri_fft_complex *d_fft; diff --git a/gr-qtgui/src/python/.gitignore b/gr-qtgui/src/python/.gitignore index b336cc7ce..604b402c5 100644 --- a/gr-qtgui/src/python/.gitignore +++ b/gr-qtgui/src/python/.gitignore @@ -1,2 +1,3 @@ /Makefile /Makefile.in +/run_tests diff --git a/gr-qtgui/src/python/Makefile.am b/gr-qtgui/src/python/Makefile.am index 31df63a44..0953a71e5 100644 --- a/gr-qtgui/src/python/Makefile.am +++ b/gr-qtgui/src/python/Makefile.am @@ -21,18 +21,25 @@ include $(top_srcdir)/Makefile.common +TESTS = +EXTRA_DIST += run_tests.in \ + qt_digital_window.ui + +if PYTHON +TESTS += run_tests +DISTCLEANFILES += run_tests + +qtguipythondir = $(grpythondir)/qtgui + noinst_PYTHON = \ pyqt_example_f.py \ pyqt_example.py \ qt_digital.py \ qt_digital_window.py \ usrp2_display.py \ - usrp_display.py - -EXTRA_DIST += \ - qt_digital_window.ui - -qtguipythondir = $(grpythondir)/qtgui + usrp_display.py \ + qa_qtgui.py -qtguipython_PYTHON = \ +qtguipython_PYTHON = \ __init__.py +endif diff --git a/gr-qtgui/src/python/qa_qtgui.py b/gr-qtgui/src/python/qa_qtgui.py new file mode 100755 index 000000000..fbf0de46e --- /dev/null +++ b/gr-qtgui/src/python/qa_qtgui.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import qtgui +from PyQt4 import QtGui, QtCore +import sys, sip + +class test_qtgui(gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test01 (self): + pass + # Test to make sure we can instantiate these + #self.qapp = QtGui.QApplication(sys.argv) + #self.qtsnk = qtgui.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS, + # 0, 1, "Test", + # True, True, False, True, True) + + +if __name__ == '__main__': + gr_unittest.run(test_qtgui, "test_qtgui.xml") diff --git a/gr-qtgui/src/python/run_tests.in b/gr-qtgui/src/python/run_tests.in new file mode 100644 index 000000000..909194752 --- /dev/null +++ b/gr-qtgui/src/python/run_tests.in @@ -0,0 +1,10 @@ +#!/bin/sh + +# 1st parameter is absolute path to component source directory +# 2nd parameter is absolute path to component build directory +# 3rd parameter is path to Python QA directory + +@top_builddir@/run_tests.sh \ + @abs_top_srcdir@/gr-qtgui \ + @abs_top_builddir@/gr-qtgui \ + @srcdir@ |