Skip to content

Commit

Permalink
datalogger: use menu spinbox for time
Browse files Browse the repository at this point in the history
Signed-off-by: IonutMuthi <[email protected]>
  • Loading branch information
IonutMuthi committed Nov 15, 2024
1 parent 79d0c16 commit a402722
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <QDateTimeEdit>
#include <QWidget>
#include <menuonoffswitch.h>
#include <menuspinbox.h>
#include <monitorplot.hpp>
#include <spinbox_a.hpp>
#include "scopy-datalogger_export.h"

namespace scopy {
Expand All @@ -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;
Expand Down
13 changes: 5 additions & 8 deletions plugins/datalogger/src/menus/plottimeaxiscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit a402722

Please sign in to comment.