commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r10811 - gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib
Date: Sun, 12 Apr 2009 13:08:24 -0600 (MDT)

Author: trondeau
Date: 2009-04-12 13:08:24 -0600 (Sun, 12 Apr 2009)
New Revision: 10811

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
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
Log:
Adding control over which tabs get displayed.

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
 2009-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.cc
 2009-04-12 19:08:24 UTC (rev 10811)
@@ -59,7 +59,10 @@
 }
 
 void
-SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent)
+SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
+                                    const bool frequency, const bool waterfall,
+                                    const bool waterfall3d, const bool time,
+                                    const bool constellation)
 {
   //_windowStateLock->Lock();
 
@@ -79,6 +82,13 @@
     
     // Called from the Event Thread
     _spectrumDisplayForm = new SpectrumDisplayForm(parent);
+    
+    // Toggle Windows on/off
+    _spectrumDisplayForm->ToggleTabFrequency(frequency);
+    _spectrumDisplayForm->ToggleTabWaterfall(waterfall);
+    _spectrumDisplayForm->ToggleTabWaterfall3D(waterfall3d);
+    _spectrumDisplayForm->ToggleTabTime(time);
+    _spectrumDisplayForm->ToggleTabConstellation(constellation);
 
     _windowOpennedFlag = true;
 

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
  2009-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/SpectrumGUIClass.h
  2009-04-12 19:08:24 UTC (rev 10811)
@@ -22,12 +22,15 @@
 class SpectrumGUIClass
 {
 public:
-  SpectrumGUIClass(const uint64_t, const uint64_t,
-                  const double, const double);
+  SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
+                  const double newStartFrequency, const double 
newStopFrequency);
   ~SpectrumGUIClass();
   void Reset();
 
-  void OpenSpectrumWindow(QWidget*);
+  void OpenSpectrumWindow(QWidget*,
+                         const bool frequency=true, const bool waterfall=true,
+                         const bool waterfall3d=true, const bool time=true,
+                         const bool constellation=true);
   void SetDisplayTitle(const std::string);
 
   bool GetWindowOpenFlag();

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i
===================================================================
--- gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i     
2009-04-12 19:07:43 UTC (rev 10810)
+++ gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui.i     
2009-04-12 19:08:24 UTC (rev 10811)
@@ -32,6 +32,9 @@
   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",
+                                      bool plotfreq=true, bool 
plotwaterfall=true,
+                                      bool plotwaterfall3d=true, bool 
plottime=true,
+                                      bool plotconst=true,
                                       QWidget *parent=NULL);
 
 class qtgui_sink_c : public gr_block
@@ -40,10 +43,16 @@
   friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
                                              float fmin, float fmax,
                                              const std::string &name,
+                                             bool plotfreq, bool plotwaterfall,
+                                             bool plotwaterfall3d, bool 
plottime,
+                                             bool plotconst,
                                              QWidget *parent);
   qtgui_sink_c (int fftsize, int wintype,
                float fmin, float fmax,
                const std::string &name,
+               bool plotfreq, bool plotwaterfall,
+               bool plotwaterfall3d, bool plottime,
+               bool plotconst,
                QWidget *parent);
 
 public:

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-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.cc 
    2009-04-12 19:08:24 UTC (rev 10811)
@@ -34,16 +34,25 @@
 qtgui_make_sink_c (int fftsize, int wintype,
                   float fmin, float fmax,
                   const std::string &name,
+                  bool plotfreq, bool plotwaterfall,
+                  bool plotwaterfall3d, bool plottime,
+                  bool plotconst,
                   QWidget *parent)
 {
   return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype,
                                              fmin, fmax, name,
+                                             plotfreq, plotwaterfall,
+                                             plotwaterfall3d, plottime,
+                                             plotconst,
                                              parent));
 }
 
 qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
                            float fmin, float fmax,
                            const std::string &name,
+                           bool plotfreq, bool plotwaterfall,
+                           bool plotwaterfall3d, bool plottime,
+                           bool plotconst,
                            QWidget *parent)
   : gr_block ("sink_c",
              gr_make_io_signature (1, -1, sizeof(gr_complex)),
@@ -51,6 +60,9 @@
     d_fftsize(fftsize),
     d_wintype((gr_firdes::win_type)(wintype)), 
     d_fmin(fmin), d_fmax(fmax), d_name(name),
+    d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall),
+    d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime),
+    d_plotconst(plotconst),
     d_parent(parent)
 {
   d_main_gui = NULL;
@@ -107,11 +119,15 @@
   uint64_t maxBufferSize = 32768;
   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(d_parent);
+  d_main_gui->OpenSpectrumWindow(d_parent, 
+                                d_plotfreq, d_plotwaterfall,
+                                d_plotwaterfall3d, d_plottime,
+                                d_plotconst);
 
   d_object = new qtgui_obj(d_qApplication);
   qApp->postEvent(d_object, new qtgui_event(&d_pmutex));

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-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/qtgui_sink_c.h  
    2009-04-12 19:08:24 UTC (rev 10811)
@@ -37,6 +37,9 @@
 qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
                                     float fmin=-0.5, float fmax=0.5,
                                     const std::string &name="Spectrum Display",
+                                    bool plotfreq=true, bool 
plotwaterfall=true,
+                                    bool plotwaterfall3d=true, bool 
plottime=true,
+                                    bool plotconst=true,
                                     QWidget *parent=NULL);
 
 class qtgui_sink_c : public gr_block
