Loop delay configuration

This commit is contained in:
Dan Paulat 2023-06-09 00:10:47 -05:00
parent a5df5a237e
commit c7a4706f43
6 changed files with 60 additions and 10 deletions

View file

@ -672,6 +672,10 @@ void MainWindowImpl::ConnectAnimationSignals()
&ui::AnimationDockWidget::LoopSpeedChanged, &ui::AnimationDockWidget::LoopSpeedChanged,
timelineManager_.get(), timelineManager_.get(),
&manager::TimelineManager::SetLoopSpeed); &manager::TimelineManager::SetLoopSpeed);
connect(animationDockWidget_,
&ui::AnimationDockWidget::LoopDelayChanged,
timelineManager_.get(),
&manager::TimelineManager::SetLoopDelay);
connect(animationDockWidget_, connect(animationDockWidget_,
&ui::AnimationDockWidget::AnimationStepBeginSelected, &ui::AnimationDockWidget::AnimationStepBeginSelected,
timelineManager_.get(), timelineManager_.get(),

View file

@ -71,6 +71,7 @@ public:
types::MapTime viewType_ {types::MapTime::Live}; types::MapTime viewType_ {types::MapTime::Live};
std::chrono::minutes loopTime_ {30}; std::chrono::minutes loopTime_ {30};
double loopSpeed_ {5.0}; double loopSpeed_ {5.0};
std::chrono::milliseconds loopDelay_ {2500};
bool radarSweepMonitorActive_ {false}; bool radarSweepMonitorActive_ {false};
std::mutex radarSweepMonitorMutex_ {}; std::mutex radarSweepMonitorMutex_ {};
@ -170,6 +171,13 @@ void TimelineManager::SetLoopSpeed(double loopSpeed)
p->loopSpeed_ = loopSpeed; p->loopSpeed_ = loopSpeed;
} }
void TimelineManager::SetLoopDelay(std::chrono::milliseconds loopDelay)
{
logger_->debug("SetLoopDelay: {}", loopDelay);
p->loopDelay_ = loopDelay;
}
void TimelineManager::AnimationStepBegin() void TimelineManager::AnimationStepBegin()
{ {
logger_->debug("AnimationStepBegin"); logger_->debug("AnimationStepBegin");
@ -417,8 +425,8 @@ void TimelineManager::Impl::Play()
} }
else else
{ {
// Pause for 2.5 seconds at the end of the loop // Pause at the end of the loop
interval = std::chrono::milliseconds(2500); interval = loopDelay_;
} }
animationTimer_.expires_after(interval); animationTimer_.expires_after(interval);

View file

@ -34,6 +34,7 @@ public slots:
void SetLoopTime(std::chrono::minutes loopTime); void SetLoopTime(std::chrono::minutes loopTime);
void SetLoopSpeed(double loopSpeed); void SetLoopSpeed(double loopSpeed);
void SetLoopDelay(std::chrono::milliseconds loopDelay);
void AnimationStepBegin(); void AnimationStepBegin();
void AnimationStepBack(); void AnimationStepBack();

View file

@ -88,6 +88,7 @@ AnimationDockWidget::AnimationDockWidget(QWidget* parent) :
// Set loop defaults // Set loop defaults
ui->loopTimeSpinBox->setValue(30); ui->loopTimeSpinBox->setValue(30);
ui->loopSpeedSpinBox->setValue(5.0); ui->loopSpeedSpinBox->setValue(5.0);
ui->loopDelaySpinBox->setValue(2.5);
// Connect widget signals // Connect widget signals
p->ConnectSignals(); p->ConnectSignals();
@ -161,6 +162,15 @@ void AnimationDockWidgetImpl::ConnectSignals()
&QDoubleSpinBox::valueChanged, &QDoubleSpinBox::valueChanged,
self_, self_,
[this](double d) { Q_EMIT self_->LoopSpeedChanged(d); }); [this](double d) { Q_EMIT self_->LoopSpeedChanged(d); });
QObject::connect(
self_->ui->loopDelaySpinBox,
&QDoubleSpinBox::valueChanged,
self_,
[this](double d)
{
Q_EMIT self_->LoopDelayChanged(std::chrono::milliseconds(
static_cast<typename std::chrono::milliseconds::rep>(d * 1000.0)));
});
// Animation controls // Animation controls
QObject::connect(self_->ui->beginButton, QObject::connect(self_->ui->beginButton,

View file

@ -38,6 +38,7 @@ signals:
void LoopTimeChanged(std::chrono::minutes loopTime); void LoopTimeChanged(std::chrono::minutes loopTime);
void LoopSpeedChanged(double loopSpeed); void LoopSpeedChanged(double loopSpeed);
void LoopDelayChanged(std::chrono::milliseconds loopDelay);
void AnimationStepBeginSelected(); void AnimationStepBeginSelected();
void AnimationStepBackSelected(); void AnimationStepBackSelected();

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>200</width> <width>200</width>
<height>337</height> <height>348</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -130,13 +130,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="loopTimeLabel">
<property name="text">
<string>Loop Time</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="loopTimeSpinBox"> <widget class="QSpinBox" name="loopTimeSpinBox">
<property name="correctionMode"> <property name="correctionMode">
@ -156,6 +149,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="loopTimeLabel">
<property name="text">
<string>Loop Time</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="loopSpeedLabel"> <widget class="QLabel" name="loopSpeedLabel">
<property name="text"> <property name="text">
@ -179,6 +179,32 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="loopDelayLabel">
<property name="text">
<string>Loop Delay</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="loopDelaySpinBox">
<property name="suffix">
<string> sec</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>15.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>2.500000000000000</double>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>