- Change the object ownership semantics to take ownership of unique_ptr's rather than references
- Add helper functions for setting up config - Add support for dynamically updating more config options (path related ones in particular)
This commit is contained in:
@@ -6,29 +6,30 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include "imageselector.h"
|
||||
|
||||
class MainWindow;
|
||||
class ImageSelector;
|
||||
class ImageSwitcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::shared_ptr<ImageSelector>& selector);
|
||||
ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::unique_ptr<ImageSelector>& selector);
|
||||
void start();
|
||||
void scheduleImageUpdate();
|
||||
void setConfigFileReloader(std::function<void()> reloadConfigIfNeededIn);
|
||||
void setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloadConfigIfNeededIn);
|
||||
void setRotationTime(unsigned int timeoutMsec);
|
||||
void setImageSelector(std::unique_ptr<ImageSelector>& selector);
|
||||
|
||||
public slots:
|
||||
void updateImage();
|
||||
private:
|
||||
MainWindow& window;
|
||||
unsigned int timeout;
|
||||
std::shared_ptr<ImageSelector>& selector;
|
||||
std::unique_ptr<ImageSelector> selector;
|
||||
QTimer timer;
|
||||
const unsigned int timeoutNoContent = 5 * 1000; // 5 sec
|
||||
QTimer timerNoContent;
|
||||
std::function<void()> reloadConfigIfNeeded;
|
||||
std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloadConfigIfNeeded;
|
||||
};
|
||||
|
||||
#endif // IMAGESWITCHER_H
|
||||
|
||||
Reference in New Issue
Block a user