summaryrefslogtreecommitdiff
path: root/gr-qtgui
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui')
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc17
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc7
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.cc3
3 files changed, 18 insertions, 9 deletions
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index e3c773e4c..70b11dd0e 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -27,6 +27,7 @@
#include <qwt_scale_draw.h>
#include <qwt_legend.h>
+#include <QColor>
#include <iostream>
class TimePrecisionClass
@@ -122,7 +123,16 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
set_yaxis(-2.0, 2.0);
setAxisTitle(QwtPlot::yLeft, "Normalized Voltage");
-
+
+ //QColor clr(Qt::blue);
+ QList<QColor> colors;
+ colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green)
+ << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta)
+ << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed)
+ << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray);
+
+ int ncolors = colors.size();
+
// Setup dataPoints and plot vectors
// Automatically deleted when parent is deleted
for(int i = 0; i < _nplots; i++) {
@@ -131,10 +141,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i)));
_plot_curve[i]->attach(this);
- if(i == 0)
- _plot_curve[i]->setPen(QPen(Qt::blue));
- else
- _plot_curve[i]->setPen(QPen(Qt::red));
+ _plot_curve[i]->setPen(QPen(colors[i]));
_plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
}
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
index 434a9dffc..1cd391893 100644
--- a/gr-qtgui/lib/qtgui_time_sink_c.cc
+++ b/gr-qtgui/lib/qtgui_time_sink_c.cc
@@ -136,12 +136,13 @@ qtgui_time_sink_c::general_work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- int n=0, j=0;
- const gr_complex *in = (const gr_complex*)input_items[0];
+ int n=0, j=0, idx=0;
+ const gr_complex *in = (const gr_complex*)input_items[idx];
for(int i=0; i < noutput_items; i+=d_size) {
unsigned int datasize = noutput_items - i;
unsigned int resid = d_size-d_index;
+ idx = 0;
// If we have enough input for one full plot, do it
if(datasize >= resid) {
@@ -149,6 +150,7 @@ qtgui_time_sink_c::general_work (int noutput_items,
// Fill up residbufs with d_size number of items
for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
for(unsigned int k = 0; k < resid; k++) {
d_residbufs[n][d_index+k] = in[j+k].real();
d_residbufs[n+1][d_index+k] = in[j+k].imag();
@@ -168,6 +170,7 @@ qtgui_time_sink_c::general_work (int noutput_items,
// Otherwise, copy what we received into the residbufs for next time
else {
for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
for(unsigned int k = 0; k < resid; k++) {
d_residbufs[n][d_index+k] = in[j+k].real();
d_residbufs[n+1][d_index+k] = in[j+k].imag();
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc
index 6730ae51d..ae4caf31a 100644
--- a/gr-qtgui/lib/spectrumUpdateEvents.cc
+++ b/gr-qtgui/lib/spectrumUpdateEvents.cc
@@ -194,10 +194,9 @@ TimeUpdateEvent::TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
_nplots = timeDomainPoints.size();
for(size_t i = 0; i < _nplots; i++) {
_dataTimeDomainPoints.push_back(new double[_numTimeDomainDataPoints]);
-
if(numTimeDomainDataPoints > 0) {
memcpy(_dataTimeDomainPoints[i], timeDomainPoints[i],
- numTimeDomainDataPoints*sizeof(double));
+ _numTimeDomainDataPoints*sizeof(double));
}
}
}