* @brief Sets the visible plot time window in seconds and notifies time-axis plots. */
| 1144 | * @brief Sets the visible plot time window in seconds and notifies time-axis plots. |
| 1145 | */ |
| 1146 | void UI::Dashboard::setPlotTimeRange(const double seconds) |
| 1147 | { |
| 1148 | const double clamped = qMax(0.001, seconds); |
| 1149 | if (qFuzzyCompare(m_plotTimeRange, clamped)) |
| 1150 | return; |
| 1151 | |
| 1152 | m_plotTimeRange = clamped; |
| 1153 | |
| 1154 | if (AppState::instance().operationMode() != SerialStudio::ProjectFile) |
| 1155 | m_settings.setValue("Dashboard/PlotTimeRange", m_plotTimeRange); |
| 1156 | |
| 1157 | auto savedPlotRings = snapshotPlotTimeRings(); |
| 1158 | auto savedMultiplotRings = snapshotMultiplotTimeRings(); |
| 1159 | const auto savedPlotSweep = m_plotSweep; |
| 1160 | const auto savedMultiplotSweep = m_multiplotSweep; |
| 1161 | |
| 1162 | configureLineSeries(); |
| 1163 | configureMultiLineSeries(); |
| 1164 | |
| 1165 | restorePlotTimeRings(savedPlotRings); |
| 1166 | restoreMultiplotTimeRings(savedMultiplotRings); |
| 1167 | restorePlotSweepConfig(savedPlotSweep); |
| 1168 | restoreMultiplotSweepConfig(savedMultiplotSweep); |
| 1169 | |
| 1170 | m_updateRequired = true; |
| 1171 | Q_EMIT plotTimeRangeChanged(); |
| 1172 | } |
| 1173 | |
| 1174 | /** |
| 1175 | * @brief Toggles whether dashboard preference changes are written to QSettings. |
no test coverage detected