Skip to content

Commit

Permalink
datamonitor: buffer previewer navigation updates
Browse files Browse the repository at this point in the history
Signed-off-by: Ionut Muthi <[email protected]>
  • Loading branch information
IonutMuthi committed Apr 25, 2024
1 parent 4e0a1d5 commit a70ffa8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class SCOPY_DATAMONITORPLUGIN_EXPORT MonitorPlot : public QWidget
void updatePlotStartingPoint(double time, double delta);

void toggleBufferPreview(bool toggled);
void updateBufferPreviewer(double time);

Q_SIGNALS:
void monitorCurveAdded(PlotChannel *c);
Expand Down
11 changes: 10 additions & 1 deletion plugins/datamonitorPlugin/src/datamonitor/monitorplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void MonitorPlot::addMonitor(DataMonitorModel *dataMonitorModel)

connect(dataMonitorModel, &DataMonitorModel::dataCleared, this, [=, this]() {
plotCurve->clearCurveData();
updateBufferPreviewer(m_startTime);
m_plot->replot();
});

Expand All @@ -93,6 +94,7 @@ void MonitorPlot::toggleMonitor(bool toggled, QString monitorName)
{
if(m_monitorCurves->contains(monitorName)) {
m_monitorCurves->value(monitorName)->toggleActive(toggled);
m_bufferPreviewer->updateBufferPreviewer();
m_plot->replot();
}
}
Expand Down Expand Up @@ -227,18 +229,25 @@ void MonitorPlot::updatePlotStartingPoint(double time, double delta)
m_plot->xAxis()->setInterval(time - delta, time);
}

m_bufferPreviewer->updateDataLimits(m_startTime, time);
updateBufferPreviewer(time);
m_plot->replot();
}

void MonitorPlot::toggleBufferPreview(bool toggled) { m_bufferPreviewer->setVisible(toggled); }

void MonitorPlot::updateBufferPreviewer(double time) { m_bufferPreviewer->updateDataLimits(m_startTime, time); }

void MonitorPlot::generateBufferPreviewer()
{

AnalogBufferPreviewer *bufferPreviewer = new AnalogBufferPreviewer(this);
m_bufferPreviewer = new PlotBufferPreviewer(m_plot, bufferPreviewer, this);

connect(m_plot->navigator(), &PlotNavigator::rectChanged, this, [=, this]() {
double time = QwtDate::toDouble(QDateTime::currentDateTime());
updateBufferPreviewer(time);
});

layout->addWidget(m_bufferPreviewer);
m_plot->navigator()->setResetOnNewBase(false);
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ PlotTimeAxisController::PlotTimeAxisController(MonitorPlot *m_plot, QWidget *par
timeEdit->setTime(QTime::currentTime());
dateEdit->setDate(QDate::currentDate());
updatePlotStartPoint();
} else {
double time = QwtDate::toDouble(QDateTime::currentDateTime());
m_plot->updateBufferPreviewer(time);
}
});

Expand Down

0 comments on commit a70ffa8

Please sign in to comment.