commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10703 - gnuradio/branches/developers/trondeau/qtdevel


From: trondeau
Subject: [Commit-gnuradio] r10703 - gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib
Date: Sun, 29 Mar 2009 19:06:06 -0600 (MDT)

Author: trondeau
Date: 2009-03-29 19:06:05 -0600 (Sun, 29 Mar 2009)
New Revision: 10703

Modified:
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
   gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.cc
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.h
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
Log:
wip: working on merging PyQt with the QT sinks.

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
 2009-03-30 00:19:42 UTC (rev 10702)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
 2009-03-30 01:06:05 UTC (rev 10703)
@@ -9,8 +9,11 @@
 const long SpectrumGUIClass::MAX_FFT_SIZE;
 const long SpectrumGUIClass::MIN_FFT_SIZE;
 
-SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t 
fftSize, 
-                                  const double newStartFrequency, const double 
newStopFrequency){
+SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
+                                  const uint64_t fftSize, 
+                                  const double newStartFrequency,
+                                  const double newStopFrequency)
+{
   _dataPoints = maxDataSize;
   if(_dataPoints < 2){
     _dataPoints = 2;
@@ -54,7 +57,8 @@
   //delete _windowStateLock;
 }
 
-void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent){
+void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent)
+{
   //_windowStateLock->Lock();
 
   if(!_windowOpennedFlag){
@@ -341,4 +345,11 @@
 }
 
 
+SpectrumDisplayForm*
+SpectrumGUIClass::get_qdialog()
+{
+  return _spectrumDisplayForm;
+}
+
+
 #endif /* SPECTRUM_GUI_CLASS_CPP */

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
  2009-03-30 00:19:42 UTC (rev 10702)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
  2009-03-30 01:06:05 UTC (rev 10703)
@@ -19,9 +19,11 @@
 #include <vector>
 #include <string>
 
-class SpectrumGUIClass{
+class SpectrumGUIClass
+{
 public:
-  SpectrumGUIClass(const uint64_t, const uint64_t, const double, const double);
+  SpectrumGUIClass(const uint64_t, const uint64_t,
+                  const double, const double);
   ~SpectrumGUIClass();
   void Reset();
 
@@ -36,7 +38,11 @@
   double GetStopFrequency()const;
   double GetCenterFrequency()const;
 
-  void UpdateWindow(const bool, const std::complex<float>*, const uint64_t, 
const float*, const uint64_t, const float*, const uint64_t, const double, const 
timespec, const bool);
+  void UpdateWindow(const bool, const std::complex<float>*,
+                   const uint64_t, const float*,
+                   const uint64_t, const float*,
+                   const uint64_t, const double,
+                   const timespec, const bool);
 
   float GetPowerValue()const;
   void SetPowerValue(const float);
@@ -59,6 +65,8 @@
   static const long MAX_FFT_SIZE = /*1048576*/32768;
   static const long MIN_FFT_SIZE = 1024;
 
+  SpectrumDisplayForm* get_qdialog();
+
 protected:
 
 private:

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i
===================================================================
--- gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i     
2009-03-30 00:19:42 UTC (rev 10702)
+++ gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i     
2009-03-30 01:06:05 UTC (rev 10703)
@@ -29,24 +29,25 @@
 
 GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
 
-  qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+  qtgui_sink_c_sptr qtgui_make_sink_c (PyObject *parent,
+                                      int fftsize, int wintype,
                                       float fmin=-0.5, float fmax=0.5,
                                       const std::string &name="Display");
 
 class qtgui_sink_c : public gr_block
 {
 private:
-  friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+  friend qtgui_sink_c_sptr qtgui_make_sink_c (PyObject *parent,
+                                             int fftsize, int wintype,
                                              float fmin, float fmax,
                                              const std::string &name);
-  qtgui_sink_c (int fftsize, int wintype,
-               float fmin, float fmax, const std::string &name);
+  qtgui_sink_c (PyObject *parent,
+               int fftsize, int wintype,
+               float fmin, float fmax,
+               const std::string &name);
 
 public:
-  void start_app();
-  void initialize();
-  void initialize(QApplication *qapp);
-  QApplication* get_qapplication(); 
+  void exec_();
 };
 
 
@@ -77,4 +78,3 @@
   void start_app();
 };
 
-

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.cc 
    2009-03-30 00:19:42 UTC (rev 10702)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.cc 
    2009-03-30 01:06:05 UTC (rev 10703)
@@ -31,20 +31,24 @@
 #include <QTimer>
 
 qtgui_sink_c_sptr
-qtgui_make_sink_c (int fftsize, int wintype,
+qtgui_make_sink_c (PyObject *parent, int fftsize, int wintype,
                   float fmin, float fmax, const std::string &name)
 {
-  return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype, fmin, fmax, 
name));
+  return qtgui_sink_c_sptr (new qtgui_sink_c (parent, fftsize, wintype,
+                                             fmin, fmax, name));
 }
 
-qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
+qtgui_sink_c::qtgui_sink_c (PyObject *parent, int fftsize, int wintype,
                            float fmin, float fmax, const std::string &name)
   : gr_block ("sink_c",
              gr_make_io_signature (1, -1, sizeof(gr_complex)),
              gr_make_io_signature (0, 0, 0)),
-    d_fftsize(fftsize), d_wintype((gr_firdes::win_type)(wintype)), 
+    d_fftsize(fftsize),
+    d_wintype((gr_firdes::win_type)(wintype)), 
     d_fmin(fmin), d_fmax(fmax), d_name(name)
 {
+  d_parent = (QWidget*)parent;
+
   d_main_gui = NULL;
   pthread_mutex_init(&d_pmutex, NULL);
   lock();
@@ -60,7 +64,7 @@
 
   buildwindow();
 
-  //initialize();
+  initialize();
 }
 
 qtgui_sink_c::~qtgui_sink_c()
@@ -86,43 +90,24 @@
 void
 qtgui_sink_c::initialize()
 {
-  int argc;
-  char **argv = NULL;
-  d_qApplication = new QApplication(argc, argv);
-  __initialize();
-}
+  d_qApplication = qApp;
 
-
-void
-qtgui_sink_c::initialize(QApplication *qapp)
-{
-  d_qApplication = qapp;
-  __initialize();
-}
-
-void
-qtgui_sink_c::__initialize()
-{
   uint64_t maxBufferSize = 32768;
-  d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, d_fmin, d_fmax);
+  d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, 
+                                   d_fmin, d_fmax);
   d_main_gui->SetDisplayTitle(d_name);
   d_main_gui->SetFFTSize(d_fftsize);
   d_main_gui->SetWindowType((int)d_wintype);
