diff --git a/src/qtgui/CMakeLists.txt b/src/qtgui/CMakeLists.txt
index 8f84942f95..6493931efb 100644
--- a/src/qtgui/CMakeLists.txt
+++ b/src/qtgui/CMakeLists.txt
@@ -50,6 +50,8 @@ add_source_files(SRCS_LIST
nb_options.h
plotter.cpp
plotter.h
+ plotter2.cpp
+ plotter2.h
qtcolorpicker.cpp
qtcolorpicker.h
)
diff --git a/src/qtgui/dockprobe.cpp b/src/qtgui/dockprobe.cpp
index 0c07fa44b5..05838e912f 100644
--- a/src/qtgui/dockprobe.cpp
+++ b/src/qtgui/dockprobe.cpp
@@ -56,6 +56,7 @@ DockProbe::DockProbe(QWidget *parent) :
ui->spectrum->setFreqDigits(1);
grid_init(ui->gridLayout,ui->gridLayout->rowCount(),0/*ui->gridLayout->columnCount()*/);
+ ui->plot->setVisible(false);
}
DockProbe::~DockProbe()
diff --git a/src/qtgui/dockprobe.ui b/src/qtgui/dockprobe.ui
index 98ff3d7083..7658a8464d 100644
--- a/src/qtgui/dockprobe.ui
+++ b/src/qtgui/dockprobe.ui
@@ -71,6 +71,37 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 50
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Audio spectrum
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
@@ -81,6 +112,12 @@
1
+
+ CPlotter2
+ QFrame
+
+ 1
+
diff --git a/src/qtgui/plotter2.cpp b/src/qtgui/plotter2.cpp
index 7777c7ebf2..ccd1800283 100644
--- a/src/qtgui/plotter2.cpp
+++ b/src/qtgui/plotter2.cpp
@@ -38,7 +38,7 @@
#include
#include "plotter2.h"
-Q_LOGGING_CATEGORY(plotter, "plotter2")
+Q_LOGGING_CATEGORY(plotter2, "plotter2")
#define CUR_CUT_DELTA 5 //cursor capture delta in pixels
@@ -54,7 +54,7 @@ Q_LOGGING_CATEGORY(plotter, "plotter2")
#define HOR_MARGIN 5
#define VER_MARGIN 5
-int F2B(float f)
+static int F2B(float f)
{
int b = (f >= 1.0 ? 255 : (f <= 0.0 ? 0 : (int)floor(f * 256.0)));
return b;
@@ -65,13 +65,6 @@ static inline bool val_is_out_of_range(float val, float min, float max)
return (val < min || val > max);
}
-static inline bool out_of_range(float min, float max)
-{
- return (val_is_out_of_range(min, FFT_MIN_DB, FFT_MAX_DB) ||
- val_is_out_of_range(max, FFT_MIN_DB, FFT_MAX_DB) ||
- max < min + 10.f);
-}
-
#define STATUS_TIP \
"Click, drag or scroll on spectrum to tune. " \
"Drag and scroll X and Y axes for pan and zoom. " \
@@ -115,9 +108,9 @@ void CPlotter2::mouseMoveEvent(QMouseEvent* event)
if (event->buttons() == Qt::NoButton)
{
if (m_TooltipsEnabled)
- showToolTip(event, QString("Current demod %1: %2 kHz")
- .arg(m_currentVfo)
- .arg(m_DemodCenterFreq/1.e3, 0, 'f', 3));
+ showToolTip(event, QString("S: %1 M: %2")
+ .arg(0.f, 0, 'f', 3)
+ .arg(0.f, 0, 'f', 3));
}
setCursor(QCursor(Qt::ArrowCursor));
}
@@ -168,7 +161,6 @@ void CPlotter2::resizeEvent(QResizeEvent* )
// if changed, resize pixmaps to new screensize
m_Size = size();
m_DPR = devicePixelRatio();
- fft_plot_height = m_Percent2DScreen * m_Size.height() / 100;
{
m_OverlayPixmap = QPixmap(m_Size.width() * m_DPR, m_Size.height() * m_DPR);
m_OverlayPixmap.setDevicePixelRatio(m_DPR);
@@ -200,6 +192,7 @@ void CPlotter2::draw()
int w;
int h;
int xmin, xmax;
+ QPointF LineBuf[MAX_SCREENSIZE];
if (m_DrawOverlay)
{
@@ -208,10 +201,6 @@ void CPlotter2::draw()
}
- if (!m_Running)
- return;
-
-
// get/draw the 2D spectrum
w = m_2DPixmap.width() / m_DPR;
h = m_2DPixmap.height() / m_DPR;
@@ -229,7 +218,7 @@ void CPlotter2::draw()
for (i = 0; i < n; i++)
{
LineBuf[i].setX(i + xmin + 0.5);
- LineBuf[i].setY(m_fftbuf[i + xmin] + 0.5);
+ LineBuf[i].setY(m_data[i + xmin] + 0.5);
}
painter2.setPen(m_PlotColor);
painter2.drawPolyline(LineBuf, n);
@@ -294,6 +283,7 @@ void CPlotter2::drawOverlay()
int fLabelTop = xAxisTop + VER_MARGIN;
+ #if 0
if (m_CenterLineEnabled)
{
x = xFromFreq(m_CenterFreq);
@@ -303,7 +293,7 @@ void CPlotter2::drawOverlay()
painter.drawLine(x, 0, x, xAxisTop);
}
}
-
+
// Frequency grid
qint64 StartFreq = m_CenterFreq + m_FftCenter - m_Span / 2;
QString label;
@@ -375,7 +365,7 @@ void CPlotter2::drawOverlay()
painter.drawText(rect, Qt::AlignRight|Qt::AlignVCenter, QString::number(dB));
}
}
-
+#endif
painter.end();
}
@@ -388,6 +378,7 @@ void CPlotter2::drawOverlay()
// Keeps all strings the same fractional length
void CPlotter2::makeFrequencyStrs()
{
+#if 0
qint64 StartFreq = m_StartFreqAdj;
double freq;
int i,j;
@@ -434,24 +425,22 @@ void CPlotter2::makeFrequencyStrs()
m_HDivText[i].setNum(freq,'f', max);
StartFreq += m_FreqPerDiv;
}
+#endif
}
// Ensure overlay is updated by either scheduling or forcing a redraw
void CPlotter2::updateOverlay()
{
- if (m_Running)
- m_DrawOverlay = true;
- else
- drawOverlay();
+ drawOverlay();
}
void CPlotter2::calcDivSize (qint64 low, qint64 high, int divswanted, qint64 &adjlow, qint64 &step, int& divs)
{
- qCDebug(plotter) << "low:" << low;
- qCDebug(plotter) << "high:" << high;
- qCDebug(plotter) << "divswanted:" << divswanted;
+ qCDebug(plotter2) << "low:" << low;
+ qCDebug(plotter2) << "high:" << high;
+ qCDebug(plotter2) << "divswanted:" << divswanted;
if (divswanted == 0)
return;
@@ -479,9 +468,9 @@ void CPlotter2::calcDivSize (qint64 low, qint64 high, int divswanted, qint64 &ad
if (adjlow < low)
adjlow += step;
- qCDebug(plotter) << "adjlow:" << adjlow;
- qCDebug(plotter) << "step:" << step;
- qCDebug(plotter) << "divs:" << divs;
+ qCDebug(plotter2) << "adjlow:" << adjlow;
+ qCDebug(plotter2) << "step:" << step;
+ qCDebug(plotter2) << "divs:" << divs;
}
void CPlotter2::showToolTip(QMouseEvent* event, QString toolTipText)
diff --git a/src/qtgui/plotter2.h b/src/qtgui/plotter2.h
index a65eadeabd..eaa81a7908 100644
--- a/src/qtgui/plotter2.h
+++ b/src/qtgui/plotter2.h
@@ -29,7 +29,7 @@ class CPlotter2 : public QFrame
QSize sizeHint() const override;
void draw(); //call to draw new fft data onto screen plot
- void setRunningState(bool running) { m_Running = running; }
+ void setTooltipsEnabled(bool enabled) { m_TooltipsEnabled = enabled; }
void setNewData(float *data, int size);
@@ -55,14 +55,17 @@ public slots:
void showToolTip(QMouseEvent* event, QString toolTipText);
float *m_data{};
+ int m_dataSize;
QPixmap m_2DPixmap;
QPixmap m_OverlayPixmap;
+ QColor m_PlotColor{255,255,255};
QSize m_Size;
qreal m_DPR{};
QString m_HDivText[HORZ_DIVS_MAX+1];
bool m_DrawOverlay;
bool m_TooltipsEnabled{}; /*!< Tooltips enabled */
bool m_InvertScrolling;
+ bool m_polar{false};
int m_CursorCaptureDelta;
int m_GrabPosition;
@@ -72,6 +75,8 @@ public slots:
int m_FHiCmax;
bool m_symetric;
+ int m_XAxisYCenter{};
+ int m_YAxisWidth{};
int m_HorDivs; /*!< Current number of horizontal divisions. Calculated from width. */
int m_VerDivs; /*!< Current number of vertical divisions. Calculated from height. */