From a402722aa5a2d62babff01fec77ceb9c7d2a648b Mon Sep 17 00:00:00 2001 From: IonutMuthi Date: Tue, 5 Nov 2024 05:28:18 -0500 Subject: [PATCH] datalogger: use menu spinbox for time Signed-off-by: IonutMuthi --- .../datalogger/menus/plottimeaxiscontroller.hpp | 4 ++-- .../datalogger/src/menus/plottimeaxiscontroller.cpp | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/plugins/datalogger/include/datalogger/menus/plottimeaxiscontroller.hpp b/plugins/datalogger/include/datalogger/menus/plottimeaxiscontroller.hpp index 4487c0fa7..27c363224 100644 --- a/plugins/datalogger/include/datalogger/menus/plottimeaxiscontroller.hpp +++ b/plugins/datalogger/include/datalogger/menus/plottimeaxiscontroller.hpp @@ -25,8 +25,8 @@ #include #include #include +#include #include -#include #include "scopy-datalogger_export.h" namespace scopy { @@ -45,7 +45,7 @@ class SCOPY_DATALOGGER_EXPORT PlotTimeAxisController : public QWidget private: MonitorPlot *m_plot; - PositionSpinButton *m_xdelta; + gui::MenuSpinbox *m_xdelta; QDateEdit *dateEdit; QTimeEdit *timeEdit; MenuOnOffSwitch *realTimeToggle; diff --git a/plugins/datalogger/src/menus/plottimeaxiscontroller.cpp b/plugins/datalogger/src/menus/plottimeaxiscontroller.cpp index a58aa66dd..cf7e4ee1a 100644 --- a/plugins/datalogger/src/menus/plottimeaxiscontroller.cpp +++ b/plugins/datalogger/src/menus/plottimeaxiscontroller.cpp @@ -59,13 +59,10 @@ PlotTimeAxisController::PlotTimeAxisController(MonitorPlot *m_plot, QWidget *par timeEdit->setDisplayFormat("hh:mm:ss"); timeEdit->setVisible(false); - m_xdelta = new PositionSpinButton( - { - {"s", 1}, - {"min", 60}, - {"hour", 3600}, - }, - "Delta", -DBL_MAX, DBL_MAX, false, false, xAxisContainer); + m_xdelta = new gui::MenuSpinbox("Delta", DataMonitorUtils::getAxisDefaultMaxValue(), "s", 0, DBL_MAX, false, + false, xAxisContainer); + m_xdelta->setScaleRange(1, 1); + m_xdelta->setIncrementMode(gui::MenuSpinbox::IS_FIXED); m_xdelta->setValue(DataMonitorUtils::getAxisDefaultMaxValue()); auto &&timeTracker = TimeManager::GetInstance(); @@ -89,7 +86,7 @@ PlotTimeAxisController::PlotTimeAxisController(MonitorPlot *m_plot, QWidget *par connect(dateEdit, &QDateEdit::dateChanged, this, &PlotTimeAxisController::updatePlotStartPoint); connect(timeEdit, &QTimeEdit::timeChanged, this, &PlotTimeAxisController::updatePlotStartPoint); - connect(m_xdelta, &PositionSpinButton::valueChanged, this, + connect(m_xdelta, &gui::MenuSpinbox::valueChanged, this, [=, this](double value) { m_plot->updateXAxisIntervalMax(value); }); xAxisSection->contentLayout()->addWidget(realTimeToggle);