@@ -45,10 +48,16 @@
   friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
                                              float fmin, float fmax,
                                              const std::string &name,
+                                             bool plotfreq, bool plotwaterfall,
+                                             bool plotwaterfall3d, bool 
plottime,
+                                             bool plotconst,
                                              QWidget *parent);
   qtgui_sink_c (int fftsize, int wintype,
                float fmin, float fmax, 
                const std::string &name,
+               bool plotfreq, bool plotwaterfall,
+               bool plotwaterfall3d, bool plottime,
+               bool plotconst,
                QWidget *parent);
 
   void initialize();
@@ -69,6 +78,8 @@
   int d_index;
   gr_complex *d_residbuf;
 
+  bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst;
+
   QWidget *d_parent;
   SpectrumGUIClass *d_main_gui;
 

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
      2009-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.cc
      2009-04-12 19:08:24 UTC (rev 10811)
@@ -59,6 +59,12 @@
     FFTSizeComboBox->insertItem(FFTSizeComboBox->count(), 
QString("%1").arg(fftSize));
   }
   Reset();
+
+  ToggleTabFrequency(false);
+  ToggleTabWaterfall(false);
+  ToggleTabWaterfall3D(false);
+  ToggleTabTime(false);
+  ToggleTabConstellation(false);
 }
 
 SpectrumDisplayForm::~SpectrumDisplayForm()
@@ -355,7 +361,7 @@
     }
     
     if(_openGLWaterfall3DFlag != 1){
-      SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
+      ToggleTabWaterfall3D(false);
     }
 
     // Clear any previous display
@@ -758,3 +764,79 @@
   _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
                                                    highIntensityColor);
 }
+
+
+void
+SpectrumDisplayForm::ToggleTabFrequency(const bool state)
+{
+  if(state == true) {
+    if(d_plot_fft == -1) {
+      SpectrumTypeTab->addTab(FrequencyPage, "Frequency Display");
+      d_plot_fft = SpectrumTypeTab->count()-1;
+    }
+  }
+  else {
+    SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(FrequencyPage));
+    d_plot_fft = -1;
+  }
+}
+
+void
+SpectrumDisplayForm::ToggleTabWaterfall(const bool state)
+{
+  if(state == true) {
+    if(d_plot_waterfall == -1) {
+      SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display");
+      d_plot_waterfall = SpectrumTypeTab->count()-1;
+    }
+  }
+  else {
+    SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage));
+    d_plot_waterfall = -1;
+  }
+}
+
+void
+SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state)
+{
+  if(state == true) {
+    if(d_plot_waterfall3d == -1) {
+      SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
+      d_plot_waterfall3d = SpectrumTypeTab->count()-1;
+    }
+  }
+  else {
+    SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
+    d_plot_waterfall3d = -1;
+  }
+}
+
+void
+SpectrumDisplayForm::ToggleTabTime(const bool state)
+{
+  if(state == true) {
+    if(d_plot_time == -1) {
+      SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display");
+      d_plot_time = SpectrumTypeTab->count()-1;
+    }
+  }
+  else {
+    SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage));
+    d_plot_time = -1;
+  }
+}
+
+void
+SpectrumDisplayForm::ToggleTabConstellation(const bool state)
+{
+  if(state == true) {
+    if(d_plot_constellation == -1) {
+      SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display");
+      d_plot_constellation = SpectrumTypeTab->count()-1;
+    }
+  }
+  else {
+    SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage));
+    d_plot_constellation = -1;
+  }
+}

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
       2009-04-12 19:07:43 UTC (rev 10810)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/lib/spectrumdisplayform.h
       2009-04-12 19:08:24 UTC (rev 10811)
@@ -58,7 +58,13 @@
   void Waterfall3DAutoScaleBtnCB();
   void FFTComboBoxSelectedCB(const QString&);
 
+  void ToggleTabFrequency(const bool state);
+  void ToggleTabWaterfall(const bool state);
+  void ToggleTabWaterfall3D(const bool state);
+  void ToggleTabTime(const bool state);
+  void ToggleTabConstellation(const bool state);
 
+
 private slots:
   void newFrequencyData( const SpectrumUpdateEvent* );
 
@@ -90,13 +96,11 @@
   double _stopFrequency;
 
   // whether or not to use a particular display
-  enum d_plot_tabs { 
-    d_plot_fft = 0,
-    d_plot_waterfall,
-    d_plot_waterfall3d,
-    d_plot_time,
-    d_plot_constellation,
-  };
+  int d_plot_fft;
+  int d_plot_waterfall;
+  int d_plot_waterfall3d;
+  int d_plot_time;
+  int d_plot_constellation;
 };
 
 #endif /* SPECTRUM_DISPLAY_FORM_H */





reply via email to

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