lena_pi/LenaPi/main.cpp
2021-08-28 14:24:28 +02:00

41 lines
1.4 KiB
C++

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "controllers/NavigationController.h"
#include "MouseEventSpy.h"
#include "EnergySaver.h"
int main(int argc, char *argv[])
{
/**
* @todo Add command line parser to specify a custom config file
* https://doc.qt.io/qt-5/qcommandlineparser.html
* Add config handling https://doc.qt.io/qt-5/qsettings.html#QSettings-4
* - set root path
* ui mode -> pass to NavigationController and store in UiStateModel
* - set mode
* -- RasPi -> no volumeControl or exit Button
* -- Desktop -> volumeControl and exit Button
* -- in future probably also MobileApp
* Energy saving options -> hand over to energy saver on initialization
* - enable energy saving
* - set energy saver timeout
* - set shutdown script path
*/
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
NavigationController navController;
navController.setContext(engine.rootContext());
navController.init("/home/ar/source/lenaMusic/");
// install MouseEventSpy and energy saver used for auto
// shut down of RaspberryPi if not used for a predefined time.
MouseEventSpy::init();
EnergySaver::init(10);
QObject::connect(MouseEventSpy::instance(), &MouseEventSpy::mouseEventDetected,
EnergySaver::instance(), &EnergySaver::restartTimer);
engine.load(QUrl("qrc:/main.qml"));
return app.exec();
}