/
klischa
/
AstraScanner2
Обзор
Документация
Войти
/
klischa
/
AstraScanner2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/controllers/TurntableController.cpp
83 строки
3 KB
Arena Agent
refactor: introduce turntable controller for scan flow
17 июн 2026, 10:09
17 июн 2026, 10:09
7a1bb0c
Код
Авторство
О чём код?
#include "TurntableController.h" TurntableController::TurntableController(QObject *parent) : QObject(parent) { } TurntableController::ToggleOutcome TurntableController::handleToggle(bool enabled, bool projectOpen, int intervalSec, int targetCount) { ToggleOutcome out; if (!enabled) { out.stopTimer = true; out.statusText = QString("Остановлено. Сохранено %1 сканов").arg(m_turntableCaptured); return out; } if (!projectOpen) { out.stopTimer = true; out.uncheckCheckbox = true; out.warningText = QStringLiteral("Сначала создайте или откройте проект (меню «Файл»)."); return out; } m_turntableCaptured = 0; out.startTimer = true; out.intervalMs = intervalSec * 1000; out.statusText = QString("Идёт: 0 / %1, интервал %2 с").arg(targetCount).arg(intervalSec); return out; } TurntableController::TickPreparation TurntableController::beginTick(bool scanning, bool projectOpen) { TickPreparation out; if (!scanning) { out.stopTimer = true; out.warningText = QStringLiteral("[Turntable] tick: not scanning, stopping timer"); return out; } if (!projectOpen) { out.stopTimer = true; out.uncheckCheckbox = true; out.warningText = QStringLiteral("[Turntable] project closed mid-run — stopping"); return out; } out.proceed = true; return out; } TurntableController::StepOutcome TurntableController::onEmptyCloud() { StepOutcome out; out.capturedCount = m_turntableCaptured; out.statusText = QString("Пропуск тика (пустое облако), сохранено %1").arg(m_turntableCaptured); return out; } TurntableController::StepOutcome TurntableController::onAccumulateStep(int pointCount, int targetCount) { StepOutcome out; ++m_turntableCaptured; out.capturedCount = m_turntableCaptured; out.statusText = QString("Накопление: %1 точек (скан %2)").arg(pointCount).arg(m_turntableCaptured); if (m_turntableCaptured >= targetCount) { out.completed = true; out.requestStopCapture = true; } return out; } TurntableController::StepOutcome TurntableController::onSeparateStep(int pointCount, int targetCount) { StepOutcome out; ++m_turntableCaptured; out.capturedCount = m_turntableCaptured; out.statusText = QString("Сохранено %1 / %2 (%3 точек в последнем скане)") .arg(m_turntableCaptured) .arg(targetCount) .arg(pointCount); if (m_turntableCaptured >= targetCount) { out.completed = true; out.requestStopCapture = true; } return out; }