Files
slide/src/imageswitcher.h
Alfred Reynolds be8f615c21 - Add a new Log() function to replace ad-hoc std::cout calls wrapped in debugMode checks
- Remove debugMode from classes that don't need it (i.e all of them)
2021-08-26 12:13:09 +12:00

36 lines
1006 B
C++

#ifndef IMAGESWITCHER_H
#define IMAGESWITCHER_H
#include <QObject>
#include <QTimer>
#include <iostream>
#include <memory>
#include <functional>
#include "imageselector.h"
class MainWindow;
class ImageSwitcher : public QObject
{
Q_OBJECT
public:
ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::unique_ptr<ImageSelector>& selector);
void start();
void scheduleImageUpdate();
void setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloadConfigIfNeededIn);
void setRotationTime(unsigned int timeoutMsec);
void setImageSelector(std::unique_ptr<ImageSelector>& selector);
public slots:
void updateImage();
private:
MainWindow& window;
unsigned int timeout;
std::unique_ptr<ImageSelector> selector;
QTimer timer;
const unsigned int timeoutNoContent = 5 * 1000; // 5 sec
QTimer timerNoContent;
std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloadConfigIfNeeded;
};
#endif // IMAGESWITCHER_H