Dynamically increase delay between screenshots up to one second

Otherwise users with a very low switcher interval might not be able to
use the preview dialog at all
This commit is contained in:
WarmUpTill 2023-01-30 20:56:39 +01:00 committed by WarmUpTill
parent 8ad3563963
commit 5f3a3dd5cf

View File

@ -198,12 +198,21 @@ void PreviewDialog::CheckForMatchLoop()
if (_stop || isHidden()) {
return;
}
if (!screenshot.done || !_video.ValidSelection()) {
if (!_video.ValidSelection()) {
_statusLabel->setText(obs_module_text(
"AdvSceneSwitcher.condition.video.screenshotFail"));
_imageLabel->setPixmap(QPixmap());
continue;
}
if (!screenshot.done) {
_statusLabel->setText(obs_module_text(
"AdvSceneSwitcher.condition.video.screenshotFail"));
_imageLabel->setPixmap(QPixmap());
if (_delay < 1000) {
_delay += 50;
}
continue;
}
if (screenshot.image.width() == 0 ||
screenshot.image.height() == 0) {
_statusLabel->setText(obs_module_text(
@ -220,6 +229,8 @@ void PreviewDialog::CheckForMatchLoop()
_areaParams.area.height);
}
MarkMatch(screenshot.image);
} else {
_statusLabel->setText("");
}
_imageLabel->setPixmap(QPixmap::fromImage(screenshot.image));
}