summaryrefslogtreecommitdiff
path: root/gr-qtgui
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui')
-rw-r--r--gr-qtgui/Makefile.am12
-rw-r--r--gr-qtgui/apps/.gitignore3
-rw-r--r--gr-qtgui/apps/Makefile.am45
-rw-r--r--gr-qtgui/apps/grc_qt_example.grc441
-rwxr-xr-xgr-qtgui/apps/pyqt_example_c.py (renamed from gr-qtgui/src/python/pyqt_example.py)15
-rwxr-xr-xgr-qtgui/apps/pyqt_example_f.py (renamed from gr-qtgui/src/python/pyqt_example_f.py)15
-rwxr-xr-xgr-qtgui/apps/qt_digital.py (renamed from gr-qtgui/src/python/qt_digital.py)6
-rw-r--r--gr-qtgui/apps/qt_digital_window.py (renamed from gr-qtgui/src/python/qt_digital_window.py)0
-rw-r--r--gr-qtgui/apps/qt_digital_window.ui (renamed from gr-qtgui/src/python/qt_digital_window.ui)0
-rwxr-xr-xgr-qtgui/apps/usrp2_display.py (renamed from gr-qtgui/src/python/usrp2_display.py)2
-rwxr-xr-xgr-qtgui/apps/usrp_display.py (renamed from gr-qtgui/src/python/usrp_display.py)2
-rw-r--r--gr-qtgui/apps/usrp_display_qtgui.py (renamed from gr-qtgui/src/python/usrp_display_qtgui.py)0
-rw-r--r--gr-qtgui/apps/usrp_display_qtgui.ui (renamed from gr-qtgui/src/python/usrp_display_qtgui.ui)0
-rw-r--r--gr-qtgui/gnuradio-qtgui.pc.in11
-rw-r--r--gr-qtgui/grc/.gitignore (renamed from gr-qtgui/src/.gitignore)0
-rw-r--r--gr-qtgui/grc/Makefile.am33
-rw-r--r--gr-qtgui/grc/qtgui_check_box.xml83
-rw-r--r--gr-qtgui/grc/qtgui_chooser.xml251
-rw-r--r--gr-qtgui/grc/qtgui_entry.xml68
-rw-r--r--gr-qtgui/grc/qtgui_label.xml66
-rw-r--r--gr-qtgui/grc/qtgui_range.xml211
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.xml126
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.xml84
-rw-r--r--gr-qtgui/lib/.gitignore (renamed from gr-qtgui/src/lib/.gitignore)1
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc (renamed from gr-qtgui/src/lib/ConstellationDisplayPlot.cc)33
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.h (renamed from gr-qtgui/src/lib/ConstellationDisplayPlot.h)8
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc (renamed from gr-qtgui/src/lib/FrequencyDisplayPlot.cc)57
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.h (renamed from gr-qtgui/src/lib/FrequencyDisplayPlot.h)16
-rw-r--r--gr-qtgui/lib/Makefile.am (renamed from gr-qtgui/src/lib/Makefile.am)39
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc (renamed from gr-qtgui/src/lib/SpectrumGUIClass.cc)108
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.h (renamed from gr-qtgui/src/lib/SpectrumGUIClass.h)27
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc (renamed from gr-qtgui/src/lib/TimeDomainDisplayPlot.cc)22
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.h (renamed from gr-qtgui/src/lib/TimeDomainDisplayPlot.h)10
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc (renamed from gr-qtgui/src/lib/WaterfallDisplayPlot.cc)28
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h (renamed from gr-qtgui/src/lib/WaterfallDisplayPlot.h)8
-rw-r--r--gr-qtgui/lib/highResTimeFunctions.h (renamed from gr-qtgui/src/lib/highResTimeFunctions.h)0
-rw-r--r--gr-qtgui/lib/plot_waterfall.cc (renamed from gr-qtgui/src/lib/plot_waterfall.cc)0
-rw-r--r--gr-qtgui/lib/plot_waterfall.h (renamed from gr-qtgui/src/lib/plot_waterfall.h)0
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.cc (renamed from gr-qtgui/src/lib/qtgui_sink_c.cc)53
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.h (renamed from gr-qtgui/src/lib/qtgui_sink_c.h)24
-rw-r--r--gr-qtgui/lib/qtgui_sink_f.cc (renamed from gr-qtgui/src/lib/qtgui_sink_f.cc)44
-rw-r--r--gr-qtgui/lib/qtgui_sink_f.h (renamed from gr-qtgui/src/lib/qtgui_sink_f.h)23
-rw-r--r--gr-qtgui/lib/qtgui_util.cc71
-rw-r--r--gr-qtgui/lib/qtgui_util.h (renamed from gr-qtgui/src/lib/qtgui.h)62
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.cc (renamed from gr-qtgui/src/lib/spectrumUpdateEvents.cc)0
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.h (renamed from gr-qtgui/src/lib/spectrumUpdateEvents.h)0
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc (renamed from gr-qtgui/src/lib/spectrumdisplayform.cc)45
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.h (renamed from gr-qtgui/src/lib/spectrumdisplayform.h)13
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.ui (renamed from gr-qtgui/src/lib/spectrumdisplayform.ui)38
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.cc (renamed from gr-qtgui/src/lib/waterfallGlobalData.cc)0
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.h (renamed from gr-qtgui/src/lib/waterfallGlobalData.h)0
-rw-r--r--gr-qtgui/python/.gitignore (renamed from gr-qtgui/src/python/.gitignore)1
-rw-r--r--gr-qtgui/python/Makefile.am (renamed from gr-qtgui/src/python/Makefile.am)20
-rw-r--r--gr-qtgui/python/__init__.py25
-rwxr-xr-xgr-qtgui/python/qa_qtgui.py48
-rw-r--r--gr-qtgui/python/run_tests.in10
-rw-r--r--gr-qtgui/src/python/__init__.py0
-rw-r--r--gr-qtgui/swig/.gitignore2
-rw-r--r--gr-qtgui/swig/Makefile.am54
-rw-r--r--gr-qtgui/swig/Makefile.swig.gen (renamed from gr-qtgui/src/lib/Makefile.swig.gen)98
-rw-r--r--gr-qtgui/swig/__init__.py (renamed from gr-qtgui/src/Makefile.am)9
-rw-r--r--gr-qtgui/swig/qtgui.i (renamed from gr-qtgui/src/lib/qtgui.i)52
-rw-r--r--gr-qtgui/swig/qtgui_swig.i32
63 files changed, 2097 insertions, 458 deletions
diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am
index d53f96c1f..cc194e4c0 100644
--- a/gr-qtgui/Makefile.am
+++ b/gr-qtgui/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,5 +21,11 @@
include $(top_srcdir)/Makefile.common
-SUBDIRS = src
-DIST_SUBDIRS = src
+SUBDIRS = lib
+
+if PYTHON
+SUBDIRS += swig python apps grc
+endif
+
+pkgconfigdir = $(libdir)/pkgconfig
+dist_pkgconfig_DATA = gnuradio-qtgui.pc
diff --git a/gr-qtgui/apps/.gitignore b/gr-qtgui/apps/.gitignore
new file mode 100644
index 000000000..943275d5c
--- /dev/null
+++ b/gr-qtgui/apps/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+grc_qt_example.py
diff --git a/gr-qtgui/apps/Makefile.am b/gr-qtgui/apps/Makefile.am
new file mode 100644
index 000000000..c8d967334
--- /dev/null
+++ b/gr-qtgui/apps/Makefile.am
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+if PYTHON
+
+nodist_bin_SCRIPTS = \
+ qt_digital_window.ui \
+ usrp_display_qtgui.ui
+
+noinst_PYTHON = \
+ pyqt_example_f.py \
+ pyqt_example_c.py \
+ qt_digital.py \
+ qt_digital_window.py \
+ usrp2_display.py \
+ usrp_display.py \
+ qt_digital_window.py \
+ usrp_display_qtgui.py
+
+EXTRA_DIST += \
+ qt_digital_window.ui \
+ usrp_display_qtgui.ui
+endif
+
+EXTRA_DIST +=
diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc
new file mode 100644
index 000000000..170cd546a
--- /dev/null
+++ b/gr-qtgui/apps/grc_qt_example.grc
@@ -0,0 +1,441 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Apr 10 16:49:13 2011</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>grc_qt_example</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(511, 96)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Signal Frequency</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>samp_rate/2.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>samp_rate/100.0</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(169, 187)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>amp</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(295, 64)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>amp</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Signal Amplitude</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(311, 187)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Noise Amplitude</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(723, 191)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_channel_model</key>
+ <param>
+ <key>id</key>
+ <value>gr_channel_model_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>noise_voltage</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>1.0 + 0.0j</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>42</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(727, 64)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>fftsize</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
+ </param>
+ <param>
+ <key>fc</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>bw</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>plotfreq</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plotwaterfall</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plottime</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plotconst</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(958, 72)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_sig_source_x_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_channel_model_0</source_block_id>
+ <sink_block_id>qtgui_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-qtgui/src/python/pyqt_example.py b/gr-qtgui/apps/pyqt_example_c.py
index 7c0cfc698..e1b58442f 100755
--- a/gr-qtgui/src/python/pyqt_example.py
+++ b/gr-qtgui/apps/pyqt_example_c.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from gnuradio import gr
-from gnuradio.qtgui import qtgui
+from gnuradio import qtgui
from PyQt4 import QtGui, QtCore
import sys, sip
@@ -28,11 +28,13 @@ class control_box(QtGui.QWidget):
# Control the first signal
self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
self.freq1EditText)
self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
self.amp1EditText)
@@ -40,17 +42,20 @@ class control_box(QtGui.QWidget):
# Control the second signal
self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
self.freq2EditText)
self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
self.amp2EditText)
self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
self.layout.addWidget(self.quit)
self.connect(self.quit, QtCore.SIGNAL('clicked()'),
@@ -116,7 +121,7 @@ class my_top_block(gr.top_block):
self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Complex Signal Example",
- True, True, False, True, False)
+ True, True, True, False)
self.connect(src1, (src,0))
self.connect(src2, (src,1))
@@ -131,14 +136,14 @@ 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
- self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
- self.main_box = dialog_box(self.pyWin, self.ctrl_win)
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
self.main_box.show()
if __name__ == "__main__":
tb = my_top_block();
tb.start()
- tb.qapp.exec_()
+ sys.exit(tb.qapp.exec_())
diff --git a/gr-qtgui/src/python/pyqt_example_f.py b/gr-qtgui/apps/pyqt_example_f.py
index 4e36ccca5..6b2131019 100755
--- a/gr-qtgui/src/python/pyqt_example_f.py
+++ b/gr-qtgui/apps/pyqt_example_f.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from gnuradio import gr, blks2
-from gnuradio.qtgui import qtgui
+from gnuradio import qtgui
from PyQt4 import QtGui, QtCore
import sys, sip
@@ -28,11 +28,13 @@ class control_box(QtGui.QWidget):
# Control the first signal
self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
self.freq1EditText)
self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
self.amp1EditText)
@@ -40,17 +42,20 @@ class control_box(QtGui.QWidget):
# Control the second signal
self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
self.freq2EditText)
self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
self.amp2EditText)
self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
self.layout.addWidget(self.quit)
self.connect(self.quit, QtCore.SIGNAL('clicked()'),
@@ -115,7 +120,7 @@ class my_top_block(gr.top_block):
self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Float Signal Example",
- True, True, False, True, False)
+ True, True, True, False)
self.connect(src1, (src,0))
self.connect(src2, (src,1))
@@ -130,14 +135,14 @@ 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
- self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
- self.main_box = dialog_box(self.pyWin, self.ctrl_win)
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
self.main_box.show()
if __name__ == "__main__":
tb = my_top_block();
tb.start()
- tb.qapp.exec_()
+ sys.exit(tb.qapp.exec_())
diff --git a/gr-qtgui/src/python/qt_digital.py b/gr-qtgui/apps/qt_digital.py
index 679f144ef..c6920a05d 100755
--- a/gr-qtgui/src/python/qt_digital.py
+++ b/gr-qtgui/apps/qt_digital.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from gnuradio import gr, blks2
-from gnuradio.qtgui import qtgui
+from gnuradio import qtgui
from gnuradio import eng_notation
from PyQt4 import QtGui, QtCore
import sys, sip
@@ -185,11 +185,11 @@ class my_top_block(gr.top_block):
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)
+ "Tx", True, True, True, True)
self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0, self._sample_rate,
- "Rx", True, True, False, True, True)
+ "Rx", True, True, True, True)
self.connect(self.src, self.thr, self.mod, self.channel, self.snk_tx)
self.connect(self.channel, self.rx_rrc, self.receiver, self.snk_rx)
diff --git a/gr-qtgui/src/python/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py
index 50dd53a92..50dd53a92 100644
--- a/gr-qtgui/src/python/qt_digital_window.py
+++ b/gr-qtgui/apps/qt_digital_window.py
diff --git a/gr-qtgui/src/python/qt_digital_window.ui b/gr-qtgui/apps/qt_digital_window.ui
index 967252181..967252181 100644
--- a/gr-qtgui/src/python/qt_digital_window.ui
+++ b/gr-qtgui/apps/qt_digital_window.ui
diff --git a/gr-qtgui/src/python/usrp2_display.py b/gr-qtgui/apps/usrp2_display.py
index 75d374c2b..ab1a6f742 100755
--- a/gr-qtgui/src/python/usrp2_display.py
+++ b/gr-qtgui/apps/usrp2_display.py
@@ -210,7 +210,7 @@ class my_top_block(gr.top_block):
self.snk = qtgui.sink_c(options.fft_size, gr.firdes.WIN_BLACKMAN_hARRIS,
self._freq, self._bandwidth,
"USRP2 Display",
- True, True, False, True, False)
+ True, True, True, False)
# Set up internal amplifier
self.amp = gr.multiply_const_cc(0.0)
diff --git a/gr-qtgui/src/python/usrp_display.py b/gr-qtgui/apps/usrp_display.py
index 432e74d9a..131bc4a7e 100755
--- a/gr-qtgui/src/python/usrp_display.py
+++ b/gr-qtgui/apps/usrp_display.py
@@ -229,7 +229,7 @@ class my_top_block(gr.top_block):
self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
self._freq, self._bandwidth,
"USRP Display",
- True, True, False, True, False)
+ True, True, True, False)
# Set up internal amplifier
self.amp = gr.multiply_const_cc(0.0)
diff --git a/gr-qtgui/src/python/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py
index 4c9de3a53..4c9de3a53 100644
--- a/gr-qtgui/src/python/usrp_display_qtgui.py
+++ b/gr-qtgui/apps/usrp_display_qtgui.py
diff --git a/gr-qtgui/src/python/usrp_display_qtgui.ui b/gr-qtgui/apps/usrp_display_qtgui.ui
index e88ca9dce..e88ca9dce 100644
--- a/gr-qtgui/src/python/usrp_display_qtgui.ui
+++ b/gr-qtgui/apps/usrp_display_qtgui.ui
diff --git a/gr-qtgui/gnuradio-qtgui.pc.in b/gr-qtgui/gnuradio-qtgui.pc.in
new file mode 100644
index 000000000..27b6a21bf
--- /dev/null
+++ b/gr-qtgui/gnuradio-qtgui.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-qtgui
+Description: GNU Radio blocks for QT GUI
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-qtgui
+Cflags: -I${includedir}
diff --git a/gr-qtgui/src/.gitignore b/gr-qtgui/grc/.gitignore
index b336cc7ce..b336cc7ce 100644
--- a/gr-qtgui/src/.gitignore
+++ b/gr-qtgui/grc/.gitignore
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am
new file mode 100644
index 000000000..b3114268c
--- /dev/null
+++ b/gr-qtgui/grc/Makefile.am
@@ -0,0 +1,33 @@
+#
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+grcblocksdir = $(grc_blocksdir)
+
+dist_grcblocks_DATA = \
+ qtgui_check_box.xml \
+ qtgui_entry.xml \
+ qtgui_label.xml \
+ qtgui_range.xml \
+ qtgui_sink_x.xml \
+ qtgui_tab_widget.xml \
+ qtgui_chooser.xml
diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml
new file mode 100644
index 000000000..95f4f968a
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_check_box.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Check Box:
+## a gui check box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Check Box</name>
+ <key>variable_qtgui_check_box</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = '_%s_check_box'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$win = Qt.QCheckBox($label)
+self._$(id)_choices = {True: $true, False: $false}
+self._$(id)_choices_inv = dict((v,k) for k,v in self._$(id)_choices.iteritems())
+self._$(id)_callback = lambda i: $(win).setChecked(self._$(id)_choices_inv[i])
+self._$(id)_callback(self.$id)
+$(win).stateChanged.connect(lambda i: self.set_$(id)(self._$(id)_choices[bool(i)]))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:float</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>True</name>
+ <key>true</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>False</name>
+ <key>false</key>
+ <value>False</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$value in ($true, $false)</check>
+ <doc>
+This block creates a variable check box. \
+Leave the label blank to use the variable id as the label.
+
+A check box selects between two values of similar type. \
+Te values do not necessarily need to be of boolean type.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml
new file mode 100644
index 000000000..cb5090289
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_chooser.xml
@@ -0,0 +1,251 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Chooser:
+## A chooser, radio buttons
+###################################################
+ -->
+<block>
+ <name>QT GUI Chooser</name>
+ <key>variable_qtgui_chooser</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#slurp
+#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())]
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())]
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+## Create the options list
+########################################################################
+#if int($num_opts())
+self._$(id)_options = (#slurp
+ #for $ch in $all_options
+$ch, #slurp
+ #end for
+)
+#else
+self._$(id)_options = $options
+#end if
+########################################################################
+## Create the labels list
+########################################################################
+#if int($num_opts())
+self._$(id)_labels = (#slurp
+ #for i, $lbl in enumerate($all_labels)
+ #if $lbl()
+$lbl, #slurp
+ #else
+str(self._$(id)_options[$i]), #slurp
+ #end if
+ #end for
+)
+#elif $labels()
+self._$(id)_labels = $labels
+#else
+self._$(id)_labels = map(str, self._$(id)_options)
+#end if
+########################################################################
+## Create the combo box
+########################################################################
+#if $widget() == 'combo_box'
+#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_combo_box = Qt.QComboBox()
+$(win).addWidget(self._$(id)_combo_box)
+for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label)
+self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i))
+self._$(id)_callback(self.$id)
+self._$(id)_combo_box.currentIndexChanged.connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+########################################################################
+## Create the radio buttons
+########################################################################
+#if $widget() == 'radio_buttons'
+#set $win = 'self._%s_group_box'%$id
+$win = Qt.QGroupBox($label)
+self._$(id)_box = $(orient)()
+self._$(id)_button_group = Qt.QButtonGroup()
+$(win).setLayout(self._$(id)_box)
+for i, label in enumerate(self._$(id)_labels):
+ radio_button = Qt.QRadioButton(label)
+ self._$(id)_box.addWidget(radio_button)
+ self._$(id)_button_group.addButton(radio_button, i)
+self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True)
+self._$(id)_callback(self.$id)
+self._$(id)_button_group.buttonClicked[int].connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key></option>
+ <option><name>Integer</name><key>int</key></option>
+ <option><name>String</name><key>string</key></option>
+ <option><name>Any</name><key>raw</key></option>
+ </param>
+ <param>
+ <name>Num Options</name>
+ <key>num_opts</key>
+ <value>3</value>
+ <type>enum</type>
+ <option><name>List</name><key>0</key></option>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>Options</name>
+ <key>options</key>
+ <value>[0, 1, 2]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Labels</name>
+ <key>labels</key>
+ <value>[]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Option 0</name>
+ <key>option0</key>
+ <value>0</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 1</name>
+ <key>option1</key>
+ <value>1</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 2</name>
+ <key>option2</key>
+ <value>2</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 3</name>
+ <key>option3</key>
+ <value>3</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 4</name>
+ <key>option4</key>
+ <value>4</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>combo_box</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Combo Box</name><key>combo_box</key></option>
+ <option><name>Radio Buttons</name><key>radio_buttons</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.QVBoxLayout</value>
+ <type>enum</type>
+ <hide>#if $widget() == 'radio_buttons' then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.QHBoxLayout</key>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.QVBoxLayout</key>
+ </option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with enumerated options. \
+The gui widget is implemented as a combo box or radio button group. \
+Leave the label blank to use the variable id as the label.
+
+Choose the number of options available to your chooser. \
+When the label is left blank, the option will be used as the label. \
+Set the number of options to "list" to enter a single list of options and labels. \
+When the labels is an empty list, the options will be used as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml
new file mode 100644
index 000000000..1a98402a0
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_entry.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Text Entry:
+## a gui text box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Entry</name>
+ <key>variable_qtgui_entry</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_line_edit = Qt.QLineEdit(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_line_edit)
+self._$(id)_line_edit.returnPressed.connect(
+ lambda: self.set_$(id)($(type.conv)(self._$(id)_line_edit.text().toAscii())))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_line_edit.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a text entry box. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
new file mode 100644
index 000000000..5049118c4
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Label Text:
+## a gui static text form
+###################################################
+ -->
+<block>
+ <name>QT GUI Label</name>
+ <key>variable_qtgui_label</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_label = Qt.QLabel(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_label)
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_label.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a label widget for text. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml
new file mode 100644
index 000000000..6b0555f98
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_range.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Range:
+## ranged widgets like a slider or a knob
+###################################################
+ -->
+<block>
+ <name>QT GUI Range</name>
+ <key>variable_qtgui_range</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>import PyQt4.Qwt5 as Qwt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_layout'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+#if $widget() == "knob"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_knob = Qwt.QwtKnob()
+self._$(id)_knob.setRange($start, $stop, $step)
+self._$(id)_knob.setValue(self.$id)
+self._$(id)_knob.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_knob)
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+#end if
+########################################################################
+#if $widget() == "thermo"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_thermo = Qwt.QwtThermo()
+self._$(id)_thermo.setScalePosition(Qwt.QwtThermo.$orient.scalepos)
+self._$(id)_thermo.setRange($start, $stop)
+self._$(id)_thermo.setValue(self.$id)
+self._$(id)_thermo.$(orient.minfcn)($min_len)
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_thermo)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_thermo)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter"
+########################################################################
+$win = Qt.QHBoxLayout()
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setMinimumWidth($min_len)
+self._$(id)_counter.setValue(self.$id)
+$(win).addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+#end if
+########################################################################
+#if $widget() == "slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, Qwt.QwtSlider.$orient.scalepos, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.$(orient.minfcn)($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_slider)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_slider)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter_slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_tool_bar = Qt.QToolBar(self)
+$(win).addWidget(self._$(id)_tool_bar)
+self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setValue(self.$id)
+self._$(id)_tool_bar.addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.setMinimumWidth($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_slider)
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>#if $widget() == "knob"
+self._$(id)_knob.setValue($id)
+#end if
+#if $widget() == "thermo"
+self._$(id)_thermo.setValue($id)
+#end if
+#if $widget() == "counter"
+self._$(id)_counter.setValue($id)
+#end if
+#if $widget() == "slider"
+self._$(id)_slider.setValue($id)
+#end if
+#if $widget() == "counter_slider"
+self._$(id)_counter.setValue($id)
+self._$(id)_slider.setValue($id)
+#end if</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>50</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Start</name>
+ <key>start</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Stop</name>
+ <key>stop</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Step</name>
+ <key>step</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>counter_slider</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Counter + Slider</name><key>counter_slider</key></option>
+ <option><name>Counter</name><key>counter</key></option>
+ <option><name>Slider</name><key>slider</key></option>
+ <option><name>Knob</name><key>knob</key></option>
+ <option><name>Thermo</name><key>thermo</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ <type>enum</type>
+ <hide>#if $widget() in ("slider", "thermo") then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.Horizontal</key>
+ <opt>scalepos:BottomScale</opt>
+ <opt>minfcn:setMinimumWidth</opt>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.Vertical</key>
+ <opt>scalepos:LeftScale</opt>
+ <opt>minfcn:setMinimumHeight</opt>
+ </option>
+ </param>
+ <param>
+ <name>Minimum Length</name>
+ <key>min_len</key>
+ <value>200</value>
+ <type>int</type>
+ <hide>#if $widget().split('_')[0] in ("slider", "counter", "thermo") then 'part' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$start &lt;= $value &lt;= $stop</check>
+ <check>$start &lt; $stop</check>
+ <doc>
+This block creates a variable with a slider. \
+Leave the label blank to use the variable id as the label. \
+The value must be a real number. \
+The value must be between the start and the stop.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
new file mode 100644
index 000000000..8c470a1a5
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Sink</name>
+ <key>qtgui_sink_x</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio.qtgui import qtgui</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
+ $fftsize, \#fftsize
+ $wintype, \#wintype
+ $fc, \#fc
+ $bw, \#bw
+ $name, \#name
+ $plotfreq, \#plotfreq
+ $plotwaterfall, \#plotwaterfall
+ $plottime, \#plottime
+ $plotconst, \#plotconst
+)
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_frequency_range($fc, $bw)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option>
+ <option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fftsize</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Window Type</name>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
+ <type>int</type>
+ <hide>part</hide>
+ <option>
+ <name>Blackman-harris</name>
+ <key>firdes.WIN_BLACKMAN_hARRIS</key>
+ </option>
+ </param>
+ <param>
+ <name>Center Frequency (Hz)</name>
+ <key>fc</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Bandwidth (Hz)</name>
+ <key>bw</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Plot Frequency</name>
+ <key>plotfreq</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Waterfall</name>
+ <key>plotwaterfall</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Time</name>
+ <key>plottime</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Const</name>
+ <key>plotconst</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml
new file mode 100644
index 000000000..f90054109
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_tab_widget.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WX GUI Notebook
+###################################################
+ -->
+<block>
+ <name>QT GUI Tab Widget</name>
+ <key>qtgui_tab_widget</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <make>#set $win = 'self.%s'%$id
+Qt.QTabWidget()
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_tabs())]
+#for i, label in enumerate($all_labels)
+self.$(id)_widget_$(i) = Qt.QWidget()
+self.$(id)_layout_$(i) = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.$(id)_widget_$(i))
+self.$(id)_grid_layout_$(i) = Qt.QGridLayout()
+self.$(id)_layout_$(i).addLayout(self.$(id)_grid_layout_$(i))
+$(win).addTab(self.$(id)_widget_$(i), $label)
+#end for
+$(gui_hint()($win))</make>
+ <param>
+ <name>Num Tabs</name>
+ <key>num_tabs</key>
+ <value>1</value>
+ <type>enum</type>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value>Tab 0</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value>Tab 1</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value>Tab 2</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value>Tab 3</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value>Tab 4</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a tabbed widget to organize other widgets. \
+The ID of this block can be used as the tab_id in the GUI hints of other widgets.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/src/lib/.gitignore b/gr-qtgui/lib/.gitignore
index 61b9ca8c1..fc4f8cdfe 100644
--- a/gr-qtgui/src/lib/.gitignore
+++ b/gr-qtgui/lib/.gitignore
@@ -5,7 +5,6 @@
/qtgui.cc
/qtgui.py
/WaterfallDisplayPlot.moc.cc
-/Waterfall3DDisplayPlot.moc.cc
/TimeDomainDisplayPlot.moc.cc
/spectrumdisplayform.moc.cc
/spectrumdisplayform.ui.h
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
index 9ad5bdd3c..75dbe9c37 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc
@@ -5,7 +5,7 @@
#include <qwt_scale_draw.h>
#include <qwt_legend.h>
-
+#include <iostream>
class ConstellationDisplayZoomer: public QwtPlotZoomer
{
@@ -74,18 +74,12 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
memset(_realDataPoints, 0x0, _numPoints*sizeof(double));
memset(_imagDataPoints, 0x0, _numPoints*sizeof(double));
- replot();
-
_zoomer = new ConstellationDisplayZoomer(canvas());
-#if QT_VERSION < 0x040000
- _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#else
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#endif
+ Qt::RightButton, Qt::ControlModifier);
_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
- Qt::RightButton);
+ Qt::RightButton);
_panner = new QwtPlotPanner(canvas());
_panner->setAxisEnabled(QwtPlot::yRight, false);
@@ -102,8 +96,13 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
_zoomer->setRubberBandPen(c);
_zoomer->setTrackerPen(c);
- connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ),
- this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) ));
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+
+ connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ),
+ this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) ));
}
ConstellationDisplayPlot::~ConstellationDisplayPlot()
@@ -178,8 +177,6 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints,
memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
- replot();
-
_lastReplot = get_highres_clock();
}
}
@@ -190,4 +187,12 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on)
plotItem->setVisible(!on);
}
+void
+ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
#endif /* CONSTELLATION_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h
index a441a8bfe..bf4531e0a 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.h
@@ -13,6 +13,7 @@
#include <qwt_plot_marker.h>
#include <highResTimeFunctions.h>
#include <qwt_symbol.h>
+#include <qtgui_util.h>
class ConstellationDisplayPlot : public QwtPlot
{
@@ -38,6 +39,11 @@ public:
public slots:
void resizeSlot( QSize *s );
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
protected slots:
void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
@@ -49,6 +55,8 @@ private:
QwtPlotPanner* _panner;
QwtPlotZoomer* _zoomer;
+ QwtDblClickPlotPicker *_picker;
+
double* _realDataPoints;
double* _imagDataPoints;
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index d150e2e4c..30b318184 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -148,7 +148,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints);
_max_fft_plot_curve->setVisible(false);
- _lower_intensity_marker = new QwtPlotMarker();
+ _lower_intensity_marker= new QwtPlotMarker();
_lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
_lower_intensity_marker->setLinePen(QPen(Qt::cyan));
_lower_intensity_marker->attach(this);
@@ -183,6 +183,12 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_markerNoiseFloorAmplitude->setLinePen(QPen(Qt::darkRed, 0, Qt::DotLine));
_markerNoiseFloorAmplitude->attach(this);
+ _markerCF= new QwtPlotMarker();
+ _markerCF->setLineStyle(QwtPlotMarker::VLine);
+ _markerCF->setLinePen(QPen(Qt::lightGray, 0, Qt::DotLine));
+ _markerCF->attach(this);
+ _markerCF->hide();
+
_peakFrequency = 0;
_peakAmplitude = -HUGE_VAL;
@@ -190,14 +196,19 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
replot();
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+
+ // Configure magnify on mouse wheel
+ _magnifier = new QwtPlotMagnifier(canvas());
+ _magnifier->setAxisEnabled(QwtPlot::xBottom, false);
+
_zoomer = new FreqDisplayZoomer(canvas(), 0);
-#if QT_VERSION < 0x040000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
-#else
- _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#endif
_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
Qt::RightButton);
@@ -256,6 +267,7 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq,
double stopFreq = constStopFreq / units;
double centerFreq = constCenterFreq / units;
+ _xAxisMultiplier = units;
_useCenterFrequencyFlag = useCenterFrequencyFlag;
if(_useCenterFrequencyFlag){
@@ -367,8 +379,6 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat
SetUpperIntensityLevel(_peakAmplitude);
- replot();
-
_lastReplot = get_highres_clock();
}
}
@@ -435,5 +445,36 @@ FrequencyDisplayPlot::SetUpperIntensityLevel(const double upperIntensityLevel)
_upper_intensity_marker->setYValue( upperIntensityLevel );
}
+void
+FrequencyDisplayPlot::SetTraceColour (QColor c)
+{
+ _fft_plot_curve->setPen(QPen(c));
+}
+
+void
+FrequencyDisplayPlot::SetBGColour (QColor c)
+{
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), c);
+ canvas()->setPalette(palette);
+}
+
+void
+FrequencyDisplayPlot::ShowCFMarker (const bool show)
+{
+ if (show)
+ _markerCF->show();
+ else
+ _markerCF->hide();
+}
+
+void
+FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier);
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
#endif /* FREQUENCY_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h
index 3c22c1397..7a207ab8d 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.h
@@ -12,8 +12,10 @@
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_marker.h>
+#include <qwt_plot_magnifier.h>
#include <highResTimeFunctions.h>
#include <qwt_symbol.h>
+#include <qtgui_util.h>
class FrequencyDisplayPlot:public QwtPlot{
Q_OBJECT
@@ -43,11 +45,20 @@ public:
void set_yaxis(double min, double max);
+ void SetTraceColour (QColor);
+ void SetBGColour (QColor c);
+ void ShowCFMarker (const bool);
+
public slots:
void resizeSlot( QSize *e );
void SetLowerIntensityLevel(const double);
void SetUpperIntensityLevel(const double);
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
protected:
private:
@@ -71,9 +82,14 @@ private:
QwtPlotMarker *_markerPeakAmplitude;
QwtPlotMarker *_markerNoiseFloorAmplitude;
+ QwtPlotMarker *_markerCF;
+
+ QwtDblClickPlotPicker *_picker;
+ QwtPlotMagnifier *_magnifier;
double* _dataPoints;
double* _xAxisPoints;
+ int _xAxisMultiplier;
double* _minFFTPoints;
double* _maxFFTPoints;
diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/lib/Makefile.am
index 446a07fd0..7dee39eb4 100644
--- a/gr-qtgui/src/lib/Makefile.am
+++ b/gr-qtgui/lib/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2008-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,7 +20,6 @@
#
include $(top_srcdir)/Makefile.common
-include $(top_srcdir)/Makefile.swig
EXTRA_DIST += spectrumdisplayform.ui
@@ -54,7 +53,8 @@ libgnuradio_qtgui_la_SOURCES = \
spectrumUpdateEvents.cc \
plot_waterfall.cc \
qtgui_sink_c.cc \
- qtgui_sink_f.cc
+ qtgui_sink_f.cc \
+ qtgui_util.cc
nodist_libgnuradio_qtgui_la_SOURCES=$(QMAKE_SOURCES)
@@ -70,11 +70,12 @@ grinclude_HEADERS = \
spectrumdisplayform.h \
SpectrumGUIClass.h \
spectrumUpdateEvents.h \
- qtgui.h \
qtgui_sink_c.h \
- qtgui_sink_f.h
+ qtgui_sink_f.h \
+ qtgui_util.h
-QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
+#QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
+QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
%.moc.cc : %.h
$(QT_MOC_EXEC) $(QT_MOC_FLAGS) -p $(srcdir) $< -o $@
@@ -85,26 +86,8 @@ QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LI
libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) $(LTVERSIONFLAGS)
libgnuradio_qtgui_la_LIBADD = \
- $(GNURADIO_CORE_LA) \
- $(BOOST_THREAD_LIB) \
- $(BOOST_DATE_TIME_LIB) \
- -lstdc++ \
+ $(GNURADIO_CORE_LA) \
+ $(BOOST_THREAD_LIB) \
+ $(BOOST_DATE_TIME_LIB) \
+ -lstdc++ \
$(QT_LIBS)
-
-
-##############################
-# SWIG interfaces and libraries
-
-TOP_SWIG_IFILES = \
- qtgui.i
-
-# Install so that they end up available as:
-# import gnuradio.qtgui
-# This ends up at:
-# ${prefix}/lib/python${python_version}/site-packages/gnuradio
-qtgui_pythondir_category = \
- gnuradio/qtgui
-
-# additional libraries for linking with the SWIG-generated library
-qtgui_la_swig_libadd = \
- libgnuradio-qtgui.la
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index 052730fc2..1a519591d 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -37,34 +37,31 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
_windowOpennedFlag = false;
_fftBuffersCreatedFlag = false;
- // Create Mutex Lock
- //_windowStateLock = new MutexClass("_windowStateLock");
-
_powerValue = 1;
}
SpectrumGUIClass::~SpectrumGUIClass()
{
- if(GetWindowOpenFlag()){
- 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;
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)
+ const bool time, const bool constellation)
{
- //_windowStateLock->Lock();
+ d_mutex.lock();
if(!_windowOpennedFlag){
@@ -81,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);
@@ -95,8 +92,8 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
qApp->processEvents();
}
+ d_mutex.unlock();
- //_windowStateLock->Unlock();
SetDisplayTitle(_title);
Reset();
@@ -104,8 +101,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
qApp->postEvent(_spectrumDisplayForm,
new QEvent(QEvent::Type(QEvent::User+3)));
- qApp->processEvents();
-
timespec_reset(&_lastGUIUpdateTime);
// Draw Blank Display
@@ -147,10 +142,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 +152,8 @@ SpectrumGUIClass::GetWindowOpenFlag()
void
SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag)
{
- //_windowStateLock->Lock();
+ gruel::scoped_lock lock(d_mutex);
_windowOpennedFlag = newFlag;
- //_windowStateLock->Unlock();
}
void
@@ -168,7 +161,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 +169,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 +210,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 +292,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 +350,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 +421,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 +436,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);
}
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h
index 57a749a6a..48f45a0f5 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/lib/SpectrumGUIClass.h
@@ -1,15 +1,13 @@
#ifndef SPECTRUM_GUI_CLASS_HPP
#define SPECTRUM_GUI_CLASS_HPP
-//#include <mutexClass.hpp>
+#include <gruel/thread.h>
#include <qwidget.h>
#include <qapplication.h>
#include <qlabel.h>
#include <qslider.h>
#include <spectrumUpdateEvents.h>
-//#include <Windowing.hpp>
-
class SpectrumDisplayForm;
#include <spectrumdisplayform.h>
@@ -31,17 +29,16 @@ public:
void OpenSpectrumWindow(QWidget*,
const bool frequency=true, const bool waterfall=true,
- const bool time=true, const bool constellation=true,
- const bool use_openGL=true);
+ const bool time=true, const bool constellation=true);
void SetDisplayTitle(const std::string);
bool GetWindowOpenFlag();
void SetWindowOpenFlag(const bool);
void SetFrequencyRange(const double, const double, const double);
- double GetStartFrequency()const;
- double GetStopFrequency()const;
- double GetCenterFrequency()const;
+ double GetStartFrequency();
+ double GetStopFrequency();
+ double GetCenterFrequency();
void UpdateWindow(const bool, const std::complex<float>*,
const uint64_t, const float*,
@@ -49,20 +46,20 @@ public:
const uint64_t,
const timespec, const bool);
- float GetPowerValue()const;
+ float GetPowerValue();
void SetPowerValue(const float);
- int GetWindowType()const;
+ int GetWindowType();
void SetWindowType(const int);
- int GetFFTSize()const;
- int GetFFTSizeIndex()const;
+ int GetFFTSize();
+ int GetFFTSizeIndex();
void SetFFTSize(const int);
- timespec GetLastGUIUpdateTime()const;
+ timespec GetLastGUIUpdateTime();
void SetLastGUIUpdateTime(const timespec);
- unsigned int GetPendingGUIUpdateEvents()const;
+ unsigned int GetPendingGUIUpdateEvents();
void IncrementPendingGUIUpdateEvents();
void DecrementPendingGUIUpdateEvents();
void ResetPendingGUIUpdateEvents();
@@ -84,7 +81,7 @@ protected:
private:
- //MutexClass* _windowStateLock;
+ gruel::mutex d_mutex;
int64_t _dataPoints;
std::string _title;
double _centerFrequency;
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index 9c98cec5b..be25a6cde 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -82,6 +82,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
_xAxisPoints = new double[_numPoints];
_zoomer = new TimeDomainDisplayZoomer(canvas(), 0);
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
// Disable polygon clipping
QwtPainter::setDeviceClipping(false);
@@ -121,8 +122,6 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
_sampleRate = 1;
_resetXAxisPoints();
- replot();
-
#if QT_VERSION < 0x040000
_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
@@ -137,6 +136,15 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
_panner->setAxisEnabled(QwtPlot::yRight, false);
_panner->setMouseButton(Qt::MidButton);
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+
+ // Configure magnify on mouse wheel
+ _magnifier = new QwtPlotMagnifier(canvas());
+ _magnifier->setAxisEnabled(QwtPlot::xBottom, false);
+
// Avoid jumping when labels with more/less digits
// appear/disappear when scrolling vertically
@@ -220,8 +228,6 @@ void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints,
memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
- replot();
-
_lastReplot = get_highres_clock();
}
}
@@ -273,4 +279,12 @@ TimeDomainDisplayPlot::SetSampleRate(double sr, double units,
}
}
+void
+TimeDomainDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
#endif /* TIME_DOMAIN_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h
index 952b5c8cf..01338300c 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h
@@ -11,9 +11,11 @@
#include <qwt_scale_widget.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
+#include <qwt_plot_magnifier.h>
#include <qwt_plot_marker.h>
#include <highResTimeFunctions.h>
#include <qwt_symbol.h>
+#include <qtgui_util.h>
class TimeDomainDisplayPlot:public QwtPlot{
Q_OBJECT
@@ -37,6 +39,11 @@ public slots:
void SetSampleRate(double sr, double units,
const std::string &strunits);
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
protected slots:
void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
@@ -51,6 +58,9 @@ private:
QwtPlotPanner* _panner;
QwtPlotZoomer* _zoomer;
+ QwtDblClickPlotPicker *_picker;
+ QwtPlotMagnifier *_magnifier;
+
double* _realDataPoints;
double* _imagDataPoints;
double* _xAxisPoints;
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index a8e5361e7..2234f4238 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -142,7 +142,7 @@ public:
std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec));
// lops off the YYYY-mmm-DD part of the string
- int ind = time_str.find(" ");
+ size_t ind = time_str.find(" ");
if(ind != std::string::npos)
time_str = time_str.substr(ind);
return QwtText(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000));
@@ -194,7 +194,7 @@ protected:
std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec));
// lops off the YYYY-mmm-DD part of the string
- int ind = time_str.find(" ");
+ size_t ind = time_str.find(" ");
if(ind != std::string::npos)
time_str = time_str.substr(ind);
QString yLabel(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000));
@@ -253,13 +253,9 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
// Ctrl+RighButton: zoom out to full size
_zoomer = new WaterfallZoomer(canvas(), 0);
-#if QT_VERSION < 0x040000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
-#else
- _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#endif
_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
Qt::RightButton);
@@ -267,6 +263,11 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
_panner->setAxisEnabled(QwtPlot::yRight, false);
_panner->setMouseButton(Qt::MidButton);
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+
// Avoid jumping when labels with more/less digits
// appear/disappear when scrolling vertically
@@ -279,6 +280,8 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
_zoomer->setTrackerPen(c);
_UpdateIntensityRangeDisplay();
+
+ _xAxisMultiplier = 1;
}
WaterfallDisplayPlot::~WaterfallDisplayPlot()
@@ -315,6 +318,8 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq,
double stopFreq = constStopFreq / units;
double centerFreq = constCenterFreq / units;
+ _xAxisMultiplier = units;
+
_useCenterFrequencyFlag = useCenterFrequencyFlag;
if(_useCenterFrequencyFlag){
@@ -544,4 +549,13 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay()
_lastReplot = get_highres_clock();
}
+void
+WaterfallDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier);
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
+
#endif /* WATERFALL_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h
index 6b4e978bb..faa48d6aa 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -7,6 +7,7 @@
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
+#include <qtgui_util.h>
#include <plot_waterfall.h>
#include <highResTimeFunctions.h>
@@ -50,10 +51,12 @@ public:
public slots:
void resizeSlot( QSize *s );
-
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+
signals:
void UpdatedLowerIntensityLevel(const double);
void UpdatedUpperIntensityLevel(const double);
+ void plotPointSelected(const QPointF p);
protected:
@@ -62,12 +65,15 @@ private:
double _startFrequency;
double _stopFrequency;
+ int _xAxisMultiplier;
PlotWaterfall *d_spectrogram;
QwtPlotPanner* _panner;
QwtPlotZoomer* _zoomer;
+ QwtDblClickPlotPicker *_picker;
+
WaterfallData* _waterfallData;
timespec _lastReplot;
diff --git a/gr-qtgui/src/lib/highResTimeFunctions.h b/gr-qtgui/lib/highResTimeFunctions.h
index 251bbad8b..251bbad8b 100644
--- a/gr-qtgui/src/lib/highResTimeFunctions.h
+++ b/gr-qtgui/lib/highResTimeFunctions.h
diff --git a/gr-qtgui/src/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc
index 2b1447e03..2b1447e03 100644
--- a/gr-qtgui/src/lib/plot_waterfall.cc
+++ b/gr-qtgui/lib/plot_waterfall.cc
diff --git a/gr-qtgui/src/lib/plot_waterfall.h b/gr-qtgui/lib/plot_waterfall.h
index a11461611..a11461611 100644
--- a/gr-qtgui/src/lib/plot_waterfall.h
+++ b/gr-qtgui/lib/plot_waterfall.h
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc
index c12c451b0..7b40dd01d 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/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
*
@@ -35,27 +35,21 @@ qtgui_make_sink_c (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent)
{
return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype,
- fc, bw, name,
- plotfreq, plotwaterfall,
- plotwaterfall3d, plottime,
- plotconst,
- use_openGL,
- parent));
+ fc, bw, name,
+ plotfreq, plotwaterfall,
+ plottime, plotconst,
+ parent));
}
qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent)
: gr_block ("sink_c",
gr_make_io_signature (1, -1, sizeof(gr_complex)),
@@ -67,13 +61,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
d_plottime(plottime), d_plotconst(plotconst),
d_parent(parent)
{
- if(plotwaterfall3d == true) {
- fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n");
- }
-
d_main_gui = NULL;
- pthread_mutex_init(&d_pmutex, NULL);
- lock();
// Perform fftshift operation;
// this is usually desired when plotting
@@ -86,7 +74,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
buildwindow();
- initialize(use_openGL);
+ initialize();
}
qtgui_sink_c::~qtgui_sink_c()
@@ -105,25 +93,14 @@ qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required)
}
}
-void qtgui_sink_c::lock()
-{
- pthread_mutex_lock(&d_pmutex);
-}
-
-void qtgui_sink_c::unlock()
-{
- pthread_mutex_unlock(&d_pmutex);
-}
-
-
void
-qtgui_sink_c::initialize(const bool opengl)
+qtgui_sink_c::initialize()
{
if(qApp != NULL) {
d_qApplication = qApp;
}
else {
- int argc;
+ int argc=0;
char **argv = NULL;
d_qApplication = new QApplication(argc, argv);
}
@@ -144,14 +121,10 @@ qtgui_sink_c::initialize(const bool opengl)
d_main_gui->OpenSpectrumWindow(d_parent,
d_plotfreq, d_plotwaterfall,
- d_plottime, d_plotconst,
- opengl);
+ d_plottime, d_plotconst);
// 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));
}
@@ -289,8 +262,6 @@ 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);
-
// Update the FFT size from the application
fftresize();
windowreset();
@@ -322,8 +293,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/lib/qtgui_sink_c.h
index 9aee66503..fb0cb6c5f 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.h
+++ b/gr-qtgui/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
*
@@ -28,7 +28,6 @@
#include <gr_firdes.h>
#include <gri_fft.h>
#include <qapplication.h>
-#include <qtgui.h>
#include "SpectrumGUIClass.h"
class qtgui_sink_c;
@@ -38,9 +37,7 @@ qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
double fc=0, double bandwidth=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
- bool plotwaterfall3d=true, bool plottime=true,
- bool plotconst=true,
- bool use_openGL=true,
+ bool plottime=true, bool plotconst=true,
QWidget *parent=NULL);
class qtgui_sink_c : public gr_block
@@ -50,24 +47,18 @@ private:
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
- // use opengl to force OpenGL on or off
- // this might be necessary for sessions over SSH
- void initialize(const bool opengl=true);
+ void initialize();
int d_fftsize;
gr_firdes::win_type d_wintype;
@@ -76,8 +67,6 @@ private:
double d_bandwidth;
std::string d_name;
- pthread_mutex_t d_pmutex;
-
bool d_shift;
gri_fft_complex *d_fft;
@@ -99,8 +88,6 @@ private:
public:
~qtgui_sink_c();
void exec_();
- void lock();
- void unlock();
QWidget* qwidget();
PyObject* pyqwidget();
@@ -116,7 +103,6 @@ public:
void set_update_time(double t);
QApplication *d_qApplication;
- qtgui_obj *d_object;
int general_work (int noutput_items,
gr_vector_int &ninput_items,
diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/lib/qtgui_sink_f.cc
index ab4fd082d..3312b9006 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.cc
+++ b/gr-qtgui/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
*
@@ -35,17 +35,13 @@ qtgui_make_sink_f (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent)
{
return gnuradio::get_initial_sptr(new qtgui_sink_f (fftsize, wintype,
fc, bw, name,
plotfreq, plotwaterfall,
- plotwaterfall3d, plottime,
- plotconst,
- use_openGL,
+ plottime, plotconst,
parent));
}
@@ -53,9 +49,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent)
: gr_block ("sink_f",
gr_make_io_signature (1, 1, sizeof(float)),
@@ -67,13 +61,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
d_plottime(plottime), d_plotconst(plotconst),
d_parent(parent)
{
- if(plotwaterfall3d == true) {
- fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n");
- }
-
d_main_gui = NULL;
- pthread_mutex_init(&d_pmutex, NULL);
- lock();
// Perform fftshift operation;
// this is usually desired when plotting
@@ -86,7 +74,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
buildwindow();
- initialize(use_openGL);
+ initialize();
}
qtgui_sink_f::~qtgui_sink_f()
@@ -105,18 +93,8 @@ qtgui_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required)
}
}
-void qtgui_sink_f::lock()
-{
- pthread_mutex_lock(&d_pmutex);
-}
-
-void qtgui_sink_f::unlock()
-{
- pthread_mutex_unlock(&d_pmutex);
-}
-
void
-qtgui_sink_f::initialize(const bool opengl)
+qtgui_sink_f::initialize()
{
if(qApp != NULL) {
d_qApplication = qApp;
@@ -139,14 +117,10 @@ qtgui_sink_f::initialize(const bool opengl)
d_main_gui->OpenSpectrumWindow(d_parent,
d_plotfreq, d_plotwaterfall,
- d_plottime, d_plotconst,
- opengl);
+ d_plottime, d_plotconst);
// 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));
}
void
@@ -284,8 +258,6 @@ qtgui_sink_f::general_work (int noutput_items,
int j=0;
const float *in = (const float*)input_items[0];
- pthread_mutex_lock(&d_pmutex);
-
// Update the FFT size from the application
fftresize();
windowreset();
@@ -317,8 +289,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/lib/qtgui_sink_f.h
index 0cac35d90..518aa3846 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.h
+++ b/gr-qtgui/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
*
@@ -28,7 +28,7 @@
#include <gr_firdes.h>
#include <gri_fft.h>
#include <qapplication.h>
-#include <qtgui.h>
+//#include <qtgui.h>
#include "SpectrumGUIClass.h"
class qtgui_sink_f;
@@ -38,9 +38,7 @@ qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
double fc=0, double bw=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
- bool plotwaterfall3d=true, bool plottime=true,
- bool plotconst=true,
- bool use_openGL=true,
+ bool plottime=true, bool plotconst=true,
QWidget *parent=NULL);
class qtgui_sink_f : public gr_block
@@ -50,22 +48,18 @@ private:
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
qtgui_sink_f (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
- void initialize(const bool opengl=true);
+ void initialize();
int d_fftsize;
gr_firdes::win_type d_wintype;
@@ -74,8 +68,6 @@ private:
double d_bandwidth;
std::string d_name;
- pthread_mutex_t d_pmutex;
-
bool d_shift;
gri_fft_complex *d_fft;
@@ -97,8 +89,6 @@ private:
public:
~qtgui_sink_f();
void exec_();
- void lock();
- void unlock();
QWidget* qwidget();
PyObject* pyqwidget();
@@ -114,7 +104,6 @@ public:
void set_update_time(double t);
QApplication *d_qApplication;
- qtgui_obj *d_object;
int general_work (int noutput_items,
gr_vector_int &ninput_items,
diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc
new file mode 100644
index 000000000..87b90997a
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_util.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qtgui_util.h>
+
+QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine()
+ : QwtPickerMachine ()
+{
+
+}
+
+QwtPickerDblClickPointMachine::~QwtPickerDblClickPointMachine()
+{
+
+}
+
+QwtPickerMachine::CommandList
+QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern,
+ const QEvent *e)
+{
+ QwtPickerMachine::CommandList cmdList;
+ switch(e->type()) {
+ case QEvent::MouseButtonDblClick:
+ if ( eventPattern.mouseMatch(QwtEventPattern::MouseSelect1,
+ (const QMouseEvent *)e) ) {
+ cmdList += QwtPickerMachine::Begin;
+ cmdList += QwtPickerMachine::Append;
+ cmdList += QwtPickerMachine::End;
+ }
+ break;
+ default:
+ break;
+ }
+ return cmdList;
+}
+
+QwtDblClickPlotPicker::QwtDblClickPlotPicker(QwtPlotCanvas* canvas)
+ : QwtPlotPicker(canvas)
+{
+ setSelectionFlags(QwtPicker::PointSelection);
+}
+
+QwtDblClickPlotPicker::~QwtDblClickPlotPicker()
+{
+}
+
+QwtPickerMachine*
+QwtDblClickPlotPicker::stateMachine(int n) const
+{
+ return new QwtPickerDblClickPointMachine;
+}
+
diff --git a/gr-qtgui/src/lib/qtgui.h b/gr-qtgui/lib/qtgui_util.h
index 6edbca12c..a519c66a2 100644
--- a/gr-qtgui/src/lib/qtgui.h
+++ b/gr-qtgui/lib/qtgui_util.h
@@ -1,70 +1,50 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
- *
+ * 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.
*/
-#ifndef INCLUDED_QTGUI_H
-#define INCLUDED_QTGUI_H
+#ifndef INCLUDED_QTGUI_UTIL_H
+#define INCLUDED_QTGUI_UTIL_H
-#include <qapplication.h>
-#include "SpectrumGUIClass.h"
+#include <qevent.h>
-class qtgui_event : public QEvent
-{
-private:
- pthread_mutex_t *pmutex;
+#include <qwt_plot_picker.h>
+#include <qwt_picker_machine.h>
-public:
- qtgui_event(pthread_mutex_t *mut)
- : QEvent((QEvent::Type)(QEvent::User+101))
- {
- pmutex = mut;
- }
- void lock()
- {
- pthread_mutex_lock(pmutex);
-
- }
+class QwtDblClickPlotPicker: public QwtPlotPicker
+{
+public:
+ QwtDblClickPlotPicker(QwtPlotCanvas *);
+ ~QwtDblClickPlotPicker();
- void unlock()
- {
- pthread_mutex_unlock(pmutex);
- }
+ virtual QwtPickerMachine * stateMachine(int) const;
};
-class qtgui_obj : public QObject
+class QwtPickerDblClickPointMachine: public QwtPickerMachine
{
public:
- qtgui_obj(QObject *p)
- : QObject(p)
- {
- }
+ QwtPickerDblClickPointMachine();
+ ~QwtPickerDblClickPointMachine();
- void customEvent(QEvent *e)
- {
- if(e->type() == (QEvent::Type)(QEvent::User+101)) {
- qtgui_event *qt = (qtgui_event*)e;
- qt->unlock();
- }
- }
+ virtual CommandList transition( const QwtEventPattern &eventPattern, const QEvent *e);
};
-#endif /* INCLUDED_QTGUI_H */
+#endif /* INCLUDED_QTGUI_UTIL_H */
diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc
index 53a205fb7..53a205fb7 100644
--- a/gr-qtgui/src/lib/spectrumUpdateEvents.cc
+++ b/gr-qtgui/lib/spectrumUpdateEvents.cc
diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h
index ccc072c3e..ccc072c3e 100644
--- a/gr-qtgui/src/lib/spectrumUpdateEvents.h
+++ b/gr-qtgui/lib/spectrumUpdateEvents.h
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
index e0509a294..238c9889f 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -3,14 +3,11 @@
#include <QMessageBox>
#include <spectrumdisplayform.h>
-int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1;
-
-SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent)
+SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
: QWidget(parent)
{
setupUi(this);
- _useOpenGL = useOpenGL;
_systemSpecifiedFlag = false;
_intValidator = new QIntValidator(this);
_intValidator->setBottom(0);
@@ -59,9 +56,25 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent)
ToggleTabTime(false);
ToggleTabConstellation(false);
+ _historyEntry = 0;
+ _historyEntryCount = 0;
+
// Create a timer to update plots at the specified rate
displayTimer = new QTimer(this);
connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer()));
+
+ // Connect double click signals up
+ connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onFFTPlotPointSelected(const QPointF)));
+
+ connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onWFallPlotPointSelected(const QPointF)));
+
+ connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onTimePlotPointSelected(const QPointF)));
+
+ connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onConstPlotPointSelected(const QPointF)));
}
SpectrumDisplayForm::~SpectrumDisplayForm()
@@ -689,3 +702,27 @@ SpectrumDisplayForm::SetUpdateTime(double t)
// QTimer class takes millisecond input
displayTimer->start(d_update_time*1000);
}
+
+void
+SpectrumDisplayForm::onFFTPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 1);
+}
+
+void
+SpectrumDisplayForm::onWFallPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 2);
+}
+
+void
+SpectrumDisplayForm::onTimePlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 3);
+}
+
+void
+SpectrumDisplayForm::onConstPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 4);
+}
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h
index fbd08349b..860edf2d1 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.h
+++ b/gr-qtgui/lib/spectrumdisplayform.h
@@ -20,7 +20,7 @@ class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
Q_OBJECT
public:
- SpectrumDisplayForm(bool useOpenGL = true, QWidget* parent = 0);
+ SpectrumDisplayForm(QWidget* parent = 0);
~SpectrumDisplayForm();
void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints,
@@ -71,12 +71,17 @@ private slots:
void newFrequencyData( const SpectrumUpdateEvent* );
void UpdateGuiTimer();
-protected:
+ void onFFTPlotPointSelected(const QPointF p);
+ void onWFallPlotPointSelected(const QPointF p);
+ void onTimePlotPointSelected(const QPointF p);
+ void onConstPlotPointSelected(const QPointF p);
+
+signals:
+ void plotPointSelected(const QPointF p, int type);
private:
void _AverageHistory( const double * newBuffer );
- bool _useOpenGL;
int _historyEntryCount;
int _historyEntry;
std::vector<double*>* _historyVector;
@@ -95,7 +100,6 @@ private:
double _noiseFloorAmplitude;
double _peakFrequency;
double _peakAmplitude;
- static int _openGLWaterfall3DFlag;
double _stopFrequency;
//SpectrumUpdateEvent _lastSpectrumEvent;
@@ -103,7 +107,6 @@ private:
// whether or not to use a particular display
int d_plot_fft;
int d_plot_waterfall;
- int d_plot_waterfall3d;
int d_plot_time;
int d_plot_constellation;
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui
index 5a23bc8a9..049d4ffeb 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.ui
+++ b/gr-qtgui/lib/spectrumdisplayform.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>712</width>
- <height>543</height>
+ <height>560</height>
</rect>
</property>
<property name="windowTitle">
@@ -182,8 +182,8 @@
</property>
<property name="minimumSize">
<size>
- <width>400</width>
- <height>350</height>
+ <width>617</width>
+ <height>400</height>
</size>
</property>
<property name="sizeIncrement">
@@ -705,22 +705,6 @@
</hints>
</connection>
<connection>
- <sender>Waterfall3DAutoScaleBtn</sender>
- <signal>clicked()</signal>
- <receiver>SpectrumDisplayForm</receiver>
- <slot>Waterfall3DAutoScaleBtnCB()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>22</x>
- <y>349</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>WaterfallIntensityComboBox</sender>
<signal>activated(int)</signal>
<receiver>SpectrumDisplayForm</receiver>
@@ -737,22 +721,6 @@
</hints>
</connection>
<connection>
- <sender>Waterfall3DIntensityComboBox</sender>
- <signal>activated(int)</signal>
- <receiver>SpectrumDisplayForm</receiver>
- <slot>Waterfall3DIntensityColorTypeChanged(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>92</x>
- <y>44</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>SpectrumTypeTab</sender>
<signal>currentChanged(int)</signal>
<receiver>SpectrumDisplayForm</receiver>
diff --git a/gr-qtgui/src/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc
index 1ba153f0d..1ba153f0d 100644
--- a/gr-qtgui/src/lib/waterfallGlobalData.cc
+++ b/gr-qtgui/lib/waterfallGlobalData.cc
diff --git a/gr-qtgui/src/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h
index 51f65064c..51f65064c 100644
--- a/gr-qtgui/src/lib/waterfallGlobalData.h
+++ b/gr-qtgui/lib/waterfallGlobalData.h
diff --git a/gr-qtgui/src/python/.gitignore b/gr-qtgui/python/.gitignore
index b336cc7ce..604b402c5 100644
--- a/gr-qtgui/src/python/.gitignore
+++ b/gr-qtgui/python/.gitignore
@@ -1,2 +1,3 @@
/Makefile
/Makefile.in
+/run_tests
diff --git a/gr-qtgui/src/python/Makefile.am b/gr-qtgui/python/Makefile.am
index 31df63a44..f1bdf359b 100644
--- a/gr-qtgui/src/python/Makefile.am
+++ b/gr-qtgui/python/Makefile.am
@@ -21,18 +21,18 @@
include $(top_srcdir)/Makefile.common
-noinst_PYTHON = \
- pyqt_example_f.py \
- pyqt_example.py \
- qt_digital.py \
- qt_digital_window.py \
- usrp2_display.py \
- usrp_display.py
+TESTS =
+EXTRA_DIST += run_tests.in
-EXTRA_DIST += \
- qt_digital_window.ui
+if PYTHON
+TESTS += run_tests
+DISTCLEANFILES += run_tests
qtguipythondir = $(grpythondir)/qtgui
-qtguipython_PYTHON = \
+noinst_PYTHON = \
+ qa_qtgui.py
+
+qtguipython_PYTHON = \
__init__.py
+endif
diff --git a/gr-qtgui/python/__init__.py b/gr-qtgui/python/__init__.py
new file mode 100644
index 000000000..db113bbd3
--- /dev/null
+++ b/gr-qtgui/python/__init__.py
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+from qtgui_swig import *
+import qtgui_swig as qtgui # to preserve the old interface
diff --git a/gr-qtgui/python/qa_qtgui.py b/gr-qtgui/python/qa_qtgui.py
new file mode 100755
index 000000000..9cafd4550
--- /dev/null
+++ b/gr-qtgui/python/qa_qtgui.py
@@ -0,0 +1,48 @@
+#!/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_swig
+
+class test_qtgui(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test01 (self):
+ # Test to make sure we can instantiate the sink
+ self.qtsnk = qtgui_swig.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, 1, "Test",
+ True, True, True, True)
+
+ def test02 (self):
+ # Test to make sure we can instantiate the sink
+ self.qtsnk = qtgui_swig.sink_f(1024, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, 1, "Test",
+ True, True, True, True)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_qtgui, "test_qtgui.xml")
diff --git a/gr-qtgui/python/run_tests.in b/gr-qtgui/python/run_tests.in
new file mode 100644
index 000000000..909194752
--- /dev/null
+++ b/gr-qtgui/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@
diff --git a/gr-qtgui/src/python/__init__.py b/gr-qtgui/src/python/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/gr-qtgui/src/python/__init__.py
+++ /dev/null
diff --git a/gr-qtgui/swig/.gitignore b/gr-qtgui/swig/.gitignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/gr-qtgui/swig/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/gr-qtgui/swig/Makefile.am b/gr-qtgui/swig/Makefile.am
new file mode 100644
index 000000000..8c695ba5b
--- /dev/null
+++ b/gr-qtgui/swig/Makefile.am
@@ -0,0 +1,54 @@
+#
+# Copyright 2004-2006,2008-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/Makefile.swig
+
+TESTS =
+EXTRA_DIST += $(nobase_guile_DATA)
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/gr-qtgui/lib \
+ -I$(top_builddir)/gr-qtgui/lib \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(PYTHON_CPPFLAGS) \
+ $(QT_INCLUDES) \
+ $(WITH_INCLUDES)
+
+##############################
+# SWIG interface and library
+TOP_SWIG_IFILES = \
+ qtgui_swig.i
+
+# Install so that they end up available as:
+# import gnuradio.qtgui
+# This ends up at:
+# ${prefix}/lib/python${python_version}/site-packages/gnuradio/qtgui
+qtgui_swig_pythondir_category = \
+ gnuradio/qtgui
+
+# additional libraries for linking with the SWIG-generated library
+qtgui_swig_la_swig_libadd = \
+ $(abs_top_builddir)/gr-qtgui/lib/libgnuradio-qtgui.la
+
+# additional SWIG files to be installed
+qtgui_swig_swiginclude_headers = \
+ qtgui.i
diff --git a/gr-qtgui/src/lib/Makefile.swig.gen b/gr-qtgui/swig/Makefile.swig.gen
index 9c4c0b58c..3659601c3 100644
--- a/gr-qtgui/src/lib/Makefile.swig.gen
+++ b/gr-qtgui/swig/Makefile.swig.gen
@@ -20,37 +20,37 @@
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for qtgui.i
+# Makefile.swig.gen for qtgui_swig.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/qtgui
+## ${prefix}/lib/python${python_version}/site-packages/[category]/qtgui_swig
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/qtgui
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/qtgui_swig
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-qtgui_pythondir_category ?= gnuradio/qtgui
-qtgui_pylibdir_category ?= $(qtgui_pythondir_category)
-qtgui_pythondir = $(pythondir)/$(qtgui_pythondir_category)
-qtgui_pylibdir = $(pyexecdir)/$(qtgui_pylibdir_category)
+qtgui_swig_pythondir_category ?= gnuradio/qtgui_swig
+qtgui_swig_pylibdir_category ?= $(qtgui_swig_pythondir_category)
+qtgui_swig_pythondir = $(pythondir)/$(qtgui_swig_pythondir_category)
+qtgui_swig_pylibdir = $(pyexecdir)/$(qtgui_swig_pylibdir_category)
# The .so libraries for the guile modules get installed whereever guile
# is installed, usually /usr/lib/guile/gnuradio/
# FIXME: determince whether these should be installed with gnuradio.
-qtgui_scmlibdir = $(libdir)
+qtgui_swig_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
-# is installed, usually /usr/share/guile/site/qtgui
+# is installed, usually /usr/share/guile/site/qtgui_swig
# FIXME: determince whether these should be installed with gnuradio.
-qtgui_scmdir = $(guiledir)
+qtgui_swig_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-qtgui_swigincludedir = $(swigincludedir)
+qtgui_swig_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -75,70 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S*
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-qtgui_swiginclude_HEADERS = \
- qtgui.i \
- $(qtgui_swiginclude_headers)
+qtgui_swig_swiginclude_HEADERS = \
+ qtgui_swig.i \
+ $(qtgui_swig_swiginclude_headers)
if PYTHON
-qtgui_pylib_LTLIBRARIES = \
- _qtgui.la
+qtgui_swig_pylib_LTLIBRARIES = \
+ _qtgui_swig.la
-_qtgui_la_SOURCES = \
- python/qtgui.cc \
- $(qtgui_la_swig_sources)
+_qtgui_swig_la_SOURCES = \
+ python/qtgui_swig.cc \
+ $(qtgui_swig_la_swig_sources)
-qtgui_python_PYTHON = \
- qtgui.py \
- $(qtgui_python)
+qtgui_swig_python_PYTHON = \
+ qtgui_swig.py \
+ $(qtgui_swig_python)
-_qtgui_la_LIBADD = \
+_qtgui_swig_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(qtgui_la_swig_libadd)
+ $(qtgui_swig_la_swig_libadd)
-_qtgui_la_LDFLAGS = \
+_qtgui_swig_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(qtgui_la_swig_ldflags)
+ $(qtgui_swig_la_swig_ldflags)
-_qtgui_la_CXXFLAGS = \
+_qtgui_swig_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
-I$(top_builddir) \
- $(qtgui_la_swig_cxxflags)
+ $(qtgui_swig_la_swig_cxxflags)
-python/qtgui.cc: qtgui.py
-qtgui.py: qtgui.i
+python/qtgui_swig.cc: qtgui_swig.py
+qtgui_swig.py: qtgui_swig.i
# Include the python dependencies for this file
--include python/qtgui.d
+-include python/qtgui_swig.d
endif # end of if python
if GUILE
-qtgui_scmlib_LTLIBRARIES = \
- libguile-gnuradio-qtgui.la
-libguile_gnuradio_qtgui_la_SOURCES = \
- guile/qtgui.cc \
- $(qtgui_la_swig_sources)
-nobase_qtgui_scm_DATA = \
- gnuradio/qtgui.scm \
- gnuradio/qtgui-primitive.scm
-libguile_gnuradio_qtgui_la_LIBADD = \
+qtgui_swig_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-qtgui_swig.la
+libguile_gnuradio_qtgui_swig_la_SOURCES = \
+ guile/qtgui_swig.cc \
+ $(qtgui_swig_la_swig_sources)
+nobase_qtgui_swig_scm_DATA = \
+ gnuradio/qtgui_swig.scm \
+ gnuradio/qtgui_swig-primitive.scm
+libguile_gnuradio_qtgui_swig_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(qtgui_la_swig_libadd)
-libguile_gnuradio_qtgui_la_LDFLAGS = \
+ $(qtgui_swig_la_swig_libadd)
+libguile_gnuradio_qtgui_swig_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(qtgui_la_swig_ldflags)
-libguile_gnuradio_qtgui_la_CXXFLAGS = \
+ $(qtgui_swig_la_swig_ldflags)
+libguile_gnuradio_qtgui_swig_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
-I$(top_builddir) \
- $(qtgui_la_swig_cxxflags)
+ $(qtgui_swig_la_swig_cxxflags)
-guile/qtgui.cc: gnuradio/qtgui.scm
-gnuradio/qtgui.scm: qtgui.i
-gnuradio/qtgui-primitive.scm: gnuradio/qtgui.scm
+guile/qtgui_swig.cc: gnuradio/qtgui_swig.scm
+gnuradio/qtgui_swig.scm: qtgui_swig.i
+gnuradio/qtgui_swig-primitive.scm: gnuradio/qtgui_swig.scm
# Include the guile dependencies for this file
--include guile/qtgui.d
+-include guile/qtgui_swig.d
endif # end of GUILE
diff --git a/gr-qtgui/src/Makefile.am b/gr-qtgui/swig/__init__.py
index 52b06fbc4..3986f2513 100644
--- a/gr-qtgui/src/Makefile.am
+++ b/gr-qtgui/swig/__init__.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,7 +19,6 @@
# Boston, MA 02110-1301, USA.
#
-SUBDIRS = lib
-if PYTHON
-SUBDIRS += python
-endif
+# The presence of this file turns this directory into a Python package
+
+from qtgui_swig import *
diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/swig/qtgui.i
index bb64c6ae2..77c6ccdd7 100644
--- a/gr-qtgui/src/lib/qtgui.i
+++ b/gr-qtgui/swig/qtgui.i
@@ -23,20 +23,18 @@
%include "gnuradio.i"
%{
-#include "qtgui_sink_c.h"
-#include "qtgui_sink_f.h"
+#include <qtgui_sink_c.h>
+#include <qtgui_sink_f.h>
%}
GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
- qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
- double fc=0, double bw=1.0,
- const std::string &name="Display",
- bool plotfreq=true, bool plotwaterfall=true,
- bool plotwaterfall3d=true, bool plottime=true,
- bool plotconst=true,
- bool use_openGL=true,
- QWidget *parent=NULL);
+qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ double fc=0, double bw=1.0,
+ const std::string &name="Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=true,
+ QWidget *parent=NULL);
class qtgui_sink_c : public gr_block
{
@@ -45,19 +43,15 @@ private:
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
-
+
public:
void exec_();
PyObject* pyqwidget();
@@ -69,6 +63,7 @@ public:
double ymin, double ymax);
void set_frequency_axis(double min, double max);
void set_constellation_pen_size(int size);
+ void set_update_time(double t);
};
@@ -82,9 +77,7 @@ qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
double fc=0, double bw=0.0,
const std::string &name="Display",
bool plotfreq=true, bool plotwaterfall=true,
- bool plotwaterfall3d=true, bool plottime=true,
- bool plotconst=true,
- bool use_openGL=true,
+ bool plottime=true, bool plotconst=true,
QWidget *parent=NULL);
class qtgui_sink_f : public gr_block
@@ -94,17 +87,13 @@ private:
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
qtgui_sink_f (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
- bool plotwaterfall3d, bool plottime,
- bool plotconst,
- bool use_openGL,
+ bool plottime, bool plotconst,
QWidget *parent);
public:
@@ -118,14 +107,5 @@ public:
double ymin, double ymax);
void set_frequency_axis(double min, double max);
void set_constellation_pen_size(int size);
+ void set_update_time(double t);
};
-
-#if SWIGGUILE
-%scheme %{
-(load-extension-global "libguile-gnuradio-qtgui" "scm_init_gnuradio_qtgui_module")
-%}
-
-%goops %{
-(use-modules (gnuradio gnuradio_core_runtime))
-%}
-#endif
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
new file mode 100644
index 000000000..c250cdd04
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_sink_c.h>
+#include <qtgui_sink_f.h>
+%}
+
+%include "qtgui.i"
+
+