lena_pi/LenaPi/main.cpp
2019-04-04 13:38:56 +02:00

43 lines
1.7 KiB
C++

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "controllers/NavigationController.h"
#include "MouseEventSpy.h"
#include "EnergySaver.h"
int main(int argc, char *argv[])
{
/**
* @todo To add an image viewer:
* - introduce an image context in qml -> can be switched via toggle buttons in each view
* - introduce NavigationControllerBase with all basic functions of the current NavigationController
* - derive MusicNavigationController and ImageNavigatioController
* - NavigationController than holds instances of UiStateModel, ImageNavigationController and
* MusicNavigationController.
* - connect toggle buttons to UiStateModel
*
* Aim:
* - Add an imageViewer but allow listening to Music while using it.
* - When modifying music keep state of image viewer, keep state of player when switching to
* imageViewer -> musicPlayer and imageViewer are independent parts of this software!
* USE SEPARATE BRANCH FOR DEVELOPMENT!
*/
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
/// @todo add config parser to determine root path.
/// @todo add reaction to system signal reload config.
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();
}