#include "GuiGlobalsAutoGen.h" // Qt #include #include // Project #include "Logger.h" #include "GuiView.h" #include "VEventSpy.h" #include "VGeneralEvent.h" // Confirm #include "VConfirm.h" // Device #include "DeviceView.h" // Project #include "VViewAutoGen.h" // Settings #include "VSettings.h" #include "VLocalization.h" #include "VAlarmStatus.h" #include "VAlarmActiveList.h" #include "VDateTime.h" // START OF AUTO GENERATED CODE // #include "VAlarmStatus.h" #include "VAlarmTriggered.h" #include "VAlarmCleared.h" #include "VAlarmConditionCleared.h" #include "VTDAlarmInformation.h" #include "VDDAlarmInfo.h" #include "VUIActiveAlarmsListRequest.h" #include "VTDActiveAlarmsListRequestResponse.h" #include "VFWVersionsRequest.h" #include "VTDVersionResponse.h" #include "VDDVersionResponse.h" #include "VUICheckIN.h" #include "VTDBloodPump.h" #include "VTDOPMode.h" #include "VDDOPMode.h" #include "VTDEvent.h" #include "VDDEvent.h" #include "VDDValvesStates.h" #include "VDDPressures.h" #include "VTDVoltages.h" #include "VTDBubbles.h" #include "VDDConductivity.h" #include "VTDAirPump.h" #include "VTDSwitches.h" #include "VPowerOffWarning.h" #include "VOffButtonPressRequest.h" #include "VTDPressure.h" #include "VDDConcentratePump.h" #include "VDDTemperature.h" #include "VDialysatePumps.h" #include "VDDHeaters.h" #include "VDDLevel.h" #include "VTDAirTrap.h" #include "VTDValves.h" #include "VROEvent.h" #include "VROAlarmInfo.h" #include "VDDBalChamber.h" #include "VDDGenDialysateMode.h" #include "VDDGenDialysateRequest.h" #include "VROValvesStates.h" #include "VROPump.h" #include "VROOPMode.h" #include "VROPressures.h" #include "VROLevel.h" #include "VROFlow.h" #include "VROConductivity.h" #include "VDDROStartStopCmdRequest.h" #include "VROTemperature.h" #include "VROHeater.h" #include "VTDTreatmentTime.h" #include "VTDTreatmentState.h" #include "VTDSalineBolus.h" #include "VTDUltrafiltration.h" #include "VUITreatmentParamsTOValidate.h" #include "VTDRespTreatmentParamsTOValidate.h" #include "VUIUltrafiltrationVolumeTOValidate.h" #include "VTDRespUltrafiltrationVolumeTOValidate.h" #include "VTDTreatmentParamRanges.h" #include "VUITreatmentParamsConfirmed.h" #include "VUIInitiateTreatmentWorkflow.h" #include "VTDRespInitiateTreatmentWorkflow.h" #include "VUIUFPauseResumeRequest.h" #include "VTDUFPauseResumeResponse.h" #include "VROGenWaterMode.h" #include "VDDPreGenDialysateState.h" #include "VDDPostGenDialysateState.h" #include "VDDPreGenDialysateRequest.h" #include "VROPreGenWaterMode.h" #include "VTDEjector.h" #include "VTDTreatmentSetPoints.h" #include "VDDPistonPumpControl.h" #include "VAckMessageThatRequiresAck.h" #include "valarmstatushelper.h" // END OF AUTO GENERATED CODE // namespace Gui { MainView *_viewer = nullptr; /*! * \brief registerTypes * \details registering meta types */ void registerTypes() { qRegisterMetaType ("GuiActionType" ); qRegisterMetaType ("GuiActionData" ); qRegisterMetaType ("GuiAlarmID" ); qRegisterMetaType ("GuiAlarmPriority"); qRegisterMetaType ("GuiRequestReasons"); qRegisterMetaType ("GuiStringIndexMap" ); qRegisterMetaType ("GuiUint08IndexMap" ); // Note that this Models are not used in the QML // but Qt needs them to be registered to be able to use them in between threads queue // by their metadata information. REGISTER_MODEL_METATYPES LOG_DEBUG("Models Registered"); } /*! * \brief registerQmlTypes * \details registering QML types */ void registerQmlTypes() { //using namespace View; qmlRegisterType ("Gui.View" , 0, 1, "GuiView"); qmlRegisterUncreatableType ("Gui.Actions" , 0, 1, "GuiActions" , QStringLiteral("Used only for enumerations no need to have an object")); qmlRegisterSingletonType ("Gui.VEventSpy", 0, 1, "GuiEventSpy", [](QQmlEngine *, QJSEngine *) -> QObject * { return &_VEventSpy; }); REGISTER_VIEW_TYPES LOG_DEBUG("Views Registered"); } /*! * \brief startGui * \details the GUI initializer/starter function */ bool startGui() { _viewer = new MainView; registerTypes(); registerQmlTypes(); QObject::connect(_viewer, &MainView::statusChanged, qApp, [=](MainView::Status vStatus) { // this portion of the code is handling application initialization // and if not initialized correctly will terminate the application . bool ok = vStatus == MainView::Ready; if (ok) { _viewer->show(); } else if (vStatus == MainView::Error || vStatus == MainView::Null) { for (const auto &error : _viewer->errors()) { LOG_DEBUG(QString("Application Terminated: %1").arg(error.toString())); } QCoreApplication::exit(-1); } }, Qt::QueuedConnection ); LOG_DEBUG("MainView Starting"); _viewer->engine()->addImportPath("qrc:/plugins"); //DEBUG: qDebug() << _viewer->engine()->importPathList(); _viewer->setSource(QStringLiteral("qrc:/main.qml")); LOG_DEBUG("MainView started"); return true; } }