commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/03: qtgui: adds ability to set the graph


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/03: qtgui: adds ability to set the graphics style rendering of the qtgui sinks.
Date: Mon, 24 Feb 2014 23:41:36 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit b9cce7ab281d7ff8dc69559a41e57c36a1eb7ee5
Author: Tom Rondeau <address@hidden>
Date:   Mon Feb 24 17:48:25 2014 -0500

    qtgui: adds ability to set the graphics style rendering of the qtgui sinks.
    
    Set through gr-qtgui.conf prefs file. Documented in QT GUI section of 
manual.
---
 gr-qtgui/CMakeLists.txt                 |  9 +++++++++
 gr-qtgui/doc/qtgui.dox                  | 22 ++++++++++++++++++++++
 gr-qtgui/gr-qtgui.conf                  | 10 ++++++++++
 gr-qtgui/lib/const_sink_c_impl.cc       | 10 ++++++----
 gr-qtgui/lib/freq_sink_c_impl.cc        |  5 ++++-
 gr-qtgui/lib/freq_sink_c_impl.h         |  2 +-
 gr-qtgui/lib/freq_sink_f_impl.cc        |  3 +++
 gr-qtgui/lib/histogram_sink_f_impl.cc   | 10 ++++++----
 gr-qtgui/lib/sink_c_impl.cc             |  3 +++
 gr-qtgui/lib/sink_f_impl.cc             |  3 +++
 gr-qtgui/lib/time_raster_sink_b_impl.cc |  9 ++++++---
 gr-qtgui/lib/time_raster_sink_f_impl.cc |  9 ++++++---
 gr-qtgui/lib/time_sink_c_impl.cc        |  9 ++++++---
 gr-qtgui/lib/time_sink_f_impl.cc        |  9 ++++++---
 gr-qtgui/lib/waterfall_sink_c_impl.cc   | 13 ++++++++-----
 gr-qtgui/lib/waterfall_sink_f_impl.cc   | 15 +++++++++------
 grc/python/flow_graph.tmpl              |  1 +
 17 files changed, 109 insertions(+), 33 deletions(-)

diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt
index a3a72dc..13cbfb2 100644
--- a/gr-qtgui/CMakeLists.txt
+++ b/gr-qtgui/CMakeLists.txt
@@ -132,4 +132,13 @@ install(
     COMPONENT "qtgui_devel"
 )
 
+########################################################################
+# Install the conf file
+########################################################################
+install(
+    FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr-qtgui.conf
+    DESTINATION ${GR_PREFSDIR}
+    COMPONENT "qtgui"
+)
+
 endif(ENABLE_GR_QTGUI)
diff --git a/gr-qtgui/doc/qtgui.dox b/gr-qtgui/doc/qtgui.dox
index beb1055..cbe5b83 100644
--- a/gr-qtgui/doc/qtgui.dox
+++ b/gr-qtgui/doc/qtgui.dox
@@ -181,4 +181,26 @@ style, markers, etc.), the ability to start and stop the 
display, the
 ability to save to a file, and other plot-specific controls (FFT size
 for the frequency and waterfall plots, etc.).
 
+\section Configuration
+
+There is currently a single configuration option in the preferences
+files to set the rendering engine of the QTGUI sinks. Located in
+etc/gnuradio/conf.d/gr-qtgui.conf:
+
+\verbatim
+[qtgui]
+style = raster
+\endverbatim
+
+The available styles are:
+
+\li opengl: the fastest but not likely to always work
+\li raster: fast and stable; terrible X forwarding performance
+\li native: most compute intensive; very good over X
+
+We default this setting to raster for the mix of performance and
+usability. When using QTGUI sinks through an X-forwarding session over
+SSH, switch to using 'native' for a significant speed boost on the
+remote end.
+
 */
diff --git a/gr-qtgui/gr-qtgui.conf b/gr-qtgui/gr-qtgui.conf
new file mode 100644
index 0000000..66354cf
--- /dev/null
+++ b/gr-qtgui/gr-qtgui.conf
@@ -0,0 +1,10 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[qtgui]
+# 'raster', 'native', or 'opengl'
+# - 'opengl' is the fastest but not likely to always work
+# - 'raster' is fast and stable; terrible X forwarding performance
+# - 'native' most compute intensive; very good over X
+style = raster
diff --git a/gr-qtgui/lib/const_sink_c_impl.cc 
b/gr-qtgui/lib/const_sink_c_impl.cc
index fd9338f..8b1a804 100644
--- a/gr-qtgui/lib/const_sink_c_impl.cc
+++ b/gr-qtgui/lib/const_sink_c_impl.cc
@@ -26,14 +26,14 @@
 
 #include "const_sink_c_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
