36 lines
1006 B
C++
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
|