add mqtt control
This commit is contained in:
19
src/main.cpp
19
src/main.cpp
@@ -3,6 +3,7 @@
|
||||
#include "imageswitcher.h"
|
||||
#include "pathtraverser.h"
|
||||
#include "immichpathtraverser.h"
|
||||
#include "mqttcontroller.h"
|
||||
#include "overlay.h"
|
||||
#include "appconfig.h"
|
||||
#include "logger.h"
|
||||
@@ -275,6 +276,24 @@ int main(int argc, char *argv[])
|
||||
w.setImageSwitcher(&switcher);
|
||||
std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloader = [&appConfig](MainWindow &w, ImageSwitcher *switcher) { ReloadConfigIfNeeded(appConfig, w, switcher); };
|
||||
switcher.setConfigFileReloader(reloader);
|
||||
|
||||
std::unique_ptr<MqttController> mqttController;
|
||||
if (appConfig.mqtt.enabled)
|
||||
{
|
||||
mqttController = std::unique_ptr<MqttController>(new MqttController(appConfig.mqtt, &a));
|
||||
QObject::connect(mqttController.get(), &MqttController::play, [&switcher]() { switcher.resume(); });
|
||||
QObject::connect(mqttController.get(), &MqttController::pause, [&switcher]() { switcher.pause(); });
|
||||
QObject::connect(mqttController.get(), &MqttController::nextImage, [&switcher]() { switcher.stepOnce(); });
|
||||
QObject::connect(mqttController.get(), &MqttController::nextFolder, [&switcher]() {
|
||||
if (!switcher.skipToNextFolder())
|
||||
switcher.stepOnce();
|
||||
});
|
||||
QObject::connect(mqttController.get(), &MqttController::restart, [&appConfig, &switcher]() {
|
||||
std::unique_ptr<ImageSelector> newSelector = GetSelectorForApp(appConfig);
|
||||
switcher.restart(newSelector);
|
||||
});
|
||||
mqttController->start();
|
||||
}
|
||||
switcher.start();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user