add mqtt control
This commit is contained in:
@@ -21,6 +21,8 @@ ImageSwitcher::ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::uniqu
|
||||
|
||||
void ImageSwitcher::updateImage()
|
||||
{
|
||||
if (paused)
|
||||
return;
|
||||
if(reloadConfigIfNeeded)
|
||||
{
|
||||
reloadConfigIfNeeded(window, this);
|
||||
@@ -60,10 +62,64 @@ void ImageSwitcher::setConfigFileReloader(std::function<void(MainWindow &w, Imag
|
||||
void ImageSwitcher::setRotationTime(unsigned int timeoutMsecIn)
|
||||
{
|
||||
timeout = timeoutMsecIn;
|
||||
timer.start(timeout);
|
||||
if (!paused)
|
||||
timer.start(timeout);
|
||||
}
|
||||
|
||||
void ImageSwitcher::setImageSelector(std::unique_ptr<ImageSelector>& selectorIn)
|
||||
{
|
||||
selector = std::move(selectorIn);
|
||||
}
|
||||
|
||||
void ImageSwitcher::pause()
|
||||
{
|
||||
paused = true;
|
||||
timer.stop();
|
||||
timerNoContent.stop();
|
||||
}
|
||||
|
||||
void ImageSwitcher::resume()
|
||||
{
|
||||
if (!paused)
|
||||
return;
|
||||
paused = false;
|
||||
timer.start(timeout);
|
||||
scheduleImageUpdate();
|
||||
}
|
||||
|
||||
void ImageSwitcher::stepOnce()
|
||||
{
|
||||
bool wasPaused = paused;
|
||||
if (wasPaused)
|
||||
paused = false;
|
||||
updateImage();
|
||||
if (wasPaused)
|
||||
{
|
||||
paused = true;
|
||||
timer.stop();
|
||||
timerNoContent.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageSwitcher::restart(std::unique_ptr<ImageSelector>& selectorIn)
|
||||
{
|
||||
paused = false;
|
||||
timerNoContent.stop();
|
||||
setImageSelector(selectorIn);
|
||||
timer.start(timeout);
|
||||
scheduleImageUpdate();
|
||||
}
|
||||
|
||||
bool ImageSwitcher::skipToNextFolder()
|
||||
{
|
||||
auto *listSelector = dynamic_cast<ListImageSelector*>(selector.get());
|
||||
if (!listSelector)
|
||||
return false;
|
||||
stepOnce();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImageSwitcher::isPaused() const
|
||||
{
|
||||
return paused;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user