Index: sources/gui/guiglobals.cpp =================================================================== diff -u -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad -r846a9ebc350e33be4affab3cc4c136248900015d --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 846a9ebc350e33be4affab3cc4c136248900015d) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file guiglobals.cpp - * \author (last) Behrouz NemaiPour - * \date (last) 12-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 23-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 28-Oct-2019 * @@ -20,6 +20,7 @@ // Project #include "logger.h" #include "guiview.h" +#include "VEventSpy.h" // Project #include "MModel.h" @@ -36,6 +37,8 @@ #include "vtreatmenttime.h" #include "vtreatmentranges.h" #include "VHDOperationModeData.h" +#include "VTreatmentSalineData.h" +#include "VHDTreatmentStatesData.h" #include "VDGDrainPumpData.h" #include "VDGHeatersData.h" @@ -54,9 +57,10 @@ #include "VTreatmentCreate.h" #include "VPriming.h" #include "VTreatmentBegin.h" +#include "VTreatmentAdjustmentSaline.h" namespace Gui { - QQuickView *_viewer = nullptr; + MainView *_viewer = nullptr; /*! * \brief registerTypes @@ -72,6 +76,7 @@ qRegisterMetaType ("GuiRequestReasons"); + // 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. @@ -85,8 +90,12 @@ */ 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")); + 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"); @@ -97,20 +106,19 @@ * \details the GUI initializer/starter function */ bool startGui() { - _viewer = new QQuickView; + _viewer = new MainView; registerTypes(); registerQmlTypes(); - QObject::connect(_viewer, &QQuickView::statusChanged, qApp, [=](QQuickView::Status vStatus) { + QObject::connect(_viewer, &MainView::statusChanged, qApp, [=](MainView::Status vStatus) { // coco begin validated: this portion of the code is handling application initialization - // and if not initialized correctly will terminate the applicaiton . + // and if not initialized correctly will terminate the application . // So it had been manually tested. - LOG_DEBUG(__FUNCTION__); - bool ok = vStatus == QQuickView::Ready; + bool ok = vStatus == MainView::Ready; if (ok) { _viewer->show(); } - else if (vStatus == QQuickView::Error || vStatus == QQuickView::Null) { + else if (vStatus == MainView::Error || vStatus == MainView::Null) { for (const auto &error : _viewer->errors()) { LOG_DEBUG(QString("Application Terminated: %1").arg(error.toString())); } @@ -119,9 +127,9 @@ // coco end }, Qt::QueuedConnection ); - LOG_DEBUG("QQuickView Starting"); + LOG_DEBUG("MainView Starting"); _viewer->setSource(QStringLiteral("qrc:/main.qml")); - LOG_DEBUG("QQuickView started"); + LOG_DEBUG("MainView started"); return true; } }