+
   d_main_gui->OpenSpectrumWindow(NULL);
 
   d_object = new qtgui_obj(d_qApplication);
   qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
 }
 
-QApplication* 
-qtgui_sink_c::get_qapplication()
-{
-  return d_qApplication;
-}
 
-
 void
-qtgui_sink_c::start_app()
+qtgui_sink_c::exec_()
 {
   d_qApplication->exec();
 }
@@ -235,7 +220,8 @@
     d_index = 0;
     fft(d_residbuf, d_fftsize, d_fftdata);
     
-    d_main_gui->UpdateWindow(true, d_fftdata, d_fftsize, NULL, 0, 
(float*)d_residbuf, d_fftsize,
+    d_main_gui->UpdateWindow(true, d_fftdata, d_fftsize, NULL, 0, 
+                            (float*)d_residbuf, d_fftsize,
                             1.0/4.0, convert_to_timespec(0.0), true);
   }
   
@@ -244,7 +230,8 @@
       j += d_fftsize;
       fft(&in[i], d_fftsize, d_fftdata);
       
-      d_main_gui->UpdateWindow(true, d_fftdata, d_fftsize, NULL, 0, 
(float*)&in[i], d_fftsize,
+      d_main_gui->UpdateWindow(true, d_fftdata, d_fftsize, NULL, 0, 
+                              (float*)&in[i], d_fftsize,
                               1.0/4.0, convert_to_timespec(0.0), true);
     }
   }

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.h  
    2009-03-30 00:19:42 UTC (rev 10702)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.h  
    2009-03-30 01:06:05 UTC (rev 10703)
@@ -28,25 +28,32 @@
 #include <gri_fft.h>
 #include <qapplication.h>
 #include <qtgui.h>
+#include <Python.h>
 #include "SpectrumGUIClass.h"
 
-
 class qtgui_sink_c;
 typedef boost::shared_ptr<qtgui_sink_c> qtgui_sink_c_sptr;
 
-qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
-                                    float fmin=-0.5, float fmax=0.5, const 
std::string &name="Display");
+qtgui_sink_c_sptr qtgui_make_sink_c (PyObject *parent, 
+                                    int fftsize, int wintype,
+                                    float fmin=-0.5, float fmax=0.5,
+                                    const std::string &name="Display");
 
 class qtgui_sink_c : public gr_block
 {
 private:
-  friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
-                                             float fmin, float fmax, const 
std::string &name);
-  qtgui_sink_c (int fftsize, int wintype,
-               float fmin, float fmax, const std::string &name);
+  friend qtgui_sink_c_sptr qtgui_make_sink_c (PyObject *parent, 
+                                             int fftsize, int wintype,
+                                             float fmin, float fmax,
+                                             const std::string &name);
+  qtgui_sink_c (PyObject *parent, 
+               int fftsize, int wintype,
+               float fmin, float fmax, 
+               const std::string &name);
 
-  void __initialize();
-  
+  void initialize();
+
+  QWidget *d_parent;  
   int d_fftsize;
   gr_firdes::win_type d_wintype;
   std::vector<float> d_window;
@@ -72,14 +79,10 @@
   
 public:
   ~qtgui_sink_c();
-  void initialize();
-  void initialize(QApplication *qapp);
-  void start_app();
+  void exec_();
   void lock();
   void unlock();
 
-  QApplication* get_qapplication();
-
   QApplication *d_qApplication;
   qtgui_obj *d_object;
 

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
      2009-03-30 00:19:42 UTC (rev 10702)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
      2009-03-30 01:06:05 UTC (rev 10703)
@@ -5,7 +5,10 @@
 
 int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1;
 
-SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QDialog(parent){
+SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
+  : QDialog(parent)
+{
+  printf("SpectrumDisplayForm\n");
   setupUi(this);
 
   _systemSpecifiedFlag = false;





reply via email to

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