#include #include #include #include #include #include #include #include "configmanager.h" #include "buttonsmodel.h" #include "buttoncontroller.h" #include "settingscontainer.h" #include "systeminfo.h" #include "sensorsbridge.h" #include "uiidlewatch.h" #include "sdwatchdog.h" #include "recoverygesture.h" #include int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", "qtvirtualkeyboard"); QGuiApplication app(argc, argv); QCoreApplication::setApplicationName("ButtonTask"); QCoreApplication::setOrganizationName("ButtonTask"); QCoreApplication::setApplicationVersion("2.5"); QCommandLineParser parser; parser.setApplicationDescription("ButtonTask v2 - configurable button panel"); parser.addHelpOption(); parser.addVersionOption(); QCommandLineOption configOpt(QStringList() << "c" << "config", "Path to config.json", "path"); parser.addOption(configOpt); parser.process(app); QString configPath = parser.value(configOpt); if (configPath.isEmpty()) configPath = qEnvironmentVariable("BUTTONTASK_CONFIG"); if (configPath.isEmpty()) configPath = QCoreApplication::applicationDirPath() + "/config/config.json"; qInfo() << "Using config:" << configPath; ConfigManager config(configPath); ButtonsModel model(&config); ButtonController controller(&config, &model); SettingsContainer settings(&config); SystemInfo systemInfo(&config); SensorsBridge sensorsBridge; UiIdleWatch uiIdle; QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("config", &config); engine.rootContext()->setContextProperty("buttonsModel", &model); engine.rootContext()->setContextProperty("btnController", &controller); engine.rootContext()->setContextProperty("settingsContainer", &settings); engine.rootContext()->setContextProperty("systemInfo", &systemInfo); engine.rootContext()->setContextProperty("sensorsBridge", &sensorsBridge); engine.rootContext()->setContextProperty("uiIdle", &uiIdle); engine.load(QUrl(QStringLiteral("qrc:/qml/Main.qml"))); if (engine.rootObjects().isEmpty()) return -1; // Display/GUI watchdog (see bt-displaywatch): systemd ping per real frame // + 10 s hold in the bottom-left corner to request a panel re-init. SdWatchdog sdWatchdog(qobject_cast(engine.rootObjects().first())); RecoveryGesture recoveryGesture; return app.exec(); }