- Add support for loading configuration via a file rather than the command line
- Added "-c" command line option to look for config file "slide.options.json" in. Otherwise looks in ~/.config/slide/slide.options.json or /etc/slide/slide.options.json - Added code to reload config options at runtime (when the image is scheduled to update)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <QTimer>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
class MainWindow;
|
||||
class ImageSelector;
|
||||
@@ -12,19 +13,22 @@ class ImageSwitcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImageSwitcher(MainWindow& w, unsigned int timeout, std::unique_ptr<ImageSelector>& selector);
|
||||
ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::shared_ptr<ImageSelector>& selector);
|
||||
void start();
|
||||
void scheduleImageUpdate();
|
||||
void setConfigFileReloader(std::function<void()> reloadConfigIfNeededIn);
|
||||
void setRotationTime(unsigned int timeoutMsec);
|
||||
|
||||
public slots:
|
||||
void updateImage();
|
||||
private:
|
||||
MainWindow& window;
|
||||
unsigned int timeout;
|
||||
std::unique_ptr<ImageSelector>& selector;
|
||||
std::shared_ptr<ImageSelector>& selector;
|
||||
QTimer timer;
|
||||
const unsigned int timeoutNoContent = 5 * 1000; // 5 sec
|
||||
QTimer timerNoContent;
|
||||
std::function<void()> reloadConfigIfNeeded;
|
||||
};
|
||||
|
||||
#endif // IMAGESWITCHER_H
|
||||
|
||||
Reference in New Issue
Block a user