-#include <gnuradio/fft/fft.h>
 #include <qwt_symbol.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     const_sink_c::sptr
     const_sink_c::make(int size,
                       const std::string &name,
@@ -110,6 +110,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -272,8 +274,8 @@ namespace gr {
          memset(d_residbufs_imag[i], 0, newsize*sizeof(double));
        }
 
-       // Set new size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_size = newsize;
        d_index = 0;
 
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index e86974f..ff37597 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -26,6 +26,7 @@
 
 #include "freq_sink_c_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 #include <qwt_symbol.h>
@@ -132,7 +133,9 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
-       d_qApplication = new QApplication(d_argc, &d_argv);
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
+        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
       d_main_gui = new FreqDisplayForm(d_nconnections, d_parent);
diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h
index 8079c81..f068e65 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.h
+++ b/gr-qtgui/lib/freq_sink_c_impl.h
@@ -32,7 +32,7 @@
 
 namespace gr {
   namespace qtgui {
-    
+
     class QTGUI_API freq_sink_c_impl : public freq_sink_c
     {
     private:
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index 8dca815..f2dfb4f 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -26,6 +26,7 @@
 
 #include "freq_sink_f_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 #include <qwt_symbol.h>
@@ -132,6 +133,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
diff --git a/gr-qtgui/lib/histogram_sink_f_impl.cc 
b/gr-qtgui/lib/histogram_sink_f_impl.cc
index 8a3ba69..07620a1 100644
--- a/gr-qtgui/lib/histogram_sink_f_impl.cc
+++ b/gr-qtgui/lib/histogram_sink_f_impl.cc
@@ -26,14 +26,14 @@
 
 #include "histogram_sink_f_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
-#include <gnuradio/fft/fft.h>
 #include <qwt_symbol.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     histogram_sink_f::sptr
     histogram_sink_f::make(int size, int bins,
                            double xmin, double xmax,
@@ -109,6 +109,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -270,8 +272,8 @@ namespace gr {
          memset(d_residbufs[i], 0, newsize*sizeof(double));
        }
 
-       // Set new size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_size = newsize;
        d_index = 0;
 
diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc
index d9341ba..b810a45 100644
--- a/gr-qtgui/lib/sink_c_impl.cc
+++ b/gr-qtgui/lib/sink_c_impl.cc
@@ -26,6 +26,7 @@
 
 #include "sink_c_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 
@@ -122,6 +123,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc
index 178eb1b..ef194f9 100644
--- a/gr-qtgui/lib/sink_f_impl.cc
+++ b/gr-qtgui/lib/sink_f_impl.cc
@@ -26,6 +26,7 @@
 
 #include "sink_f_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 
@@ -122,6 +123,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.cc 
b/gr-qtgui/lib/time_raster_sink_b_impl.cc
index 26daffe..84f702b 100644
--- a/gr-qtgui/lib/time_raster_sink_b_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc
@@ -26,12 +26,13 @@
 
 #include "time_raster_sink_b_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     time_raster_sink_b::sptr
     time_raster_sink_b::make(double samp_rate,
                             double rows, double cols,
@@ -84,7 +85,7 @@ namespace gr {
       d_tmpflt = (float*)volk_malloc(d_icols*sizeof(float),
                                      volk_get_alignment());
       memset(d_tmpflt, 0, d_icols*sizeof(float));
-      
+
       for(int i = 0; i < d_nconnections; i++) {
        d_residbufs.push_back((double*)volk_malloc(d_icols*sizeof(double),
                                                    volk_get_alignment()));
@@ -123,6 +124,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -417,7 +420,7 @@ namespace gr {
            volk_32f_convert_64f_u(&d_residbufs[n][d_index],
                                   d_tmpflt, resid);
          }
-      
+
          if(gr::high_res_timer_now() - d_last_time > d_update_time) {
            d_last_time = gr::high_res_timer_now();
            d_qApplication->postEvent(d_main_gui,
diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.cc 
b/gr-qtgui/lib/time_raster_sink_f_impl.cc
index 10b7f76..beb2937 100644
--- a/gr-qtgui/lib/time_raster_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc
@@ -26,12 +26,13 @@
 
 #include "time_raster_sink_f_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     time_raster_sink_f::sptr
     time_raster_sink_f::make(double samp_rate,
                             double rows, double cols,
@@ -82,7 +83,7 @@ namespace gr {
       d_tmpflt = (float*)volk_malloc(d_icols*sizeof(float),
                                      volk_get_alignment());
       memset(d_tmpflt, 0, d_icols*sizeof(float));
-      
+
       for(int i = 0; i < d_nconnections; i++) {
        d_residbufs.push_back((double*)volk_malloc(d_icols*sizeof(double),
                                                    volk_get_alignment()));
@@ -121,6 +122,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -413,7 +416,7 @@ namespace gr {
            volk_32f_convert_64f_u(&d_residbufs[n][d_index],
                                   d_tmpflt, resid);
          }
-      
+
          // Update the plot if its time
          if(gr::high_res_timer_now() - d_last_time > d_update_time) {
            d_last_time = gr::high_res_timer_now();
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index f246578..6cd3146 100644
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -26,6 +26,7 @@
 
 #include "time_sink_c_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 #include <gnuradio/fft/fft.h>
@@ -33,7 +34,7 @@
 
 namespace gr {
   namespace qtgui {
-    
+
     time_sink_c::sptr
     time_sink_c::make(int size, double samp_rate,
                      const std::string &name,
@@ -112,6 +113,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -292,8 +295,8 @@ namespace gr {
       if(newsize != d_size) {
         gr::thread::scoped_lock lock(d_mutex);
 
-       // Set new size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_size = newsize;
         d_buffer_size = 2*d_size;
 
diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc
index 596a416..7bbda19 100644
--- a/gr-qtgui/lib/time_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -28,6 +28,7 @@
 #include <gnuradio/io_signature.h>
 #include <gnuradio/block_detail.h>
 #include <gnuradio/buffer.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 #include <gnuradio/fft/fft.h>
@@ -35,7 +36,7 @@
 
 namespace gr {
   namespace qtgui {
-    
+
     time_sink_f::sptr
     time_sink_f::make(int size, double samp_rate,
                      const std::string &name,
@@ -114,6 +115,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -294,8 +297,8 @@ namespace gr {
       if(newsize != d_size) {
         gr::thread::scoped_lock lock(d_mutex);
 
-       // Set new size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_size = newsize;
         d_buffer_size = 2*d_size;
 
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc 
b/gr-qtgui/lib/waterfall_sink_c_impl.cc
index 9fc4f21..3727c01 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -26,13 +26,14 @@
 
 #include "waterfall_sink_c_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 #include <qwt_symbol.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     waterfall_sink_c::sptr
     waterfall_sink_c::make(int fftsize, int wintype,
                           double fc, double bw,
@@ -131,6 +132,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -330,7 +333,7 @@ namespace gr {
       d_fft->execute();     // compute the fft
 
       volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, 
d_fft->get_outbuf(),
-                                                    size, 1.0, size);
+                                                    size, 1.0, size);
 
       // Perform shift operation
       unsigned int len = (unsigned int)(floor(size/2.0));
@@ -383,8 +386,8 @@ namespace gr {
          memset(d_magbufs[i], 0, newfftsize*sizeof(double));
        }
 
-       // Set new fft size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new fft size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_fftsize = newfftsize;
        d_index = 0;
 
@@ -433,7 +436,7 @@ namespace gr {
               }
               //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
             }
-      
+
            d_last_time = gr::high_res_timer_now();
            d_qApplication->postEvent(d_main_gui,
                                      new WaterfallUpdateEvent(d_magbufs,
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc 
b/gr-qtgui/lib/waterfall_sink_f_impl.cc
index 50525f1..4d2da01 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -26,12 +26,13 @@
 
 #include "waterfall_sink_f_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
 #include <string.h>
 #include <volk/volk.h>
 
 namespace gr {
   namespace qtgui {
-    
+
     waterfall_sink_f::sptr
     waterfall_sink_f::make(int fftsize, int wintype,
                           double fc, double bw,
@@ -130,6 +131,8 @@ namespace gr {
        d_qApplication = qApp;
       }
       else {
+        std::string style = prefs::singleton()->get_string("qtgui", "style", 
"raster");
+        QApplication::setGraphicsSystem(QString(style.c_str()));
        d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
@@ -326,13 +329,13 @@ namespace gr {
 
       if(d_window.size()) {
        volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), dst,
-                                     &d_window.front(), size);
+                                     &d_window.front(), size);
       }
 
       d_fft->execute();     // compute the fft
 
       volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, 
d_fft->get_outbuf(),
-                                                    size, 1.0, size);
+                                                    size, 1.0, size);
 
       // Perform shift operation
       unsigned int len = (unsigned int)(floor(size/2.0));
@@ -384,8 +387,8 @@ namespace gr {
          memset(d_magbufs[i], 0, newfftsize*sizeof(double));
        }
 
-       // Set new fft size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new fft size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_fftsize = newfftsize;
        d_index = 0;
 
@@ -434,7 +437,7 @@ namespace gr {
               }
               //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
             }
-      
+
            d_last_time = gr::high_res_timer_now();
            d_qApplication->postEvent(d_main_gui,
                                      new WaterfallUpdateEvent(d_magbufs,
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index fe1155b..7c6998a 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -315,6 +315,7 @@ if __name__ == '__main__':
     tb.Wait()
         #end if
     #elif $generate_options == 'qt_gui'
+    
Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster'))
     qapp = Qt.QApplication(sys.argv)
     tb = $(class_name)($(', '.join($params_eq_list)))
     #if $flow_graph.get_option('run')



reply via email to

[Prev in Thread] Current Thread [Next in Thread]