Index: ConfirmTreatmentTableEntry.qml =================================================================== diff -u --- ConfirmTreatmentTableEntry.qml (revision 0) +++ ConfirmTreatmentTableEntry.qml (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,64 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright \n + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n + * IN PART OR IN WHOLE, \n + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * + * \file ConfirmTreatmentTableEntry.qml + * \date 2020/08/25 + * \author Peter Lucia + * + */ + +// Qt +import QtQuick 2.12 + +// Project + +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Rectangle { + id: _root + property var key: "Key" + property var value: "Value" + height: Variables.cTreatmentSubTblHeight + width: Variables.cTreatmentSubTblWidth + color: "transparent" + + Line { + id: _line + width: _root.width + Variables.cTreatmentTblMargin + thickness: 3 + color: Colors.backgroundMenu + anchors.top: _root.bottom + anchors.left: _root.left + anchors.leftMargin: -Variables.cTreatmentTblMargin + } + + Text { + id: _key + objectName: key + index + color: Colors.textMain + text: key + anchors.left: parent.left + anchors.verticalCenter: _root.verticalCenter + font.pixelSize: Fonts.crTreatmentTableFontSize + + } + + Text { + id: _value + objectName: value + index + color: Colors.textMain + text: value + anchors.left: _line.horizontalCenter + anchors.verticalCenter: _root.verticalCenter + anchors.leftMargin: 3*Variables.cTreatmentMargin + font.pixelSize: Fonts.crTreatmentTableFontSize + } + +} Index: ProgressLine.qml =================================================================== diff -u --- ProgressLine.qml (revision 0) +++ ProgressLine.qml (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,25 @@ +// Qt +import QtQuick 2.12 + +// Project +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Line { id: _root + length: 120 + color: Colors.createTreatmentInactive + radius: 5 + + states: [ + State { + name: "active" + PropertyChanges { target: _root; thickness: 3; color: Colors.createTreatmentActive; } + }, + State { + name: "inactive" + PropertyChanges { target: _root; thickness: 1; color: Colors.createTreatmentInactive; } + + } + ] +} Index: denali.pro =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- denali.pro (.../denali.pro) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ denali.pro (.../denali.pro) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -50,7 +50,11 @@ common/HDDefs.h \ common/MsgDefs.h \ \ # Main + sources/VTreatmentBegin.h \ sources/main.h \ + sources/model/MEndTreatmentResponse.h \ + sources/model/MStartTreatmentResponse.h \ + sources/model/hd/data/MPrimingData.h \ sources/model/mtreatmentparameters.h \ sources/model/mtreatmentparametersresp.h \ sources/storage/filesaver.h \ @@ -109,6 +113,7 @@ sources/gui/guiview.h \ sources/gui/guicontroller.h \ \ # ---------- Views ---------- + sources/view/VTreatmentCreate.h \ sources/view/dg/data/VDGDrainPumpData.h \ sources/view/dg/data/VDGHeatersData.h \ sources/view/dg/data/VDGLoadCellReadingsData.h \ @@ -118,11 +123,11 @@ sources/view/dg/data/VDGReservoirData.h \ sources/view/dg/data/VDGTemperaturesData.h \ sources/view/dg/data/VDGValvesStatesData.h \ - sources/view/VCreateTreatment.h \ \ sources/view/vview.h \ sources/view/vpoweroff.h \ sources/view/valarmstatus.h \ + sources/view/VPriming.h \ sources/view/VHDOperationModeData.h \ sources/view/vtreatmenttime.h \ sources/view/vtreatmentbloodflow.h \ @@ -153,6 +158,10 @@ \ # common \ # Main main.cpp \ + sources/VTreatmentBegin.cpp \ + sources/model/MEndTreatmentResponse.cpp \ + sources/model/MStartTreatmentResponse.cpp \ + sources/model/hd/data/MPrimingData.cpp \ sources/model/mtreatmentparameters.cpp \ sources/model/mtreatmentparametersresp.cpp \ sources/storage/filesaver.cpp \ @@ -207,8 +216,8 @@ sources/gui/guiglobals.cpp \ sources/gui/guiview.cpp \ sources/gui/guicontroller.cpp \ - sources/view/VCreateTreatment.cpp \ \ # ---------- Views ---------- + sources/view/VTreatmentCreate.cpp \ sources/view/dg/data/VDGDrainPumpData.cpp \ sources/view/dg/data/VDGHeatersData.cpp \ sources/view/dg/data/VDGLoadCellReadingsData.cpp \ @@ -220,6 +229,7 @@ sources/view/dg/data/VDGValvesStatesData.cpp \ \ sources/view/vpoweroff.cpp \ + sources/view/VPriming.cpp \ sources/view/valarmstatus.cpp \ sources/view/VHDOperationModeData.cpp \ sources/view/vtreatmenttime.cpp \ Index: denali.pro.user =================================================================== diff -u -ra19862d191c2501faa4e8cde64804ef18b80c6b3 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- denali.pro.user (.../denali.pro.user) (revision a19862d191c2501faa4e8cde64804ef18b80c6b3) +++ denali.pro.user (.../denali.pro.user) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -89,11 +89,11 @@ Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit - 1 + 0 0 0 - /home/denali/projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug true @@ -149,7 +149,7 @@ true - /home/denali/projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release true @@ -205,7 +205,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_threads + /home/denali/Projects/tmp/build/unittest/tst_threads true @@ -299,7 +299,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_messaging + /home/denali/Projects/tmp/build/unittest/tst_messaging true @@ -393,7 +393,7 @@ true - /home/denali/projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile true @@ -449,7 +449,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_canbus + /home/denali/Projects/tmp/build/unittest/tst_canbus true @@ -543,7 +543,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_logging + /home/denali/Projects/tmp/build/unittest/tst_logging true @@ -637,7 +637,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_utilities + /home/denali/Projects/tmp/build/unittest/tst_utilities true @@ -731,7 +731,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_acknow + /home/denali/Projects/tmp/build/unittest/tst_acknow true @@ -825,7 +825,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_models + /home/denali/Projects/tmp/build/unittest/tst_models true @@ -919,7 +919,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_initializations + /home/denali/Projects/tmp/build/unittest/tst_initializations true @@ -1013,7 +1013,7 @@ true - /home/denali/projects/tmp/build/unittest/tst_views + /home/denali/Projects/tmp/build/unittest/tst_views true @@ -1174,8 +1174,8 @@ 2 denali - denali2 - Qt4ProjectManager.Qt4RunConfiguration:/home/denali/projects/application/denali.pro + + Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Projects/application/denali.pro 3768 false @@ -1185,7 +1185,7 @@ false true - /home/denali/projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug 1 @@ -1196,11 +1196,11 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 0 + 1 0 0 - /home/denali/projects/tmp/build/denali-Qt_5_12_5_iMX8-Debug + /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Debug true @@ -1475,12 +1475,12 @@ 1 - denali (on Generic Linux Device (iMX8)) - RemoteLinuxRunConfiguration:/home/denali/projects/application/denali.pro + denali (on Generic Linux Device (iMX8))2 + RemoteLinuxRunConfiguration:/home/denali/Projects/application/denali.pro 1 false - + -u 3768 false true Index: denali.qrc =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- denali.qrc (.../denali.qrc) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ denali.qrc (.../denali.qrc) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -60,6 +60,8 @@ sources/gui/qml/components/ProgressCircle.qml sources/gui/qml/components/Slider.qml sources/gui/qml/components/SliderCreateTreatment.qml + sources/gui/qml/components/ConfirmTreatmentTable.qml + sources/gui/qml/components/ConfirmTreatmentSubTable.qml sources/gui/qml/components/SliderDoubleCreateTreatment.qml sources/gui/qml/components/RectSelectCreateTreatment.qml sources/gui/qml/components/TopMenuBarCreateTreatment.qml @@ -73,6 +75,9 @@ sources/gui/qml/components/ImageWave.qml sources/gui/qml/components/ImageClock.qml sources/gui/qml/components/ImageLogoDDarkTransparent.qml + sources/gui/qml/components/PrimingTimer.qml + ConfirmTreatmentTableEntry.qml + ProgressLine.qml qtquickcontrols2.conf Index: scripts/copy.sh =================================================================== diff -u -rfe1cc7af9637a8485b6948b50eb5fb06e4c83740 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- scripts/copy.sh (.../copy.sh) (revision fe1cc7af9637a8485b6948b50eb5fb06e4c83740) +++ scripts/copy.sh (.../copy.sh) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -1,3 +1,4 @@ +#!/bin/bash ########################################################################### # # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. @@ -13,7 +14,6 @@ # @date (original) 13-Mar-2020 # ############################################################################ -#!/bin/bash # device default Ip Address and denali application path if [ "$1" == "" ]; then Index: sources/VTreatmentBegin.cpp =================================================================== diff -u --- sources/VTreatmentBegin.cpp (revision 0) +++ sources/VTreatmentBegin.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,19 @@ +#include "VTreatmentBegin.h" + +using namespace View; + +VTreatmentBegin::VTreatmentBegin(QObject *parent) : QObject(parent) +{ + +} + + +/** + * \brief VTreatmentBegin::onUserModifiedParameters + * Manages enabling / disabling the start treatment button + */ +void VTreatmentBegin::onUserModifiedParameters() +{ + continueEnabled(true); + emit continueEnabledChanged(continueEnabled()); +} Index: sources/VTreatmentBegin.h =================================================================== diff -u --- sources/VTreatmentBegin.h (revision 0) +++ sources/VTreatmentBegin.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,31 @@ +#ifndef VTREATMENTSTART_H +#define VTREATMENTSTART_H + +// Qt +#include + +// Project +#include "main.h" + +namespace View { + +class VTreatmentBegin : public QObject +{ + Q_OBJECT + +public: + explicit VTreatmentBegin(QObject *parent = nullptr); + +protected: + // Def Min Max Res + TREATMENT_PARAMETER(float, ufVolume, 0.1, 0, 8.0, 0.1 ) // mL +protected: + PROPERTY(bool, continueEnabled, false) + +private slots: + void onUserModifiedParameters(); + +}; + +} +#endif // VTREATMENTSTART_H Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -281,8 +281,48 @@ onActionTransmit(GuiActionType::ID_AdjustUltrafiltrationConfirmReq, mData); } +/*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the StartTreatment request message. + * \param vData - Data model contains the start treatment request information. + * \return void + */ +void MessageDispatcher::onAdjustment(const StartTreatmentRequestData &vData) +{ + QVariantList mData; + mData += vData.request; + onActionTransmit(GuiActionType::ID_StartTreatmentReq, mData); +} /*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the Confirm Treatment request message. + * \param vData - Data model contains the confirm treatment request + * \return void + */ +void MessageDispatcher::onAdjustment(const ConfirmTreatmentRequestData &vData) +{ + Q_UNUSED(vData) + QVariantList mData; + onActionTransmit(GuiActionType::ID_ConfirmTreatmentReq, mData); +} + +/*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the End Treatment request message. + * \param vData - Data model contains the end treatment request + * \return void + */ +void MessageDispatcher::onAdjustment(const EndTreatmentRequestData &vData) +{ + Q_UNUSED(vData) + QVariantList mData; + onActionTransmit(GuiActionType::ID_EndTreatmentReq, mData); +} + + + +/*! * \brief MessageDispatcher::actionTransmit * \details This method is called by slot MessageDispatcher::onActionTransmit * which emits didFrameTransmit on successful interpretation of the requested message Index: sources/canbus/messageglobals.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -77,6 +77,12 @@ {Gui::GuiActionType::ID_AlarmSilenceRsp , 5 * 4 }, // 5 parameters each 4bytes // ---- + {Gui::GuiActionType::ID_StartTreatmentReq , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_StartTreatmentRsp , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_ConfirmTreatmentReq , 0 }, + {Gui::GuiActionType::ID_EndTreatmentReq , 0 }, + + // ---- {Gui::GuiActionType::ID_TreatmentRanges , 6 * 4 }, // 6 parameters each 4bytes {Gui::GuiActionType::ID_TreatmentStates , 3 * 4 }, // 3 parameters each 4bytes @@ -104,6 +110,9 @@ {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, // ---- + {Gui::GuiActionType::ID_PrimingData , 3 * 4 }, // 3 parameters each 4bytes + + // ---- {Gui::GuiActionType::ID_CANBusFaultCount , 1 }, {Gui::GuiActionType::ID_RawData , 255 }, {Gui::GuiActionType::ID_Acknow , 0 }, Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -ra19862d191c2501faa4e8cde64804ef18b80c6b3 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision a19862d191c2501faa4e8cde64804ef18b80c6b3) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -252,12 +252,29 @@ LOG_EVENT(AlarmSilenceRequestData::toString(vData)); } break; + case Gui::GuiActionType::ID_StartTreatmentReq: { + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(StartTreatmentRequestData::toString(vData)); + } break; + + case Gui::GuiActionType::ID_ConfirmTreatmentReq: { + if ( count != 0 ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(ConfirmTreatmentRequestData::toString(vData)); + } break; + + case Gui::GuiActionType::ID_EndTreatmentReq: { + if ( count != 0 ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(EndTreatmentRequestData::toString(vData)); + } break; + case Gui::GuiActionType::ID_CreateTreatmentReq: { if ( ! count ) { logInvalidLength(vActionId); return false; } vPayload = Format::fromVariant(vData); TreatmentParameters params; params.fromVariantList(vData); - LOG_EVENT("GOT HERE"); LOG_EVENT(params.toString()); } break; @@ -333,6 +350,7 @@ case Gui::GuiActionType::ID_TreatmentRanges : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentRanges ); break; case Gui::GuiActionType::ID_PressureOcclusion : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PressureOcclusion ); break; case Gui::GuiActionType::ID_TreatmentStates : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentStates ); break; + case Gui::GuiActionType::ID_PrimingData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PrimingData ); break; // ----- Events case Gui::GuiActionType::ID_HDOperationModeData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDOperationModeData ); break; @@ -353,6 +371,8 @@ case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp : ok = adjustUltrafiltrationConfirm (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_CreateTreatmentRsp : ok = createTreatmentRespData (vMessage, vData); break; + case Gui::GuiActionType::ID_StartTreatmentRsp : ok = notify (vMessage, vData, Gui::GuiActionType::ID_StartTreatmentRsp ); break; + case Gui::GuiActionType::ID_EndTreatmentRsp : ok = notify (vMessage, vData, Gui::GuiActionType::ID_EndTreatmentRsp ); break; // unhandles messages: these will only be logged as received message // there has nothing been defined for these messages. Index: sources/gui/guicontroller.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/guicontroller.h (.../guicontroller.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guicontroller.h (.../guicontroller.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -85,7 +85,6 @@ // ---- Signal/Slots ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_PUBLIC ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS + }; -}; - } Index: sources/gui/guiglobals.cpp =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -51,7 +51,9 @@ #include "vtreatmentadjustmentflows.h" #include "vtreatmentadjustmentultrafiltrationedit.h" #include "vtreatmentadjustmentultrafiltrationconfirm.h" -#include "VCreateTreatment.h" +#include "VTreatmentCreate.h" +#include "VPriming.h" +#include "VTreatmentBegin.h" namespace Gui { QQuickView *_viewer = nullptr; Index: sources/gui/guiglobals.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/guiglobals.h (.../guiglobals.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -71,9 +71,16 @@ ID_AlarmSilenceReq = 0x2F00, // 47 - Not implemented yet on FW side ID_AlarmSilenceRsp = 0x3000, // 48 - TODO: As per conversation with Sean this can be deleted. - ID_CreateTreatmentReq = 0x3500, // 53 - Not implemented yet on FW side - ID_CreateTreatmentRsp = 0x3600, // 54 - Not implemented yet on FW side + ID_CreateTreatmentReq = 0x3500, // 53 + ID_CreateTreatmentRsp = 0x3600, // 54 + ID_StartTreatmentReq = 0x3800, // 56 + ID_StartTreatmentRsp = 0x3900, // 57 + ID_ConfirmTreatmentReq = 0x3A00, // 58 + ID_EndTreatmentReq = 0x3B00, // 59 + ID_EndTreatmentRsp = 0x3C00, // 60 + ID_PrimingData = 0x3700, // 55 + ID_HDOperationModeData = 0x2500, // 37 ID_DGROPumpData = 0x1F00, // 31 Index: sources/gui/qml/components/ConfirmTreatmentSubTable.qml =================================================================== diff -u --- sources/gui/qml/components/ConfirmTreatmentSubTable.qml (revision 0) +++ sources/gui/qml/components/ConfirmTreatmentSubTable.qml (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,78 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright \n + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n + * IN PART OR IN WHOLE, \n + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * + * \file ConfirmTreatmentTable.qml + * \date 2020/08/25 + * \author Peter Lucia + * + */ + +// Qt +import QtQuick 2.12 +import QtQuick.Layouts 1.12 + +// Project + +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Rectangle { + id: _root + property var prescriptionKeys: [] + property var prescriptionValues: [] + property var operatingKeys: [] + property var operatingValues: [] + objectName: "ConfirmTreatmentSubTable" + color: "transparent" + + GridLayout { + id: _prescription_grid + anchors.top: parent.top + anchors.topMargin: Variables.sliderTextMargin + width: _root.width / 2 + rows: _root.prescriptionKeys.length + columns: 1 + + Repeater { + id: _prescription_repeater + model: prescriptionKeys + ConfirmTreatmentTableEntry { + key: prescriptionKeys[index] + value: prescriptionValues[index] + } + + + } + } + + + GridLayout { + id: _operating_grid + anchors.top: parent.top + anchors.topMargin: Variables.sliderTextMargin + anchors.left: _prescription_grid.right + rows: _root.prescriptionKeys.length + width: _root.width / 2 + columns: 1 + + Repeater { + id: _operating_repeater + model: operatingKeys + ConfirmTreatmentTableEntry { + key: operatingKeys[index] + value: operatingValues[index] + } + + + } + } + + + +} Index: sources/gui/qml/components/ConfirmTreatmentTable.qml =================================================================== diff -u --- sources/gui/qml/components/ConfirmTreatmentTable.qml (revision 0) +++ sources/gui/qml/components/ConfirmTreatmentTable.qml (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,114 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright \n + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n + * IN PART OR IN WHOLE, \n + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * + * \file ConfirmTreatmentTable.qml + * \date 2020/08/25 + * \author Peter Lucia + * + */ + +// Qt +import QtQuick 2.12 + +// Project + +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Rectangle { + id: _root + objectName: "ConfirmTreatmentTable" + width: Variables.cTreatmentTableWidth + height: Variables.cTreatmentTableHeight + color: Colors.backgroundDialog + + Rectangle { + id: _header + width: parent.width + height: Variables.cTreatmentHdrHeight + color: "transparent" + radius: 5 + + Rectangle { + id: _treatment_profile_id + objectName: _root.objectName + "_treatment_profile_id" + height: 40 + width: height + anchors.top: _header.top + anchors.left: _header.left + anchors.topMargin: Variables.cTreatmentMargin + anchors.leftMargin: Variables.cTreatmentMargin + color: Colors.createTrProfileID + radius: 5 + + Text { + id: _treatment_profile_id_text + objectName: _treatment_profile_id.objectName + "_treatment_profile_id_text" + color: Colors.backgroundDialog + text: "1" + font.pixelSize: Fonts.fontPixelTextRectTitle + anchors.centerIn: _treatment_profile_id + font.bold: true + } + } + + Text { + id: _treatment_profile_name + objectName: _root.objectName + "_treatment_profile_name" + anchors.bottom: _treatment_profile_id.bottom + anchors.left: _treatment_profile_id.right + anchors.topMargin: Variables.cTreatmentMargin + anchors.leftMargin: 20 + text: "New Treatment" + color: "white" + font.pixelSize: Fonts.crTreatmentFontSize + } + + } + + Text { + id: _prescription + objectName: _root.objectName + "_prescription" + text: "PRESCRIPTION" + font.pixelSize: Fonts.crTreatmentTableFontSize + color: "white" + anchors.left: parent.left + anchors.top: _header.bottom + anchors.leftMargin: Variables.cTreatmentMargin + + } + + Text { + id: _operating_parameters + objectName: _root.objectName + "_operating_parameters" + text: "OPERATING PARAMETERS" + font.pixelSize: Fonts.crTreatmentTableFontSize + color: "white" + anchors.top: _header.bottom + anchors.left: _root.horizontalCenter + + } + + ConfirmTreatmentSubTable { + id: _left_table + anchors.top: _prescription.bottom + anchors.left: _root.left + anchors.leftMargin: Variables.cTreatmentMargin + anchors.topMargin: Variables.cTreatmentTblMargin + anchors.bottom: parent.bottom + width: parent.width - 2*Variables.cTreatmentMargin + height: _root.height - _header.height + prescriptionKeys: vTreatmentCreate.getPrescriptionParameterNames() + prescriptionValues: vTreatmentCreate.getPrescriptionParameterValues() + operatingKeys: vTreatmentCreate.getOperatingParameterNames() + operatingValues: vTreatmentCreate.getOperatingParameterValues() + + } + +} Index: sources/gui/qml/components/PrimingTimer.qml =================================================================== diff -u --- sources/gui/qml/components/PrimingTimer.qml (revision 0) +++ sources/gui/qml/components/PrimingTimer.qml (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,63 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file TimeText.qml + * \author (last) Behrouz NematiPour + * \date (last) 01-May-2020 + * \author (original) Behrouz NematiPour + * \date (original) 04-Feb-2020 + * + */ + +// Qt +import QtQuick 2.12 + +// Project + +// Qml imports +import "qrc:/globals" + +/*! + * \brief Displays the minutes and seconds left during priming + */ +Rectangle { id: _root + objectName: "_TimeText" //SquishQt testability + property int seconds : 0 + property color textColor : "white" + property int textPixelSize : 26 + property int textWeight : Font.Normal + readonly property string time : _private.time + + color : "transparent" + + QtObject { id: _private + property int minute : Math.floor((seconds % 3600) / 60) + property int second : seconds % 60 + + property string separator : ":" + property string minuteText : (minute < 10 ? "0" + minute : minute) + property string secondText : (second < 10 ? "0" + second : second) + + property string time : minuteText + separator + secondText + } + + + + Text { id: _timeSeparator + objectName: "_primingTimeSeparator" //SquishQt testability + + text: _private.minuteText + _private.separator + _private.secondText + + font.pixelSize: _root.textPixelSize + font.weight: _root.textWeight + color: _root.textColor + anchors.centerIn: parent + + } + +} + Index: sources/gui/qml/components/ProgressCircle.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/ProgressCircle.qml (.../ProgressCircle.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/components/ProgressCircle.qml (.../ProgressCircle.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -24,9 +24,10 @@ * \brief Denali project Progress Circle */ Item { id: _root - property int minimum : 0 - property int maximum : 0 - property int value : minimum + property int minimum : 0 + property int maximum : 0 + property int value : minimum + property alias diameter : _circle.diameter width : _circle.width height : _circle.height Index: sources/gui/qml/components/RangeRect.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/RangeRect.qml (.../RangeRect.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/components/RangeRect.qml (.../RangeRect.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -81,6 +81,8 @@ anchors.topMargin : -touchMargin anchors.bottomMargin: -touchMargin anchors.fill: parent + anchors.leftMargin: -touchMargin + anchors.rightMargin: -touchMargin onPositionChanged: { _root.dragged(mouse) } Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -38,8 +38,9 @@ property alias diameter : _handler.diameter property alias knobColor : _handler.color - property bool isActive : false; + property bool isActive : false + signal progressRectClicked() signal progressRectDragged() signal activeChanged() @@ -110,8 +111,9 @@ var start = 0 if ( ! stepSnap ) start = minimum - value = Math.round((value - start) / step) * step + start + let decimals = Math.round(-Math.log10(step)) + if (decimals >= 0) value = value.toFixed(decimals) if ( value < minimum ) { value = minimum; return; } if ( value > maximum ) { value = maximum; return; } Index: sources/gui/qml/components/SliderDoubleCreateTreatment.qml =================================================================== diff -u -rfe1cc7af9637a8485b6948b50eb5fb06e4c83740 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/SliderDoubleCreateTreatment.qml (.../SliderDoubleCreateTreatment.qml) (revision fe1cc7af9637a8485b6948b50eb5fb06e4c83740) +++ sources/gui/qml/components/SliderDoubleCreateTreatment.qml (.../SliderDoubleCreateTreatment.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -125,10 +125,10 @@ } } - onProgressRectClicked: setActive(true) - onProgressRectDragged: setActive(true) - onDragged: setActive(true) - onClicked: setActive(true) + onProgressRectClicked: { setActive(true); setLowValid(true); } + onProgressRectDragged: { setActive(true); setLowValid(true); } + onDragged: { setActive(true); setLowValid(true); } + onClicked: { setActive(true); setLowValid(true); } } Text { Index: sources/gui/qml/components/StackItem.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -33,10 +33,15 @@ function pop () { _stackView.pop() } + function push (vScreen) { _stackView.push(vScreen) } + function popToItem(item) { + _stackView.pop(item); + } + StackView { id : _stackView initialItem : null anchors.fill: parent Index: sources/gui/qml/components/TopMenuBarCreateTreatment.qml =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/components/TopMenuBarCreateTreatment.qml (.../TopMenuBarCreateTreatment.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/gui/qml/components/TopMenuBarCreateTreatment.qml (.../TopMenuBarCreateTreatment.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -49,39 +49,36 @@ } - RowLayout { + Row { anchors.centerIn: parent - Layout.alignment: Qt.AlignVCenter spacing: 5 CircleWithText { id: _create text: "CREATE" state: "active" } - Line { - length: 100 - color: Colors.createTreatmentInactive + ProgressLine { id: _confirm_line + anchors.verticalCenter: _create.verticalCenter + } CircleWithText { id: _confirm text: "CONFIRM" } - Line { - length: 100 - color: Colors.createTreatmentInactive + ProgressLine { id: _priming_line + anchors.verticalCenter: _create.verticalCenter } CircleWithText { id: _prime text: "PRIME" } - Line { - id: _prime_line - length: 100 - color: Colors.createTreatmentInactive + ProgressLine { id: _begin_line + anchors.verticalCenter: _create.verticalCenter + } CircleWithText { id: _begin @@ -95,31 +92,43 @@ states: [ State { name: "create" - PropertyChanges { target: _create; state: "active" } - PropertyChanges { target: _confirm; state: "inactive" } - PropertyChanges { target: _prime; state: "inactive" } - PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _create; state: "active" } + PropertyChanges { target: _confirm; state: "inactive" } + PropertyChanges { target: _confirm_line; state: "inactive" } + PropertyChanges { target: _prime; state: "inactive" } + PropertyChanges { target: _priming_line; state: "inactive" } + PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _begin_line; state: "inactive" } }, State { name: "confirm" - PropertyChanges { target: _create; state: "inactive" } - PropertyChanges { target: _confirm; state: "active" } - PropertyChanges { target: _prime; state: "inactive" } - PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _create; state: "active" } + PropertyChanges { target: _confirm; state: "active" } + PropertyChanges { target: _confirm_line; state: "active" } + PropertyChanges { target: _prime; state: "inactive" } + PropertyChanges { target: _priming_line; state: "inactive" } + PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _begin_line; state: "inactive" } }, State { name: "prime" - PropertyChanges { target: _create; state: "inactive" } - PropertyChanges { target: _confirm; state: "inactive" } - PropertyChanges { target: _prime; state: "active" } - PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _create; state: "active" } + PropertyChanges { target: _confirm; state: "active" } + PropertyChanges { target: _confirm_line; state: "active" } + PropertyChanges { target: _prime; state: "active" } + PropertyChanges { target: _priming_line; state: "active" } + PropertyChanges { target: _begin; state: "inactive" } + PropertyChanges { target: _begin_line; state: "inactive" } }, State { name: "begin" - PropertyChanges { target: _create; state: "inactive" } - PropertyChanges { target: _confirm; state: "inactive" } - PropertyChanges { target: _prime; state: "inactive" } - PropertyChanges { target: _begin; state: "active" } + PropertyChanges { target: _create; state: "active" } + PropertyChanges { target: _confirm; state: "active" } + PropertyChanges { target: _confirm_line; state: "active" } + PropertyChanges { target: _prime; state: "active" } + PropertyChanges { target: _priming_line; state: "active" } + PropertyChanges { target: _begin; state: "active" } + PropertyChanges { target: _begin_line; state: "active" } } ] Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -r2d09ae36f6b791e0415a87b6f14f582d4b434d7d -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 2d09ae36f6b791e0415a87b6f14f582d4b434d7d) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -100,6 +100,10 @@ readonly property color createTrTextNotReady : "#507090" readonly property color createTrTextReady : "white" readonly property color createTrInvalidParam : "red" + readonly property color createTrProfileID : "#ffbb44" + readonly property color primingNotReady : "#1f4974" + readonly property color primingReady : "#438FEB" + } Index: sources/gui/qml/globals/Fonts.qml =================================================================== diff -u -rc8eb6d0e29f8951a793b2f52d11a08b9902470ee -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision c8eb6d0e29f8951a793b2f52d11a08b9902470ee) +++ sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -66,5 +66,8 @@ readonly property int fontPixelUltrafiltrationAdjustmentConfirmTitle : 40 readonly property int fontPixelUltrafiltrationAdjustmentEditValue : 46 + readonly property int crTreatmentFontSize : 30 + readonly property int crTreatmentTableFontSize : 24 + } Index: sources/gui/qml/globals/Variables.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -78,6 +78,14 @@ readonly property int sliderTextMargin : 20 readonly property int cTreatmentSpacing : 60 + readonly property int cTreatmentTableHeight : 800 + readonly property int cTreatmentTableWidth : applicationWidth - 50 + readonly property int cTreatmentMargin : 45 + readonly property int cTreatmentHdrHeight : 130 + readonly property int cTreatmentTblMargin : 20 + readonly property int cTreatmentSubTblHeight: 50 + readonly property int cTreatmentSubTblWidth : 500 + readonly property int notificationHeight : 50 readonly property int notificationIconSize : 36 Index: sources/gui/qml/main.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/main.qml (.../main.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/main.qml (.../main.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -38,7 +38,7 @@ import VTreatmentAdjustmentUltrafiltrationEdit 0.1; import VTreatmentAdjustmentUltrafiltrationConfirm 0.1; -import VCreateTreatment 0.1; +import VTreatmentCreate 0.1; import VDGDrainPump 0.1; import VDGHeaters 0.1; import VDGLoadCellReadings 0.1; @@ -48,6 +48,8 @@ import VDGReservoir 0.1; import VDGTemperatures 0.1; import VDGValvesStates 0.1; +import VPriming 0.1; +import VTreatmentBegin 0.1; // Qml imports import "qrc:/globals" @@ -127,7 +129,9 @@ VTreatmentAdjustmentUltrafiltrationState { id: vTreatmentAdjustmentUltrafiltrationState } VTreatmentAdjustmentUltrafiltrationEdit { id: vTreatmentAdjustmentUltrafiltrationEdit } VTreatmentAdjustmentUltrafiltrationConfirm { id: vTreatmentAdjustmentUltrafiltrationConfirm } - VCreateTreatment { id: vCreateTreatment } + VTreatmentCreate { id: vTreatmentCreate } + VPriming { id: vPriming } + VTreatmentBegin { id: vTreatmentBegin } // ----- Follow the below Z order ----- // 1 - Screens Index: sources/gui/qml/pages/treatment/TreatmentBegin.qml =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/pages/treatment/TreatmentBegin.qml (.../TreatmentBegin.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/gui/qml/pages/treatment/TreatmentBegin.qml (.../TreatmentBegin.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -68,6 +68,21 @@ font.pixelSize: Fonts.fontPixelTitle } + SliderCreateTreatment { + id: _ultrafiltration + objectName: "_ultrafiltration" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: "Ultrafiltration Volume" + units: qsTr(" mL") + min: vTreatmentBegin.ufVolumeMin + max: vTreatmentBegin.ufVolumeMax + step: vTreatmentBegin.ufVolumeRes + onSliderChanged: { + vTreatmentBegin.ufVolume = value; + } + } + TouchRect { id : _continueRect anchors.horizontalCenter: parent.horizontalCenter text.text: qsTr("START") Index: sources/gui/qml/pages/treatment/TreatmentConfirm.qml =================================================================== diff -u -r542278273f3d13ad5fb5ba8916178d747c78fe77 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/pages/treatment/TreatmentConfirm.qml (.../TreatmentConfirm.qml) (revision 542278273f3d13ad5fb5ba8916178d747c78fe77) +++ sources/gui/qml/pages/treatment/TreatmentConfirm.qml (.../TreatmentConfirm.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -67,7 +67,12 @@ color: Colors.textMain font.pixelSize: Fonts.fontPixelTitle } + // insert the treatment information table here + ConfirmTreatmentTable { + anchors.horizontalCenter: parent.horizontalCenter + } + TouchRect { id : _continueRect objectName: "_continueRect" anchors.horizontalCenter: parent.horizontalCenter @@ -76,6 +81,13 @@ _root.clickedConfirm() } } + + Rectangle { + id: _spacer + height: 75 + width: parent.width + color: "transparent" + } } } Index: sources/gui/qml/pages/treatment/TreatmentCreate.qml =================================================================== diff -u -rfe1cc7af9637a8485b6948b50eb5fb06e4c83740 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision fe1cc7af9637a8485b6948b50eb5fb06e4c83740) +++ sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -39,7 +39,6 @@ width: parent.width onClickedBack: { _root.clickedBack(); - } } @@ -83,10 +82,11 @@ selectedValueObjectName: objectName + "Value" text: "Blood Flow Rate" units: qsTr(" mL/min") - min: vCreateTreatment.bloodFlowRateMin - max: vCreateTreatment.bloodFlowRateMax + min: vTreatmentCreate.bloodFlowRateMin + max: vTreatmentCreate.bloodFlowRateMax + step: vTreatmentCreate.bloodFlowRateRes onSliderChanged: { - vCreateTreatment.bloodFlowRate = value; + vTreatmentCreate.bloodFlowRate = value; } } @@ -97,10 +97,11 @@ selectedValueObjectName: objectName + "Value" text: "Dialysate Flow Rate" units: qsTr(" mL/min") - min: vCreateTreatment.dialysateFlowRateMin - max: vCreateTreatment.dialysateFlowRateMax + min: vTreatmentCreate.dialysateFlowRateMin + max: vTreatmentCreate.dialysateFlowRateMax + step: vTreatmentCreate.dialysateFlowRateRes onSliderChanged: { - vCreateTreatment.dialysateFlowRate = value; + vTreatmentCreate.dialysateFlowRate = value; } } @@ -111,10 +112,11 @@ selectedValueObjectName: objectName + "Value" text: "Duration" units: qsTr(" min") - min: vCreateTreatment.durationMin - max: vCreateTreatment.durationMax + min: vTreatmentCreate.durationMin + max: vTreatmentCreate.durationMax + step: vTreatmentCreate.durationRes onSliderChanged: { - vCreateTreatment.duration = value; + vTreatmentCreate.duration = value; } } @@ -125,10 +127,12 @@ selectedValueObjectName: objectName + "Value" text: "Heparin Dispensing Rate" units: qsTr(" mL/hr") - min: vCreateTreatment.heparinDispensingRateMin - max: vCreateTreatment.heparinDispensingRateMax + min: vTreatmentCreate.heparinDispensingRateMin + max: vTreatmentCreate.heparinDispensingRateMax + step: vTreatmentCreate.heparinDispensingRateRes + onSliderChanged: { - vCreateTreatment.heparinDispensingRate = value; + vTreatmentCreate.heparinDispensingRate = value; } } @@ -139,10 +143,11 @@ selectedValueObjectName: objectName + "Value" text: "Heparin Bolus Volume" units: qsTr(" mL") - min: vCreateTreatment.heparinBolusVolumeMin - max: vCreateTreatment.heparinBolusVolumeMax + min: vTreatmentCreate.heparinBolusVolumeMin + max: vTreatmentCreate.heparinBolusVolumeMax + step: vTreatmentCreate.heparinBolusVolumeRes onSliderChanged: { - vCreateTreatment.heparinBolusVolume = value; + vTreatmentCreate.heparinBolusVolume = value; } } @@ -153,30 +158,34 @@ selectedValueObjectName: objectName + "Value" text: "Heparin Stop Time" units: qsTr(" min") - min: vCreateTreatment.heparinStopTimeMin - max: vCreateTreatment.heparinStopTimeMax + min: vTreatmentCreate.heparinStopTimeMin + max: vTreatmentCreate.heparinStopTimeMax + step: vTreatmentCreate.heparinStopTimeRes onSliderChanged: { - vCreateTreatment.heparinStopTime = value; + vTreatmentCreate.heparinStopTime = value; } } - RectSelectCreateTreatment { + SliderCreateTreatment { id: _salineBolus objectName: "_salineBolusRect" - name: "Saline Bolus" - buttonNames: vCreateTreatment.salineBolusOptions - onButtonClicked: { - vCreateTreatment.salineBolusVolume = selectedIndex; + text: "Saline Bolus" + units: qsTr(" min") + min: vTreatmentCreate.salineBolusVolumeMin + max: vTreatmentCreate.salineBolusVolumeMax + step: vTreatmentCreate.salineBolusVolumeRes + onSliderChanged: { + vTreatmentCreate.salineBolusVolume = value; } } RectSelectCreateTreatment { id: _acidConcentrate objectName: "_acidConcentrateRect" name: "Acid Concentrate" - buttonNames: vCreateTreatment.acidConcentrateOptions; + buttonNames: vTreatmentCreate.acidConcentrateOptions; onButtonClicked: { - vCreateTreatment.acidConcentrate = selectedIndex; + vTreatmentCreate.acidConcentrate = selectedIndex; } } @@ -186,9 +195,9 @@ name: "Bicarbonate Concentrate" numRows: 1 numCols: 2 - buttonNames: vCreateTreatment.bicarbonateConcentrateOptions; + buttonNames: vTreatmentCreate.bicarbonateConcentrateOptions; onButtonClicked: { - vCreateTreatment.bicarbonateConcentrate = selectedIndex; + vTreatmentCreate.bicarbonateConcentrate = selectedIndex; } } @@ -198,9 +207,9 @@ name: "Dialyzer Type" numRows: 3 numCols: 2 - buttonNames: vCreateTreatment.dialyzerTypeOptions; + buttonNames: vTreatmentCreate.dialyzerTypeOptions; onButtonClicked: { - vCreateTreatment.dialyzerType = selectedIndex; + vTreatmentCreate.dialyzerType = selectedIndex; } } @@ -211,11 +220,11 @@ selectedValueObjectName: objectName + "Value" text: "Dialysate Temperature" units: qsTr(" C") - step: 0.1 - min: vCreateTreatment.dialysateTempMin - max: vCreateTreatment.dialysateTempMax + min: vTreatmentCreate.dialysateTempMin + max: vTreatmentCreate.dialysateTempMax + step: vTreatmentCreate.dialysateTempRes onSliderChanged: { - vCreateTreatment.dialysateTemp = value; + vTreatmentCreate.dialysateTemp = value; } } @@ -239,17 +248,19 @@ lowUnits: " mmHg" highTitle: "High" highUnits: " mmHg" - lowMin: vCreateTreatment.arterialPressureLimitLowMin - lowMax: vCreateTreatment.arterialPressureLimitLowMax - highMin: vCreateTreatment.arterialPressureLimitHighMin - highMax: vCreateTreatment.arterialPressureLimitHighMax - lowValue: vCreateTreatment.arterialPressureLimitLowMin - highValue: vCreateTreatment.arterialPressureLimitHighMin + lowMin: vTreatmentCreate.arterialPressureLimitLowMin + lowMax: vTreatmentCreate.arterialPressureLimitLowMax + highMin: vTreatmentCreate.arterialPressureLimitHighMin + highMax: vTreatmentCreate.arterialPressureLimitHighMax + lowValue: vTreatmentCreate.arterialPressureLimitLowMin + highValue: vTreatmentCreate.arterialPressureLimitHighMin + lowStep: vTreatmentCreate.arterialPressureLimitLowRes + highStep: vTreatmentCreate.arterialPressureLimitHighRes onLowSliderChanged: { - vCreateTreatment.arterialPressureLimitLow = lowValue + vTreatmentCreate.arterialPressureLimitLow = lowValue } onHighSliderChanged: { - vCreateTreatment.arterialPressureLimitHigh = highValue + vTreatmentCreate.arterialPressureLimitHigh = highValue } } @@ -274,17 +285,19 @@ lowUnits: " mmHg" highTitle: "High" highUnits: " mmHg" - lowMin: vCreateTreatment.venousPressureLimitLowMin - lowMax: vCreateTreatment.venousPressureLimitLowMax - highMin: vCreateTreatment.venousPressureLimitHighMin - highMax: vCreateTreatment.venousPressureLimitHighMax - lowValue: vCreateTreatment.venousPressureLimitLowMin - highValue: vCreateTreatment.venousPressureLimitHighMin + lowMin: vTreatmentCreate.venousPressureLimitLowMin + lowMax: vTreatmentCreate.venousPressureLimitLowMax + highMin: vTreatmentCreate.venousPressureLimitHighMin + highMax: vTreatmentCreate.venousPressureLimitHighMax + lowValue: vTreatmentCreate.venousPressureLimitLowMin + highValue: vTreatmentCreate.venousPressureLimitHighMin + lowStep: vTreatmentCreate.venousPressureLimitLowRes + highStep: vTreatmentCreate.venousPressureLimitHighRes onLowSliderChanged: { - vCreateTreatment.venousPressureLimitLow = lowValue + vTreatmentCreate.venousPressureLimitLow = lowValue } onHighSliderChanged: { - vCreateTreatment.venousPressureLimitHigh = highValue + vTreatmentCreate.venousPressureLimitHigh = highValue } } @@ -295,12 +308,12 @@ selectedValueObjectName: objectName + "Value" text: "Blood Pressure Measurement Interval" units: qsTr(" min") - min: vCreateTreatment.bloodPressureMeasureIntervalMin - max: vCreateTreatment.bloodPressureMeasureIntervalMax - step: 1 + min: vTreatmentCreate.bloodPressureMeasureIntervalMin + max: vTreatmentCreate.bloodPressureMeasureIntervalMax + step: vTreatmentCreate.bloodPressureMeasureIntervalRes stepSnap: true onSliderChanged: { - vCreateTreatment.bloodPressureMeasureInterval = value + vTreatmentCreate.bloodPressureMeasureInterval = value } } @@ -311,12 +324,12 @@ selectedValueObjectName: objectName + "Value" text: "Rinseback Flow Rate" units: qsTr(" mL/min") - min: vCreateTreatment.rinsebackFlowRateMin - max: vCreateTreatment.rinsebackFlowRateMax - step: 1 + min: vTreatmentCreate.rinsebackFlowRateMin + max: vTreatmentCreate.rinsebackFlowRateMax + step: vTreatmentCreate.rinsebackFlowRateRes stepSnap: true onSliderChanged: { - vCreateTreatment.rinsebackFlowRate = value + vTreatmentCreate.rinsebackFlowRate = value } } @@ -328,8 +341,8 @@ borderColor: Colors.createTreatmentNotReady textColor: Colors.createTrTextNotReady button.onClicked: { - vCreateTreatment.saveTreatmentProfile = false; - if (vCreateTreatment.continueEnabled) { + vTreatmentCreate.saveTreatmentProfile = false; + if (vTreatmentCreate.continueEnabled) { _root.clickedContinue() } } @@ -346,6 +359,13 @@ } } } + + Rectangle { + id: _spacer + height: 75 + width: parent.width + color: "transparent" + } } } @@ -386,9 +406,9 @@ } } - Connections { target: vCreateTreatment + Connections { target: vTreatmentCreate onContinueEnabledChanged: { - if (vCreateTreatment.continueEnabled) { + if (vTreatmentCreate.continueEnabled) { _continueRect.toggleEnabled(true) } else { _continueRect.toggleEnabled(false) @@ -406,7 +426,7 @@ _heparinBolusVolume.isActive = false; _heparinStopTime.isActive = false; - _salineBolus.setActive(false); + _salineBolus.isActive = false; _acidConcentrate.setActive(false); _bicarbonateConcentrate.setActive(false); _dialyzerType.setActive(false); @@ -514,9 +534,62 @@ _rinsebackFlowRate.setValid(false) } + onScrollToParameter: { + let prefix = "data."; + let contentYMargin = 80; + let newContentY = 0; + if (parameter === prefix+"bloodFlowRate") { + newContentY = _bloodFlowRate.mapToItem(_bloodFlowRate.parent, 0, 0).y; + } + else if (parameter === prefix+"dialysateFlowRate") { + newContentY = _dialysateFlowRate.mapToItem(_dialysateFlowRate.parent, 0, 0).y; + } + else if (parameter === prefix+"duration") { + newContentY = _duration.mapToItem(_duration.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinDispensingRate") { + newContentY = _heparinDispensingRate.mapToItem(_heparinDispensingRate.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinBolusVolume") { + newContentY = _heparinBolusVolume.mapToItem(_heparinBolusVolume.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinStopTime") { + newContentY = _heparinStopTime.mapToItem(_heparinStopTime.parent, 0, 0).y; + } + else if (parameter === prefix+"salineBolus") { + newContentY = _salineBolus.mapToItem(_salineBolus.parent, 0, 0).y; + } + else if (parameter === prefix+"acidConcentrate") { + newContentY = _acidConcentrate.mapToItem(_acidConcentrate.parent, 0, 0).y; + } + else if (parameter === prefix+"bicarbonateConcentrate") { + newContentY = _bicarbonateConcentrate.mapToItem(_bicarbonateConcentrate.parent, 0, 0).y; + } + else if (parameter === prefix+"dialyzerType") { + newContentY = _dialyzerType.mapToItem(_dialyzerType.parent, 0, 0).y; + } + else if (parameter === prefix+"dialysateTemp") { + newContentY = _dialysateTemperature.mapToItem(_dialysateTemperature.parent, 0, 0).y; + } + else if (parameter === prefix+"arterialPressureLimitLow" || + parameter === prefix+"arterialPressureLimitHigh") { + newContentY = _arterialPressureLimits.mapToItem(_arterialPressureLimits.parent, 0, 0).y; + } + else if (parameter === prefix+"venousPressureLimitLow" || + parameter === prefix+"venousPressureLimitHigh") { + newContentY = _venousPressureLimits.mapToItem(_venousPressureLimits.parent, 0, 0).y; + } + else if (parameter === prefix+"bloodPressureMeasureInterval") { + newContentY = _bloodPressureMeasurementInterval.mapToItem(_bloodPressureMeasurementInterval.parent, 0, 0).y; + } + else if (parameter === prefix+"rinsebackFlowRate") { + newContentY = _rinsebackFlowRate.mapToItem(_rinsebackFlowRate.parent, 0, 0).y; + } + else { + return; + } + _flickable.contentY = newContentY - contentYMargin; + } } - - - } Index: sources/gui/qml/pages/treatment/TreatmentPrime.qml =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/pages/treatment/TreatmentPrime.qml (.../TreatmentPrime.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/gui/qml/pages/treatment/TreatmentPrime.qml (.../TreatmentPrime.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -58,19 +58,68 @@ Column { id: _column spacing: Variables.cTreatmentSpacing - anchors.horizontalCenter: parent.horizontalCenter; - anchors.fill: parent; + anchors.horizontalCenter: parent.horizontalCenter + anchors.fill: parent Text { id: _titleText - anchors.horizontalCenter: parent.horizontalCenter; + anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Priming") color: Colors.textMain font.pixelSize: Fonts.fontPixelTitle } + ProgressCircle { id: _circle + anchors.horizontalCenter: parent.horizontalCenter + minimum: 0 + maximum: vPriming.secondsTotal + diameter: 100 + + value: vPriming.secondsTotal - vPriming.secondsRemaining + + PrimingTimer { id: _timeText + anchors.centerIn: parent + seconds : vPriming.secondsRemaining + + } + } + + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + color: "transparent" + height: 400 + + + } + + GridLayout { + id: _grid + rows: vPriming.primingStates.length + columns: 1 + anchors.horizontalCenter: parent.horizontalCenter + + Repeater { + model: vPriming.primingStates + Text { + color: "white" + text: vPriming.primingStates[index]; + } + } + } + TouchRect { id : _continueRect anchors.horizontalCenter: parent.horizontalCenter - text.text: qsTr("CONTINUE TO TREATMENT") + text.text: vPriming.continueBtnText + enabled: vPriming.continueEnabled + onEnabledChanged: { + if (enabled) { + borderColor = Colors.primingReady + textColor = Colors.primingReady + } else { + borderColor = Colors.primingNotReady + textColor = Colors.primingNotReady + } + } + button.onClicked: { _root.clickedContinue() } Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -50,7 +50,7 @@ TreatmentHome { id: _treatmentHome onTreatmentStarted : push( _treatmentStart ) - onTreatmentCreated : push( _treatmentCreate) + onTreatmentCreated : vTreatmentCreate.onSelectingParameters() } TreatmentStart { id: _treatmentStart @@ -72,23 +72,23 @@ } TreatmentCreate { id: _treatmentCreate - onClickedBack : pop() - onClickedContinue : {vCreateTreatment.onFinishedCreate(); } + onClickedBack : {vTreatmentCreate.onCancelSelectingParameters() } + onClickedContinue : {vTreatmentCreate.onFinishedCreate(); } } TreatmentConfirm { id: _treatmentConfirm - onClickedBack : pop() - onClickedConfirm : {vCreateTreatment.onFinishedConfirm(); } + onClickedBack : {vTreatmentCreate.onRequestPop() } + onClickedConfirm : {vTreatmentCreate.onFinishedConfirm(); } } TreatmentPrime { id: _treatmentPrime - onClickedBack : pop() - onClickedContinue : {vCreateTreatment.onFinishedPrime(); } + onClickedBack : {vTreatmentCreate.onRequestPop() } + onClickedContinue : {vTreatmentCreate.onFinishedPrime(); } } TreatmentBegin { id: _treatmentBegin - onClickedBack : pop() - onClickedStart : {vCreateTreatment.onStart(); } + onClickedBack : {vTreatmentCreate.onRequestPop() } + onClickedStart : {vTreatmentCreate.onStartTreatment(); } } @@ -218,10 +218,16 @@ } - Connections { target: vCreateTreatment - onShowConfirm : { push(_treatmentConfirm) } - onShowPrime : { push(_treatmentPrime) } - onShowBegin : { push(_treatmentBegin) } + Connections { target: vTreatmentCreate + onShowCreate : { push(_treatmentCreate) } + onShowConfirm : { push(_treatmentConfirm) } + onShowPrime : { push(_treatmentPrime) } + onShowBegin : { push(_treatmentBegin) } + onPop : { pop() } + onShowTreatmentStart : { + popToItem(_treatmentHome) + push(_treatmentStart) + } } Index: sources/main.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/main.h (.../main.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/main.h (.../main.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -168,35 +168,62 @@ #define REGISTER_TYPE(vTYPE) \ qmlRegisterType < vTYPE > (#vTYPE, 0, 1, #vTYPE); #define GET_VARIABLE_NAME(VARIABLE) (#VARIABLE) -#define TREATMENT_PARAMETER(TYPE, NAME, DEFVALUE) \ -private: \ - TYPE _##NAME = DEFVALUE; \ - bool is##NAME##Set = false; \ -protected: \ - Q_PROPERTY(TYPE NAME \ - READ get_##NAME \ - WRITE set_##NAME \ - NOTIFY NAME##Changed) \ - void set_##NAME(const TYPE &p##NAME) { \ - static bool init = false; \ - if ( !init || _##NAME != p##NAME ) { \ - init = true; \ - _##NAME = p##NAME; \ - DEBUG_PROPERTY_CHANGED(NAME, _) \ - is##NAME##Set = true; \ - emit NAME##Changed(_##NAME); \ - onUserModifiedParameters(); \ - } \ - } \ - TYPE get_##NAME() const { \ - return _##NAME; \ - } \ - void reset_##NAME() { \ - _##NAME = DEFVALUE; \ - is##NAME##Set = false; \ - emit NAME##Changed(_##NAME); \ - } \ -Q_SIGNALS: \ - void NAME##Changed(const TYPE &p##NAME); \ +#define TREATMENT_PARAMETER(TYPE, NAME, DEFVALUE, MIN, MAX, RES) \ +private: \ + TYPE _##NAME = DEFVALUE; \ + TYPE _##NAME##Min = MIN; \ + TYPE _##NAME##Max = MAX; \ + TYPE _##NAME##Res = RES; \ + bool is##NAME##Set = false; \ +protected: \ + Q_PROPERTY(TYPE NAME \ + READ get_##NAME \ + WRITE set_##NAME \ + NOTIFY NAME##Changed) \ + Q_PROPERTY(TYPE NAME##Min \ + READ NAME##Min \ + WRITE NAME##Min \ + NOTIFY NAME##MinChanged) \ + Q_PROPERTY(TYPE NAME##Max \ + READ NAME##Max \ + WRITE NAME##Max \ + NOTIFY NAME##MaxChanged) \ + Q_PROPERTY(TYPE NAME##Res \ + READ NAME##Res \ + WRITE NAME##Res \ + NOTIFY NAME##ResChanged) \ + void set_##NAME(const TYPE &p##NAME) { \ + static bool init = false; \ + if ( !init || _##NAME != p##NAME ) { \ + init = true; \ + _##NAME = p##NAME; \ + DEBUG_PROPERTY_CHANGED(NAME, _) \ + is##NAME##Set = true; \ + emit NAME##Changed(_##NAME); \ + onUserModifiedParameters(); \ + } \ + } \ + TYPE NAME##Min() const { return _##NAME##Min; } \ + void NAME##Min(const TYPE &p##NAME##Min) \ + { _##NAME##Min = p##NAME##Min; emit NAME##MinChanged(_##NAME##Min);} \ + TYPE NAME##Max() const { return _##NAME##Max; } \ + void NAME##Max(const TYPE &p##NAME##Max) \ + { _##NAME##Max = p##NAME##Max; emit NAME##MaxChanged(_##NAME##Max);} \ + TYPE NAME##Res() const { return _##NAME##Res; } \ + void NAME##Res(const TYPE &p##NAME##Res) \ + { _##NAME##Res = p##NAME##Res; emit NAME##ResChanged(_##NAME##Res);} \ + TYPE get_##NAME() const { \ + return _##NAME; \ + } \ + void reset_##NAME() { \ + _##NAME = DEFVALUE; \ + is##NAME##Set = false; \ + emit NAME##Changed(_##NAME); \ + } \ +Q_SIGNALS: \ + void NAME##Changed(const TYPE &p##NAME); \ + void NAME##MinChanged(const TYPE &p##NAME); \ + void NAME##MaxChanged(const TYPE &p##NAME); \ + void NAME##ResChanged(const TYPE &p##NAME); \ void NAME##_ValidationFailed(const QString &reason); Index: sources/model/MEndTreatmentResponse.cpp =================================================================== diff -u --- sources/model/MEndTreatmentResponse.cpp (revision 0) +++ sources/model/MEndTreatmentResponse.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,23 @@ +#include "MEndTreatmentResponse.h" + +using namespace Model; + +QVariantList MEndTreatmentResponse::parameters() const { + return { + _data.endTreatmentResponse.value, + }; +} + +bool MEndTreatmentResponse::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if (GetValue(vByteArray, index, _data.endTreatmentResponse )) + return true; + else { if(vIndex) *vIndex = index; return false; } + +} + +MEndTreatmentResponse::Data MEndTreatmentResponse::data() const { + Data data; + data.endTreatmentResponse = _data.endTreatmentResponse.value; + return data; +} Index: sources/model/MEndTreatmentResponse.h =================================================================== diff -u --- sources/model/MEndTreatmentResponse.h (revision 0) +++ sources/model/MEndTreatmentResponse.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,51 @@ +#ifndef MENDTREATMENTRESPONSE_H +#define MENDTREATMENTRESPONSE_H + +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +class MEndTreatmentResponse : public MAbstract { + + // friends + friend class ::tst_models; + + QVariantList parameters() const override; + + struct { + Types::U32 endTreatmentResponse; + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eEvent ; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("EndTreatmentResponse"); } + + struct Data { + quint32 endTreatmentResponse = 0; + }; + + MEndTreatmentResponse () {} + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; + +} + +typedef Model::MEndTreatmentResponse::Data EndTreatmentResponseData; + + + +#endif // MENDTREATMENTRESPONSE_H Index: sources/model/MModel.h =================================================================== diff -u -ra19862d191c2501faa4e8cde64804ef18b80c6b3 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/model/MModel.h (.../MModel.h) (revision a19862d191c2501faa4e8cde64804ef18b80c6b3) +++ sources/model/MModel.h (.../MModel.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -51,6 +51,9 @@ #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" +#include "MPrimingData.h" +#include "MStartTreatmentResponse.h" +#include "MEndTreatmentResponse.h" /*! * \brief Message interpretation instruction @@ -144,6 +147,9 @@ \ REGISTER_METATYPE( HDDebugTextData ) \ REGISTER_METATYPE( DGDebugTextData ) \ + REGISTER_METATYPE( StartTreatmentRequestData ) \ + REGISTER_METATYPE( ConfirmTreatmentRequestData ) \ + REGISTER_METATYPE( EndTreatmentRequestData ) \ \ REGISTER_METATYPE( AdjustBloodDialysateRequestData ) \ REGISTER_METATYPE( AdjustDurationRequestData ) \ @@ -156,7 +162,10 @@ REGISTER_METATYPE( AdjustUltrafiltrationStateResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationEditResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationConfirmResponseData ) \ - REGISTER_METATYPE( TreatmentData ) + REGISTER_METATYPE( TreatmentData ) \ + REGISTER_METATYPE( PrimingData ) \ + REGISTER_METATYPE( StartTreatmentResponseData ) \ + REGISTER_METATYPE( EndTreatmentResponseData ) //===============================================================================// #define ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ @@ -190,14 +199,22 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustDurationResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationEditResponseData ) \ - ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmResponseData ) + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmResponseData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, PrimingData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, StartTreatmentResponseData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, EndTreatmentResponseData ) //--------------------------------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, StartTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, ConfirmTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, EndTreatmentRequestData ) + + //===============================================================================// #define ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS \ ACTION_RECEIVE_BRIDGE_DEFINITION( BloodFlowData ) \ @@ -230,29 +247,43 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustDurationResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationEditResponseData ) \ - ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmResponseData ) + ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmResponseData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( PrimingData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( StartTreatmentResponseData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( EndTreatmentResponseData ) //--------------------------------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( StartTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( ConfirmTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( EndTreatmentRequestData ) + //--------------------------------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_NOEMIT \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( StartTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( ConfirmTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( EndTreatmentRequestData ) + //--------------------------------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_PUBLIC \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( StartTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( ConfirmTreatmentRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( EndTreatmentRequestData ) //===============================================================================// #define ACTION_RECEIVE_SIGNALS \ ACTION_RECEIVE_SIGNAL( BloodFlowData ) \ @@ -286,6 +317,9 @@ ACTION_RECEIVE_SIGNAL( AdjustDurationResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationEditResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationConfirmResponseData ) \ - ACTION_RECEIVE_SIGNAL( TreatmentParametersRespData ) + ACTION_RECEIVE_SIGNAL( TreatmentParametersRespData ) \ + ACTION_RECEIVE_SIGNAL( PrimingData ) \ + ACTION_RECEIVE_SIGNAL( StartTreatmentResponseData ) \ + ACTION_RECEIVE_SIGNAL( EndTreatmentResponseData ) //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// Index: sources/model/MStartTreatmentResponse.cpp =================================================================== diff -u --- sources/model/MStartTreatmentResponse.cpp (revision 0) +++ sources/model/MStartTreatmentResponse.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,27 @@ +#include "MStartTreatmentResponse.h" + +using namespace Model; + +QVariantList MStartTreatmentResponse::parameters() const { + return { + _data.startTreatmentResponse.value, + _data.startTreatmentRejectReason.value + }; +} + +bool MStartTreatmentResponse::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if (GetValue(vByteArray, index, _data.startTreatmentResponse )) + if (GetValue(vByteArray, index, _data.startTreatmentRejectReason )) + return true; + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + +} + +MStartTreatmentResponse::Data MStartTreatmentResponse::data() const { + Data data; + data.startTreatmentResponse = _data.startTreatmentResponse.value; + data.startTreatmentRejectReason = _data.startTreatmentRejectReason.value; + return data; +} Index: sources/model/MStartTreatmentResponse.h =================================================================== diff -u --- sources/model/MStartTreatmentResponse.h (revision 0) +++ sources/model/MStartTreatmentResponse.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,52 @@ +#ifndef MSTARTTREATMENTRESPONSE_H +#define MSTARTTREATMENTRESPONSE_H + +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +class MStartTreatmentResponse : public MAbstract { + + // friends + friend class ::tst_models; + + QVariantList parameters() const override; + + struct { + Types::U32 startTreatmentResponse; + Types::U32 startTreatmentRejectReason; + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eEvent ; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("StartTreatmentResponse"); } + + struct Data { + quint32 startTreatmentResponse = 0; + quint32 startTreatmentRejectReason = 0; + }; + + MStartTreatmentResponse () {} + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; + +} + +typedef Model::MStartTreatmentResponse::Data StartTreatmentResponseData; + + +#endif // MSTARTTREATMENTRESPONSE_H Index: sources/model/hd/adjustment/MTreatmentAdjustRequests.h =================================================================== diff -u -r93b6ad6b18c505fedab37d95dc87be61db48641c -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 93b6ad6b18c505fedab37d95dc87be61db48641c) +++ sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -150,6 +150,53 @@ } }; +class MStartTreatmentReq : public MModel { +public: + enum Options { + eSelectParams = 0, + eCancel = 1, + eStartTreatment = 2 + }; + Options request = eSelectParams; + // coco begin validated : Has been validated manually. + // This object is used statically for now, kept the logic for later usage. + QString toString() { + return toString({request}); + } + // coco end + static QString toString(const QVariantList &vParameters) { + return MModel::toString("StartTreatment", vParameters); + } +}; + +class MConfirmTreatmentReq : public MModel { +public: + + // coco begin validated : Has been validated manually. + // This object is used statically for now, kept the logic for later usage. + QString toString() { + return toString({}); + } + // coco end + static QString toString(const QVariantList &vParameters) { + return MModel::toString("ConfirmTreatment", vParameters); + } +}; + +class MEndTreatmentReq : public MModel { +public: + + // coco begin validated : Has been validated manually. + // This object is used statically for now, kept the logic for later usage. + QString toString() { + return toString({}); + } + // coco end + static QString toString(const QVariantList &vParameters) { + return MModel::toString("EndTreatment", vParameters); + } +}; + } typedef Model:: MAdjustPowerOffReq AdjustPowerOffRequestData; @@ -158,5 +205,8 @@ typedef Model:: MAdjustUltrafiltrationStateReq AdjustUltrafiltrationStateRequestData; typedef Model:: MAdjustUltrafiltrationEditReq AdjustUltrafiltrationEditRequestData; typedef Model::MAdjustUltrafiltrationConfirmReq AdjustUltrafiltrationConfirmRequestData; - +typedef Model:: MStartTreatmentReq StartTreatmentRequestData; +typedef Model:: MConfirmTreatmentReq ConfirmTreatmentRequestData; +typedef Model:: MEndTreatmentReq EndTreatmentRequestData; typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData; + Index: sources/model/hd/data/MPrimingData.cpp =================================================================== diff -u --- sources/model/hd/data/MPrimingData.cpp (revision 0) +++ sources/model/hd/data/MPrimingData.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,30 @@ +#include "MPrimingData.h" + +using namespace Model; + +QVariantList MPrimingData::parameters() const { + return { + _data.currentState.value, + _data.secondsRemaining.value, + _data.secondsTotal.value + }; +} + +bool MPrimingData::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if (GetValue(vByteArray, index, _data.currentState )) + if (GetValue(vByteArray, index, _data.secondsRemaining )) + if (GetValue(vByteArray, index, _data.secondsTotal )) + return true ; + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } +} + +MPrimingData::Data MPrimingData::data() const { + Data data; + data.currentState = _data.currentState.value; + data.secondsRemaining = _data.secondsRemaining.value; + data.secondsTotal = _data.secondsTotal.value; + return data; +} Index: sources/model/hd/data/MPrimingData.h =================================================================== diff -u --- sources/model/hd/data/MPrimingData.h (revision 0) +++ sources/model/hd/data/MPrimingData.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,46 @@ +#ifndef MPRIMINGDATA_H +#define MPRIMINGDATA_H + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; +namespace Model { + +class MPrimingData : public MAbstract +{ + + QVariantList parameters() const override; + + struct { + Types::U32 currentState; + Types::U32 secondsRemaining; + Types::U32 secondsTotal; + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eDatum ; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("PrimingData"); } + + struct Data { + quint32 currentState = 0; + quint32 secondsRemaining = 0; + quint32 secondsTotal = 0; + }; + + MPrimingData() { } + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; + +} + +typedef Model::MPrimingData::Data PrimingData; + + +#endif // MPRIMINGDATA_H Index: sources/model/mtreatmentparameters.h =================================================================== diff -u -r772d48b0ccaa0d25b6ed48bba3a4b29dc73c5c16 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/model/mtreatmentparameters.h (.../mtreatmentparameters.h) (revision 772d48b0ccaa0d25b6ed48bba3a4b29dc73c5c16) +++ sources/model/mtreatmentparameters.h (.../mtreatmentparameters.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -18,14 +18,14 @@ quint32 bloodFlowRate = 0; // mL/min quint32 dialysateFlowRate = 0; // mL/min quint32 duration = 0; // minutes - quint32 heparinDispensingRate = 0; // mL/hr - quint32 heparinBolusVolume = 0; // mL + float heparinDispensingRate = 0; // mL/hr + float heparinBolusVolume = 0; // mL quint32 heparinStopTime = 0; // min quint32 salineBolus = 0; // mL quint32 acidConcentrate = 0; // quint32 bicarbonateConcentrate = 0; // quint32 dialyzerType = 0; // - quint32 dialysateTemp = 0; // Celsius + float dialysateTemp = 0; // Celsius qint32 arterialPressureLimitLow = 0; // mmHg qint32 arterialPressureLimitHigh = 0; // mmHg qint32 venousPressureLimitLow = 0; // mmHg Index: sources/model/mtreatmentparametersresp.cpp =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/model/mtreatmentparametersresp.cpp (.../mtreatmentparametersresp.cpp) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/model/mtreatmentparametersresp.cpp (.../mtreatmentparametersresp.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -10,24 +10,25 @@ */ void TreatmentParametersResp::toVariantList(QVariantList &list) const { + list += _data.requestValid.value; list += _data.bloodFlowRate.value; list += _data.dialysateFlowRate.value; list += _data.duration.value; - list += _data.heparinDispensingRate.value; - list += _data.heparinBolusVolume.value; list += _data.heparinStopTime.value; list += _data.salineBolus.value; list += _data.acidConcentrate.value; list += _data.bicarbonateConcentrate.value; list += _data.dialyzerType.value; - list += _data.dialysateTemp.value; + list += _data.bloodPressureMeasureInterval.value; + list += _data.rinsebackFlowRate.value; list += _data.arterialPressureLimitLow.value; list += _data.arterialPressureLimitHigh.value; list += _data.venousPressureLimitLow.value; list += _data.venousPressureLimitHigh.value; - list += _data.bloodPressureMeasureInterval.value; - list += _data.rinsebackFlowRate.value; + list += _data.heparinDispensingRate.value; + list += _data.heparinBolusVolume.value; + list += _data.dialysateTemp.value; } @@ -39,24 +40,26 @@ qDebug() << "Invalid QVariant List in " << __FUNCTION__; return data; } + data.requestValid = list[0].toUInt(); data.bloodFlowRate = list[1].toUInt(); data.dialysateFlowRate = list[2].toUInt(); data.duration = list[3].toUInt(); - data.heparinDispensingRate = list[4].toUInt(); - data.heparinBolusVolume = list[5].toUInt(); - data.heparinStopTime = list[6].toUInt(); - data.salineBolus = list[7].toUInt(); - data.acidConcentrate = list[8].toUInt(); - data.bicarbonateConcentrate = list[9].toUInt(); - data.dialyzerType = list[10].toUInt(); - data.dialysateTemp = list[11].toUInt(); - data.arterialPressureLimitLow = list[12].toUInt(); - data.arterialPressureLimitHigh = list[13].toUInt(); - data.venousPressureLimitLow = list[14].toUInt(); - data.venousPressureLimitHigh = list[15].toUInt(); - data.bloodPressureMeasureInterval = list[16].toUInt(); - data.rinsebackFlowRate = list[17].toUInt(); + data.heparinStopTime = list[4].toUInt(); + data.salineBolus = list[5].toUInt(); + data.acidConcentrate = list[6].toUInt(); + data.bicarbonateConcentrate = list[7].toUInt(); + data.dialyzerType = list[8].toUInt(); + data.bloodPressureMeasureInterval = list[9].toUInt(); + data.rinsebackFlowRate = list[10].toUInt(); + data.arterialPressureLimitLow = list[11].toUInt(); + data.arterialPressureLimitHigh = list[12].toUInt(); + data.venousPressureLimitLow = list[13].toUInt(); + data.venousPressureLimitHigh = list[14].toUInt(); + data.heparinDispensingRate = list[15].toUInt(); + data.heparinBolusVolume = list[16].toUInt(); + data.dialysateTemp = list[17].toUInt(); + return data; } @@ -66,20 +69,20 @@ if (GetValue(vByteArray, index, _data.bloodFlowRate )) if (GetValue(vByteArray, index, _data.dialysateFlowRate )) if (GetValue(vByteArray, index, _data.duration )) - if (GetValue(vByteArray, index, _data.heparinDispensingRate )) - if (GetValue(vByteArray, index, _data.heparinBolusVolume )) if (GetValue(vByteArray, index, _data.heparinStopTime )) if (GetValue(vByteArray, index, _data.salineBolus )) if (GetValue(vByteArray, index, _data.acidConcentrate )) if (GetValue(vByteArray, index, _data.bicarbonateConcentrate )) if (GetValue(vByteArray, index, _data.dialyzerType )) - if (GetValue(vByteArray, index, _data.dialysateTemp )) + if (GetValue(vByteArray, index, _data.bloodPressureMeasureInterval )) + if (GetValue(vByteArray, index, _data.rinsebackFlowRate )) if (GetValue(vByteArray, index, _data.arterialPressureLimitLow )) if (GetValue(vByteArray, index, _data.arterialPressureLimitHigh )) if (GetValue(vByteArray, index, _data.venousPressureLimitLow )) if (GetValue(vByteArray, index, _data.venousPressureLimitHigh )) - if (GetValue(vByteArray, index, _data.bloodPressureMeasureInterval )) - if (GetValue(vByteArray, index, _data.rinsebackFlowRate )) + if (GetValue(vByteArray, index, _data.heparinDispensingRate )) + if (GetValue(vByteArray, index, _data.heparinBolusVolume )) + if (GetValue(vByteArray, index, _data.dialysateTemp )) return true; else { if(vIndex) *vIndex = index; return false; } else { if(vIndex) *vIndex = index; return false; } Fisheye: Tag 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad refers to a dead (removed) revision in file `sources/view/VCreateTreatment.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad refers to a dead (removed) revision in file `sources/view/VCreateTreatment.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/view/VPriming.cpp =================================================================== diff -u --- sources/view/VPriming.cpp (revision 0) +++ sources/view/VPriming.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,67 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VPriming.cpp + * \author (last) Peter Lucia + * \date (last) 11-Sept-2020 + * \author (original) Peter Lucia + * \date (original) 11-Sept-2020 + * + */ +#include "VPriming.h" + +// Project +#include "guicontroller.h" + +using namespace Gui; +using namespace View; + +VPriming::VPriming(QObject *parent) : QObject(parent) +{ + + connect(&_GuiController, SIGNAL(didActionReceive(PrimingData)), + this , SLOT(onActionReceive(PrimingData))); +} + +void VPriming::onActionReceive(const PrimingData &data) +{ + qDebug() << "current state: " << data.currentState; + qDebug() << "seconds remaining: " << data.secondsRemaining; + qDebug() << "seconds total: " << data.secondsTotal; + + secondsTotal (data.secondsTotal ); + secondsRemaining (data.secondsRemaining ); + currentState (data.currentState ); + + + PrimingStates state = static_cast(currentState()); + + switch (state) { + case CHECKING_INSTALLATION: + case CREATING_DIALYSATE: + case PRIMING_LINES: + { + continueBtnText = "CONTINUE TO TREATMENT"; + continueEnabled(false); + emit continueBtnTextChanged(); + break; + } + case PRIMING_COMPLETE: + { + continueBtnText = "CONTINUE TO TREATMENT"; + continueEnabled(true); + emit continueBtnTextChanged(); + break; + } + default: + { + break; + } + } + + +} Index: sources/view/VPriming.h =================================================================== diff -u --- sources/view/VPriming.h (revision 0) +++ sources/view/VPriming.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,65 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VPriming.h + * \author (last) Peter Lucia + * \date (last) 11-Sept-2020 + * \author (original) Peter Lucia + * \date (original) 11-Sept-2020 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MPrimingData.h" + + +namespace View { + +class VPriming : public QObject +{ + Q_OBJECT +public: + VPriming(QObject *parent = NULL); + +private: + PROPERTY(quint32 , currentState , 0) + PROPERTY(quint32 , secondsRemaining , 0) + PROPERTY(quint32 , secondsTotal , 0) + PROPERTY(QStringList, primingStates ,QStringList() + << "Checking installation" + << "Creating dialysate" + << "Priming lines" + << "Priming Complete!") + PROPERTY(bool, continueEnabled, true) // TODO: Update this once priming messaging w/ FW is in place. + + QString continueBtnText = "Continue to Treatment"; + + + Q_PROPERTY(QString continueBtnText READ getContinueBtnText NOTIFY continueBtnTextChanged) + + enum PrimingStates { + CHECKING_INSTALLATION = 0, + CREATING_DIALYSATE, + PRIMING_LINES, + PRIMING_COMPLETE + }; + +signals: + void continueBtnTextChanged(); + +private slots: + void onActionReceive(const PrimingData &data); +public slots: + QString getContinueBtnText() { return continueBtnText; } + +}; + +} Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u --- sources/view/VTreatmentCreate.cpp (revision 0) +++ sources/view/VTreatmentCreate.cpp (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,932 @@ +#include "VTreatmentCreate.h" + +// Qt + +// Project +#include "filehandler.h" +#include "MsgDefs.h" + +using namespace Gui; +using namespace View; +using namespace Storage; + + +VTreatmentCreate::VTreatmentCreate(QObject *parent) : QObject(parent) +{ + connect(&_FileSaver, SIGNAL(fileSaved(bool)), + this, SLOT(onFinishedSaveNewTreatment(bool))); + + connect(this, SIGNAL(requestValidateParameters(GuiActionType,QVariantList)), + &_GuiController, SLOT(doActionTransmit(GuiActionType,QVariantList))); + + connect(&_GuiController, SIGNAL(didActionReceive(GuiActionType,QVariantList)), + this, SLOT(onFWValidationResponse(GuiActionType,QVariantList))); + + connect(this, SIGNAL(requestSelectParameters(StartTreatmentRequestData)), + &_GuiController, SLOT(doAdjustment(StartTreatmentRequestData))); + + connect(this, SIGNAL(requestConfirm(ConfirmTreatmentRequestData)), + &_GuiController, SLOT(doAdjustment(ConfirmTreatmentRequestData))); + + connect(&_GuiController, SIGNAL(didActionReceive(StartTreatmentResponseData)), + this, SLOT(onStartTreatmentResponse(StartTreatmentResponseData))); + + loadTreatmentParameterRanges(); + +} + +/** + * \brief VCreateTreatment::loadTreatmentParameterRanges + * Loads treatment parameters from a json file + * \return QJsonObject holding the treatment parameters + */ +QJsonObject VTreatmentCreate::loadTreatmentParameterRanges(const QString &path) +{ + QJsonObject obj; + if (!FileHandler::readJSON(path, obj)) + { + // TODO: notify user + LOG_EVENT(tr("Could not load treatment parameter ranges from %0").arg(path)); + return QJsonObject(); + } + + foreach (const QString& key, obj.keys()) + { + QJsonValue value = obj.value(key); + + if (key == GET_VARIABLE_NAME(bloodFlowRateMin)) + _bloodFlowRateMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(bloodFlowRateMax)) + _bloodFlowRateMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(dialysateFlowRateMin)) + _dialysateFlowRateMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(dialysateFlowRateMax)) + _dialysateFlowRateMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(durationMin)) + _durationMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(durationMax)) + _durationMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinDispensingRateMin)) + _heparinDispensingRateMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinDispensingRateMax)) + _heparinDispensingRateMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinBolusVolumeMin)) + _heparinBolusVolumeMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinBolusVolumeMax)) + _heparinBolusVolumeMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinStopTimeMin)) + _heparinStopTimeMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(heparinStopTimeMax)) + _heparinStopTimeMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(salineBolusVolumeMin)) + _salineBolusVolumeMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(salineBolusVolumeMax)) + _salineBolusVolumeMax = value.toInt(); + //options + else if (key == GET_VARIABLE_NAME(acidConcentrateOptions)) + _acidConcentrateOptions = jsonArrayToStringList(value.toArray()); + else if (key == GET_VARIABLE_NAME(bicarbonateConcentrateOptions)) + _bicarbonateConcentrateOptions = jsonArrayToStringList(value.toArray()); + else if (key == GET_VARIABLE_NAME(dialyzerTypeOptions)) + _dialyzerTypeOptions = jsonArrayToStringList(value.toArray()); + + else if (key == GET_VARIABLE_NAME(dialysateTempMin)) + _dialysateTempMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(dialysateTempMax)) + _dialysateTempMax = value.toInt(); + // arterial + else if (key == GET_VARIABLE_NAME(arterialPressureLimitLowMin)) + _arterialPressureLimitLowMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(arterialPressureLimitLowMax)) + _arterialPressureLimitLowMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(arterialPressureLimitHighMin)) + _arterialPressureLimitHighMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(arterialPressureLimitHighMax)) + _arterialPressureLimitHighMax = value.toInt(); + //venous + else if (key == GET_VARIABLE_NAME(venousPressureLimitLowMin)) + _venousPressureLimitLowMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(venousPressureLimitLowMax)) + _venousPressureLimitLowMax = value.toInt(); + else if (key == GET_VARIABLE_NAME(venousPressureLimitHighMin)) + _venousPressureLimitHighMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(venousPressureLimitHighMax)) + _venousPressureLimitHighMax = value.toInt(); + + else if (key == GET_VARIABLE_NAME(bloodPressureMeasureIntervalMin)) + _bloodPressureMeasureIntervalMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(bloodPressureMeasureIntervalMax)) + _bloodPressureMeasureIntervalMax = value.toInt(); + + else if (key == GET_VARIABLE_NAME(rinsebackFlowRateMin)) + _rinsebackFlowRateMin = value.toInt(); + else if (key == GET_VARIABLE_NAME(rinsebackFlowRateMax)) + _rinsebackFlowRateMax = value.toInt(); + else + { + qDebug() << "Invalid treatment parameter range: " << key; + LOG_EVENT(tr("Invalid treatment parameter found: %0").arg(key)); + } + } + + return obj; +} + +/** + * \brief VCreateTreatment::onResetCreateTreatment + * Resets the create treatment page to the default values. + * Disables the continue button. + */ +void VTreatmentCreate::onResetCreateTreatment() +{ + reset_bloodFlowRate(); + reset_dialysateFlowRate(); + reset_duration(); + reset_heparinDispensingRate(); + reset_heparinBolusVolume(); + reset_heparinStopTime(); + reset_salineBolusVolume(); + reset_acidConcentrate(); + reset_bicarbonateConcentrate(); + reset_dialyzerType(); + reset_dialysateTemp(); + reset_arterialPressureLimitLow(); + reset_arterialPressureLimitHigh(); + reset_venousPressureLimitLow(); + reset_venousPressureLimitHigh(); + reset_bloodPressureMeasureInterval(); + reset_rinsebackFlowRate(); + + continueEnabled(false); + + emit resetCreateTreatment(); +} + + +/** + * \brief VCreateTreatment::jsonArrayToStringList + * Converts a jsonarray of strings to a QStringList + * \param arr (QJsonArray) to convert + * \return (QStringList) The list of strings in the array + */ +QStringList VTreatmentCreate::jsonArrayToStringList(const QJsonArray &arr) +{ + QStringList result; + foreach (const QJsonValue &val, arr) { + result.append(val.toString()); + } + return result; +} + +/** + * \brief VCreateTreatment::setTreatmentData + * Assigns treatment parameters to the treatment data structure. + */ +void VTreatmentCreate::setTreatmentData() { + + treatmentData.bloodFlowRate = _bloodFlowRate; + treatmentData.dialysateFlowRate = _dialysateFlowRate; + treatmentData.duration = _duration; + treatmentData.heparinDispensingRate = _heparinDispensingRate; + treatmentData.heparinBolusVolume = _heparinBolusVolume; + treatmentData.heparinStopTime = _heparinStopTime; + treatmentData.salineBolus = _salineBolusVolume; + + treatmentData.acidConcentrate = _acidConcentrate; + treatmentData.bicarbonateConcentrate = _bicarbonateConcentrate; + treatmentData.dialyzerType = _dialyzerType; + treatmentData.dialysateTemp = _dialysateTemp; + treatmentData.arterialPressureLimitLow = _arterialPressureLimitLow; + treatmentData.arterialPressureLimitHigh = _arterialPressureLimitHigh; + treatmentData.venousPressureLimitLow = _venousPressureLimitLow; + treatmentData.venousPressureLimitHigh = _venousPressureLimitHigh; + treatmentData.bloodPressureMeasureInterval = _bloodPressureMeasureInterval; + treatmentData.rinsebackFlowRate = _rinsebackFlowRate; +} + +/** + * \brief VCreateTreatment::onFinishedCreate + * Validates the treatment profile locally, then requests validation of it with FW + */ +void VTreatmentCreate::onFinishedCreate() { + + setTreatmentData(); + + if (!validate(treatmentData)) + { + qDebug() << "Local create treatment validation failed."; + LOG_EVENT("Local create treatment validation failed."); + return; + } + + + // Request that FW validates the selected parameters + QVariantList messageData = { + treatmentData.bloodFlowRate, + treatmentData.dialysateFlowRate, + treatmentData.duration, + treatmentData.heparinStopTime, + treatmentData.salineBolus, + treatmentData.acidConcentrate, + treatmentData.bicarbonateConcentrate, + treatmentData.dialyzerType, + treatmentData.bloodPressureMeasureInterval, + treatmentData.rinsebackFlowRate, + treatmentData.arterialPressureLimitLow, + treatmentData.arterialPressureLimitHigh, + treatmentData.venousPressureLimitLow, + treatmentData.venousPressureLimitHigh, + treatmentData.heparinDispensingRate, + treatmentData.heparinBolusVolume, + treatmentData.dialysateTemp, + }; + GuiActionType messageAction = GuiActions::ID_CreateTreatmentReq; + + emit requestValidateParameters(messageAction, messageData); + + LOG_DEBUG("Requesting FW validation of new treatment parameters"); + +} + +/** + * \brief VCreateTreatment::enumToString + * Convenience functiont to convert an enum to a string + * \param vEnum - the enum value + * \return QString - the enum name + */ +QString VTreatmentCreate::enumToString(GuiRequestReasons vEnum) +{ + const QMetaObject *mo = qt_getEnumMetaObject(vEnum); + int enumIdx = mo->indexOfEnumerator(qt_getEnumName(vEnum)); + QString mText = mo->enumerator(enumIdx).valueToKey(vEnum); + if ( ! mText.isEmpty() ) { + return mText; + } + return QString("[%1] Unknown Rejection Reason").arg(vEnum); +} + +/** + * \brief VCreateTreatment::onFWValidationResponse + * Slot to handle a validation response from FW + * \param actionType The action type must be a create treatment response + * \param messageData The message data must contain the reject reason codes for all parameters + * \returns True if FW OK's treatment parameters, false otherwise + */ +bool VTreatmentCreate::onFWValidationResponse(const GuiActionType &actionType, const QVariantList &messageData) { + + if (actionType != GuiActionType::ID_CreateTreatmentRsp) + return false; + + Model::TreatmentParametersResp response; + TreatmentParametersRespData data = response.fromVariantList(messageData); + + bool success = true; + if (data.bloodFlowRate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.bloodFlowRate)); + success = false; + emit bloodFlowRate_ValidationFailed(enumToString(static_cast(data.bloodFlowRate))); + } + if (data.dialysateFlowRate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.dialysateFlowRate)); + success = false; + emit dialysateFlowRate_ValidationFailed(enumToString(static_cast(data.dialysateFlowRate))); + } + if (data.duration != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.duration)); + success = false; + emit duration_ValidationFailed(enumToString(static_cast(data.duration))); + } + if (data.heparinDispensingRate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.heparinDispensingRate)); + success = false; + emit heparinDispensingRate_ValidationFailed(enumToString(static_cast(data.heparinDispensingRate))); + } + if (data.heparinBolusVolume != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.heparinBolusVolume)); + success = false; + emit heparinBolusVolume_ValidationFailed(enumToString(static_cast(data.heparinBolusVolume))); + } + if (data.heparinStopTime != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.heparinStopTime)); + success = false; + emit heparinStopTime_ValidationFailed(enumToString(static_cast(data.heparinStopTime))); + } + if (data.salineBolus != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.salineBolus)); + success = false; + emit salineBolusVolume_ValidationFailed(enumToString(static_cast(data.salineBolus))); + } + if (data.acidConcentrate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.acidConcentrate)); + success = false; + emit acidConcentrate_ValidationFailed(enumToString(static_cast(data.acidConcentrate))); + } + if (data.bicarbonateConcentrate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.bicarbonateConcentrate)); + success = false; + emit bicarbonateConcentrate_ValidationFailed(enumToString(static_cast(data.bicarbonateConcentrate))); + } + if (data.dialyzerType != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.dialyzerType)); + success = false; + emit dialyzerType_ValidationFailed(enumToString(static_cast(data.dialyzerType))); + } + if (data.dialysateTemp != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.dialysateTemp)); + success = false; + emit dialysateTemp_ValidationFailed(enumToString(static_cast(data.dialysateTemp))); + } + if (data.arterialPressureLimitLow != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.arterialPressureLimitLow)); + success = false; + emit arterialPressureLimitLow_ValidationFailed(enumToString(static_cast(data.arterialPressureLimitLow))); + } + if (data.arterialPressureLimitHigh != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.arterialPressureLimitHigh)); + success = false; + emit arterialPressureLimitHigh_ValidationFailed(enumToString(static_cast(data.arterialPressureLimitHigh))); + } + if (data.venousPressureLimitLow != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.venousPressureLimitLow)); + success = false; + emit venousPressureLimitLow_ValidationFailed(enumToString(static_cast(data.venousPressureLimitLow))); + } + if (data.venousPressureLimitHigh != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.venousPressureLimitHigh)); + success = false; + emit venousPressureLimitHigh_ValidationFailed(enumToString(static_cast(data.venousPressureLimitHigh))); + } + if (data.bloodPressureMeasureInterval != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.bloodPressureMeasureInterval)); + success = false; + emit bloodPressureMeasureInterval_ValidationFailed(enumToString(static_cast(data.bloodPressureMeasureInterval))); + } + if (data.rinsebackFlowRate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + if (success) emit scrollToParameter(GET_VARIABLE_NAME(data.rinsebackFlowRate)); + success = false; + emit rinsebackFlowRate_ValidationFailed(enumToString(static_cast(data.rinsebackFlowRate))); + } + if (data.requestValid != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { + success = false; + emit fwValidationFailed(enumToString(static_cast(data.requestValid))); + } + + qDebug() << "fw validation success = " << success; + + if (success) + goToNextPage(true); + + return success; + +} + +/** + * @brief VCreateTreatment::onStartTreatmentResponse + * Called when we receive a response back from firmware after requesting + * to start selecting treatment parameters, cancel, or start the treatment + * @param messageData + */ +void VTreatmentCreate::onStartTreatmentResponse(const StartTreatmentResponseData &messageData) +{ + qDebug() << "Received response after start treatment request: " << messageData.startTreatmentResponse; + if (messageData.startTreatmentResponse != 1) + return; + + if (startTreatmentRequest.request == StartTreatmentRequestData::eCancel) + goToNextPage(false); + else + goToNextPage(true); +} + +/** + * @brief VCreateTreatment::getNextPage + * Updates the current page to the next page after + * moving forward or backward + * @param forward - (bool) true if moving forward, if false pop the page + */ +void VTreatmentCreate::goToNextPage(bool forward) +{ + qDebug() << __FUNCTION__ << pageToShow; + + switch (pageToShow) + { + case None: { + if (forward) { + pageToShow = CreateTreatment; + emit showCreate(); + } + else { + emit pop(); + } + break; + } + case CreateTreatment: { + if (forward) { + pageToShow = ConfirmTreatment; + emit showConfirm(); + } + else { + pageToShow = None; + emit pop(); + } + break; + } + case ConfirmTreatment: { + if (forward) { + pageToShow = Priming; + emit showPrime(); + } else { + pageToShow = CreateTreatment; + emit pop(); + } + break; + } + case Priming: { + if (forward) { + pageToShow = BeginTreatment; + emit showBegin(); + } else { + pageToShow = ConfirmTreatment; // TODO: won't be able to go back eventually + emit pop(); + } + break; + } + case BeginTreatment: { + if (forward) { + // reset for next time a treatment is created + pageToShow = None; + emit showTreatmentStart(); + } else { + pageToShow = Priming; + emit pop(); + } + break; + } + default: { + LOG_DEBUG("Invalid current page."); + } + } +} + +/** + * \brief VCreateTreatment::onFinishedConfirm + * Emits treatment data to gui controller, + * who emits to application controller and the + * application controller will save the data to disk. + */ +void VTreatmentCreate::onFinishedConfirm() { + qDebug() << "Finished create treatment confirm..."; + + + QJsonObject obj { + {"bloodFlowRate", QString::number(treatmentData.bloodFlowRate)}, + {"dialysateFlowRate", QString::number(treatmentData.dialysateFlowRate)}, + {"duration", QString::number(treatmentData.duration)}, + {"heparinDispensingRate", QString::number(treatmentData.heparinDispensingRate)}, + {"heparinBolusVolume", QString::number(treatmentData.heparinBolusVolume)}, + {"heparinStopTime", QString::number(treatmentData.heparinStopTime)}, + {"acidConcentrate", QString::number(treatmentData.acidConcentrate)}, + {"bicarbonateConcentrate", QString::number(treatmentData.bicarbonateConcentrate)}, + {"dialyzerType", QString::number(treatmentData.dialyzerType)}, + {"dialysateTemp", QString::number(treatmentData.dialysateTemp)}, + {"arterialPressureLimitLow", QString::number(treatmentData.arterialPressureLimitLow)}, + {"arterialPressureLimitHigh", QString::number(treatmentData.arterialPressureLimitHigh)}, + {"venousPressureLimitLow", QString::number(treatmentData.venousPressureLimitLow)}, + {"venousPressureLimitHigh", QString::number(treatmentData.venousPressureLimitHigh)}, + {"bloodPressureMeasureInterval",QString::number(treatmentData.bloodPressureMeasureInterval)}, + {"rinsebackFlowRate", QString::number(treatmentData.rinsebackFlowRate)} + }; + + if (saveTreatmentProfile()) + saveNewTreatment(obj); + + // Tell FW we confirm + emit requestConfirm(confirmTreatmentRequest); + + // no FW response required + goToNextPage(true); + +} + +/** + * \brief ApplicationController::saveNewTreatment + * Saves a new treatment to the filesystem. + * \param doc - QJsonDocument containing the new treatment parameters. + * \returns QString - the file to be written to + * + */ +QString VTreatmentCreate::saveNewTreatment(const QJsonObject &obj, const QString &dir) +{ + QJsonDocument document(obj); + int i = 0; + while (QFile(QString("%0treatment%1.json").arg(dir).arg(i)).exists()) + { + i++; + } + QString filename = QString("%0treatment%1.json").arg(dir).arg(i); + _FileSaver.concurrentSave(filename, document.toJson(), false); + return filename; + +} + +/** + * @brief VCreateTreatment::getParameterRangesDataCSV + * Gets the parameter ranges data prepared for CSV file format + * @return QString - the data to write to CSV + */ +QString VTreatmentCreate::getParameterRangesDataCSV() +{ + QString csvData; + QString sep = ","; + + csvData += QString("bloodFlowRateMin,%0\n").arg(bloodFlowRateMin()); + csvData += QString("bloodFlowRateMax,%0\n").arg(bloodFlowRateMax()); + csvData += QString("dialysateFlowRateMin,%0\n").arg(dialysateFlowRateMin()); + csvData += QString("dialysateFlowRateMax,%0\n").arg(dialysateFlowRateMax()); + csvData += QString("durationMin,%0\n").arg(durationMin()); + csvData += QString("durationMax,%0\n").arg(durationMax()); + csvData += QString("heparinDispensingRateMin,%0\n").arg(heparinDispensingRateMin()); + csvData += QString("heparinDispensingRateMax,%0\n").arg(heparinDispensingRateMax()); + csvData += QString("heparinBolusVolumeMin,%0\n").arg(heparinBolusVolumeMin()); + csvData += QString("heparinBolusVolumeMax,%0\n").arg(heparinBolusVolumeMax()); + csvData += QString("heparinStopTimeMin,%0\n").arg(heparinStopTimeMin()); + csvData += QString("heparinStopTimeMax,%0\n").arg(heparinStopTimeMax()); + csvData += QString("salineBolusVolumeMin,%0\n").arg(salineBolusVolumeMin()); + csvData += QString("salineBolusVolumeMax,%0\n").arg(salineBolusVolumeMax()); + csvData += QString("acidConcentrateOptions,%0\n").arg(acidConcentrateOptions().join(sep)); + csvData += QString("bicarbonateConcentrateOptions,%0\n").arg(bicarbonateConcentrateOptions().join(sep)); + csvData += QString("dialyzerTypeOptions,%0\n").arg(dialyzerTypeOptions().join(sep)); + csvData += QString("dialysateTempMin,%0\n").arg(dialysateTempMin()); + csvData += QString("dialysateTempMax,%0\n").arg(dialysateTempMax()); + csvData += QString("arterialPressureLimitLowMin,%0\n").arg(arterialPressureLimitLowMin()); + csvData += QString("arterialPressureLimitLowMax,%0\n").arg(arterialPressureLimitLowMax()); + csvData += QString("arterialPressureLimitHighMin,%0\n").arg(arterialPressureLimitHighMin()); + csvData += QString("arterialPressureLimitHighMax,%0\n").arg(arterialPressureLimitHighMax()); + csvData += QString("venousPressureLimitLowMin,%0\n").arg(venousPressureLimitLowMin()); + csvData += QString("venousPressureLimitLowMax,%0\n").arg(venousPressureLimitLowMax()); + csvData += QString("venousPressureLimitHighMin,%0\n").arg(venousPressureLimitHighMin()); + csvData += QString("venousPressureLimitHighMax,%0\n").arg(venousPressureLimitHighMax()); + csvData += QString("bloodPressureMeasureIntervalMin,%0\n").arg(bloodPressureMeasureIntervalMin()); + csvData += QString("bloodPressureMeasureIntervalMax,%0\n").arg(bloodPressureMeasureIntervalMax()); + csvData += QString("rinsebackFlowRateMin,%0\n").arg(rinsebackFlowRateMin()); + csvData += QString("rinsebackFlowRateMax,%0\n").arg(rinsebackFlowRateMax()); + + return csvData; +} + +/*! + * \brief VCreateTreatment::saveTreatmentRangesCSV + * Saves the treatment ranges to a CSV file + * \param filename - the csv file to save the ranges to + * \return bool - true if successful, false otherwise + */ +bool VTreatmentCreate::saveTreatmentRangesCSV(const QString &filename) +{ + QString csvData = getParameterRangesDataCSV(); + + return FileHandler::write(filename, csvData); +} + +void VTreatmentCreate::onFinishedSaveNewTreatment(bool success) +{ + if (success) { + qDebug() << "------------------> Saved a new treatment."; + } else { + qDebug() << "------------------> Failed to save new treatment."; + } +} + +/** + * \brief VCreateTreatment::onFnishedPrime + * Called when priming qml selections are complete. + * TODO: Placed here for now. Likely will be moved eventually. + */ +void VTreatmentCreate::onFinishedPrime() { + qDebug() << "Finished create treatment prime..."; + + goToNextPage(true); +} + +/** + * \brief VCreateTreatment::start + * Called when user is ready to begin a new treatment. + */ +void VTreatmentCreate::onStartTreatment() { + qDebug() << "Requesting to start a treatment..."; + startTreatmentRequest.request = StartTreatmentRequestData::eStartTreatment; + emit requestSelectParameters(startTreatmentRequest); +} + +/** + * \brief VCreateTreatment::validate + * Validates the create new treatment input. + * \param vData - the selected TreatmentData + * \return true on success, false otherwise. + */ +bool VTreatmentCreate::validate(const TreatmentData &vData) +{ + bool success = true; + + if (!isbloodFlowRateSet) + success = false; + + if (!isdialysateFlowRateSet) + success = false; + + if (!isdurationSet) + success = false; + + if (!isheparinDispensingRateSet) + success = false; + + if (!isheparinBolusVolumeSet) + success = false; + + if (!isheparinStopTimeSet) + success = false; + + if (!issalineBolusVolumeSet) + success = false; + + if (!isacidConcentrateSet) + success = false; + + if (!isbicarbonateConcentrateSet) + success = false; + + if (!isdialyzerTypeSet) + success = false; + + if (!isdialysateTempSet) + success = false; + + if (!isarterialPressureLimitLowSet) + success = false; + + if (!isarterialPressureLimitHighSet) + success = false; + + if (!isvenousPressureLimitLowSet) + success = false; + + if (!isvenousPressureLimitHighSet) + success = false; + + if (!isbloodPressureMeasureIntervalSet) + success = false; + + if (!isrinsebackFlowRateSet) + success = false; + + if (!success) { + return false; + } + if (vData.bloodFlowRate < _bloodFlowRateMin || + vData.bloodFlowRate > _bloodFlowRateMax) + { + emit bloodFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.dialysateFlowRate < _dialysateFlowRateMin || + vData.dialysateFlowRate > _dialysateFlowRateMax ) + { + emit dialysateFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.duration < _durationMin || vData.duration > _durationMax) + { + emit duration_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.heparinDispensingRate < _heparinDispensingRateMin || + vData.heparinDispensingRate > _heparinDispensingRateMax) + { + emit heparinDispensingRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.heparinBolusVolume < _heparinBolusVolumeMin || + vData.heparinBolusVolume > _heparinBolusVolumeMax) + { + emit heparinBolusVolume_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + + if (vData.heparinStopTime < _heparinStopTimeMin || + vData.heparinStopTime > _heparinStopTimeMax) + { + emit heparinStopTime_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + + if (vData.salineBolus < _salineBolusVolumeMin || + vData.salineBolus > _salineBolusVolumeMax) + { + emit salineBolusVolume_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (!indexInItems(vData.acidConcentrate, _acidConcentrateOptions)) + { + emit acidConcentrate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (!indexInItems(vData.bicarbonateConcentrate, _bicarbonateConcentrateOptions)) + { + emit bicarbonateConcentrate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (!indexInItems(vData.dialyzerType, _dialyzerTypeOptions)) + { + emit dialyzerType_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.dialysateTemp < _dialysateTempMin || + vData.dialysateTemp > _dialysateTempMax) + { + emit dialysateTemp_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.arterialPressureLimitLow < _arterialPressureLimitLowMin || + vData.arterialPressureLimitLow > _arterialPressureLimitLowMax || + vData.arterialPressureLimitLow > vData.arterialPressureLimitHigh) + { + emit arterialPressureLimitLow_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); + success = false; + } + if (vData.arterialPressureLimitHigh < _arterialPressureLimitHighMin || + vData.arterialPressureLimitHigh > _arterialPressureLimitHighMax || + vData.arterialPressureLimitHigh < vData.arterialPressureLimitLow) + { + emit arterialPressureLimitHigh_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); + success = false; + } + if (vData.venousPressureLimitLow < _venousPressureLimitLowMin || + vData.venousPressureLimitLow > _venousPressureLimitLowMax || + vData.venousPressureLimitLow > vData.venousPressureLimitHigh) + { + emit venousPressureLimitLow_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); + success = false; + } + if (vData.venousPressureLimitHigh < _venousPressureLimitHighMin || + vData.venousPressureLimitHigh > _venousPressureLimitHighMax || + vData.venousPressureLimitHigh < vData.venousPressureLimitLow) + { + emit venousPressureLimitHigh_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); + success = false; + } + if (vData.bloodPressureMeasureInterval < _bloodPressureMeasureIntervalMin || + vData.bloodPressureMeasureInterval > _bloodPressureMeasureIntervalMax) + { + emit bloodPressureMeasureInterval_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + if (vData.rinsebackFlowRate < _rinsebackFlowRateMin || + vData.rinsebackFlowRate > _rinsebackFlowRateMax) + { + emit rinsebackFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); + success = false; + } + + return success; + +} + +/** + * \brief VCreateTreatment::indexInItems + * Checks if the index is in the QStringList + * \param idx (int) the index + * \param items (QStringList) The list of strings to check + * \return True if it is in the list, false otherwise + */ +bool VTreatmentCreate::indexInItems(quint32 idx, const QStringList &items) +{ + if (idx > (quint32)items.size() - 1) + return false; + else + return true; + +} + +/** + * \brief VCreateTreatment::onUserModifiedParameters + * Manages enabling / disabling the continue button + */ +void VTreatmentCreate::onUserModifiedParameters() +{ + setTreatmentData(); + + continueEnabled(validate(treatmentData)); + emit continueEnabledChanged(continueEnabled()); + +} + +/*! + * \brief VCreateTreatment::getPrescriptionParameterNames + * Gets a list of the prescription parameter names. + * \return (QStringList) A list of the prescription parameter names + */ +QStringList VTreatmentCreate::getPrescriptionParameterNames() +{ + return QStringList() << "Blood Flow Rate" + << "Dialysate Flow Rate" + << "Duration" + << "Heparin Dispensing Rate" + << "Heparin Bolus Volume" + << "Heparin Stop Time" + << "Saline Bolus Volume"; + +} + +/*! + * \brief VCreateTreatment::getPrescriptionParameterValues + * Gets a list of the prescription parameter values + * \return (QStringList) The list of parameter values with units + */ +QStringList VTreatmentCreate::getPrescriptionParameterValues() +{ + return QStringList() << QString("%0 mL/min").arg(_bloodFlowRate) + << QString("%0 mL/min").arg(_dialysateFlowRate) + << QString("%0 min").arg(_duration) + << QString("%0 mL/hr").arg(_heparinDispensingRate) + << QString("%0 mL").arg(_heparinBolusVolume) + << QString("%0 min").arg(_heparinStopTime) + << QString("%0 mL").arg(_salineBolusVolume); +} + +/*! + * \brief VCreateTreatment::getOperatingParameterNames + * Gets a list of the operating parameter names + * \return (QStringList) The list of operating parameter names + */ +QStringList VTreatmentCreate::getOperatingParameterNames() +{ + return QStringList() << "Acid Concentrate" + << "Bicarbonate Concentrate" + << "Dialyzer Type" + << "Dialysate Temperature" + << "Arterial Pressure Limit Low" + << "Arterial Pressure Limit High" + << "Venous Pressure Limit Low" + << "Venous Pressure Limit High" + << "Blood Pressure Measure Interval" + << "Rinseback Rate"; +} + +/*! + * \brief VCreateTreatment::getOperatingParameterValues + * Gets the operating parameter values + * \return (QStringList) The list of operating parameter values with units where applicable + */ +QStringList VTreatmentCreate::getOperatingParameterValues() +{ + QString aConcentrate; + QString bCarbConcentrate; + QString dType; + if ((acidConcentrateOptions().length() - 1 < (int)_acidConcentrate) || ((int)_acidConcentrate < 0)) + aConcentrate = "None"; + if ((bicarbonateConcentrateOptions().length() - 1 < (int)_bicarbonateConcentrate) || ((int)_bicarbonateConcentrate < 0)) + bCarbConcentrate = "None"; + if ((dialyzerTypeOptions().length() - 1 < (int)_dialyzerType) || ((int)_dialyzerType < 0)) + dType = "None"; + return QStringList() << aConcentrate + << bCarbConcentrate + << dType + << QString("%0 C").arg(_dialysateTemp) + << QString("%0 mmHg").arg(_arterialPressureLimitLow) + << QString("%0 mmHg").arg(_arterialPressureLimitHigh) + << QString("%0 mmHg").arg(_venousPressureLimitLow) + << QString("%0 mmHg").arg(_venousPressureLimitHigh) + << QString("%0 min").arg(_bloodPressureMeasureInterval) + << QString("%0 min").arg(_rinsebackFlowRate); +} + +/** + * @brief VCreateTreatment::onSelectingParameters + * Sends a request to FW to start selecting treatment parameters + */ +void VTreatmentCreate::onSelectingParameters() +{ + qDebug() << "Sending request to FW to select parameters..."; + startTreatmentRequest.request = StartTreatmentRequestData::eSelectParams; + emit requestSelectParameters(startTreatmentRequest); +} + + +/** + * @brief VCreateTreatment::onCancelSelectingParameters + * Sends a request to FW to cancel selecting parameters + */ +void VTreatmentCreate::onCancelSelectingParameters() +{ + qDebug() << "Sending request to FW to cancel selecting parameters..."; + startTreatmentRequest.request = StartTreatmentRequestData::eCancel; + emit requestSelectParameters(startTreatmentRequest); +} + +/** + * @brief VCreateTreatment::onRequestPop + * Navigates backward in the create treatment process. + */ +void VTreatmentCreate::onRequestPop() +{ + goToNextPage(false); +} Index: sources/view/VTreatmentCreate.h =================================================================== diff -u --- sources/view/VTreatmentCreate.h (revision 0) +++ sources/view/VTreatmentCreate.h (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -0,0 +1,152 @@ +#ifndef VCREATETREATMENT_H +#define VCREATETREATMENT_H + +// Qt +#include +#include +#include +#include +#include +#include + +// Project +#include "mtreatmentparameters.h" +#include "mtreatmentparametersresp.h" +#include "guicontroller.h" +#include "storageglobals.h" +#include "filesaver.h" + +// forward diclations +class tst_views; + +using namespace Storage; +using namespace Gui; +using namespace Model; + +#define UNSET 9999 + +namespace View { + +class VTreatmentCreate : public QObject +{ + Q_OBJECT + + // friends + friend class::tst_views; + +public: + explicit VTreatmentCreate(QObject *parent = nullptr); + +protected: + // Def Min Max Res + TREATMENT_PARAMETER(quint32, bloodFlowRate, 100, 100, 500, 25 ) // mL/min + TREATMENT_PARAMETER(quint32, dialysateFlowRate, 100, 100, 600, 50 ) // mL/min + TREATMENT_PARAMETER(quint32, duration, 60, 60, 480, 15 ) // minutes + TREATMENT_PARAMETER(float, heparinDispensingRate, 0, 0.1, 1.0, 0.1) // mL/hr (0 = off) + TREATMENT_PARAMETER(float, heparinBolusVolume, 0, 0.1, 2.0, 0.1) // mL (0 = off) + TREATMENT_PARAMETER(quint32, heparinStopTime, 0, 0, 480, 10 ) // min + TREATMENT_PARAMETER(quint32, salineBolusVolume, 100, 100, 300, 100) // mL + + TREATMENT_PARAMETER(quint32, acidConcentrate, UNSET, 0, 3, 1) + TREATMENT_PARAMETER(quint32, bicarbonateConcentrate, UNSET, 0, 1, 1) + TREATMENT_PARAMETER(quint32, dialyzerType, UNSET, 0, 3, 1) + + TREATMENT_PARAMETER(float, dialysateTemp, 37, 35, 38, 0.5) // Celsius + TREATMENT_PARAMETER(qint32, arterialPressureLimitLow, -300, -300, 200, 10) // mmHg + TREATMENT_PARAMETER(qint32, arterialPressureLimitHigh, 100, -300, 200, 10) // mmHg + TREATMENT_PARAMETER(qint32, venousPressureLimitLow, -100, -100, 600, 10) // mmHg + TREATMENT_PARAMETER(qint32, venousPressureLimitHigh, 400, 100, 600, 10) // mmHg + TREATMENT_PARAMETER(quint32, bloodPressureMeasureInterval, 30, 15, 60, 5) // minutes + TREATMENT_PARAMETER(quint32, rinsebackFlowRate, 75, 50, 150, 25) // mL/min + +protected: + + PROPERTY(QStringList, acidConcentrateOptions, QStringList() << "08-1251-1" << "08-2251-0" << "08-3251-9") + PROPERTY(QStringList, bicarbonateConcentrateOptions, QStringList() << "Dimesol - BC-201") + PROPERTY(QStringList, dialyzerTypeOptions, QStringList() << "Nipro Elisio-H 17" + << "Nipro Elisio-H 19" + << "Fresenius Optiflux F160NRe" + << "Fresenius Optiflux F180NRe") + + PROPERTY(bool, continueEnabled, false) + PROPERTY(bool, saveTreatmentProfile, false) + + TreatmentData treatmentData; + bool validate(const TreatmentData &vData); + QString saveNewTreatment(const QJsonObject &obj, const QString &dir = Treatment_Profiles_Dir); + QString getParameterRangesDataCSV(); + bool saveTreatmentRangesCSV(const QString &filename); + QJsonObject loadTreatmentParameterRanges(const QString &path = Treatment_Parameter_Ranges_Path); + QStringList jsonArrayToStringList(const QJsonArray &arr); + bool indexInItems(quint32 idx, const QStringList &items); + void setTreatmentData(); + +private: + + enum UIRejectReasons { + OUT_OF_RANGE, + LOW_HIGH_INCOMPATIBLE + }; + + enum Page { + None, + CreateTreatment, + ConfirmTreatment, + Priming, + BeginTreatment + }; + + QHash uiRejections { + { OUT_OF_RANGE, "The selected value is out of range." }, + { LOW_HIGH_INCOMPATIBLE, "The low and high selections are incompatible." }, + + }; + + Page pageToShow = None; + + QString enumToString(GuiRequestReasons vEnum); + StartTreatmentRequestData startTreatmentRequest; + ConfirmTreatmentRequestData confirmTreatmentRequest; + void goToNextPage(bool forward); + + +private slots: + void onFinishedSaveNewTreatment(bool result); + +signals: + void didCreateTreatment(const TreatmentData &data); + void showCreate(); + void showConfirm(); + void showPrime(); + void showBegin(); + void pop(); + void showTreatmentStart(); + void requestValidateParameters(const GuiActionType &action, const QVariantList &data); + void requestConfirm(const ConfirmTreatmentRequestData &data); + void requestSelectParameters(const StartTreatmentRequestData &data); + void resetCreateTreatment(); + void fwValidationFailed(QString reason); + void scrollToParameter(QString parameter); + +public slots: + void onResetCreateTreatment(); + void onFinishedCreate(); + void onFinishedConfirm(); + void onFinishedPrime(); + void onStartTreatment(); + bool onFWValidationResponse(const GuiActionType &actionType, const QVariantList &messageData); + void onStartTreatmentResponse(const StartTreatmentResponseData &messageData); + void onUserModifiedParameters(); + QStringList getPrescriptionParameterNames(); + QStringList getPrescriptionParameterValues(); + QStringList getOperatingParameterNames(); + QStringList getOperatingParameterValues(); + void onSelectingParameters(); + void onCancelSelectingParameters(); + void onRequestPop(); + +}; + +} + +#endif // VCREATETREATMENT_H Index: sources/view/vview.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- sources/view/vview.h (.../vview.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/view/vview.h (.../vview.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -119,8 +119,9 @@ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationState ) \ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationEdit ) \ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationConfirm ) \ - REGISTER_TYPE( VCreateTreatment ) + REGISTER_TYPE( VTreatmentCreate ) \ + REGISTER_TYPE( VPriming ) \ + REGISTER_TYPE( VTreatmentBegin ) - //--------------------------------------------------------------------------------// Index: unittests/tst_views.cpp =================================================================== diff -u -rf3b164487b1648637f5dd9a306cb6ade763d27c9 -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- unittests/tst_views.cpp (.../tst_views.cpp) (revision f3b164487b1648637f5dd9a306cb6ade763d27c9) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -76,7 +76,7 @@ { for (int i = 0; i < 18; ++i) { - View::VCreateTreatment view; + View::VTreatmentCreate view; if (i != 0) view.set_bloodFlowRate(view.bloodFlowRateMax()); if (i != 1) view.set_dialysateFlowRate(view.dialysateFlowRateMax()); if (i != 2) view.set_duration(view.durationMax()); @@ -153,7 +153,7 @@ * Simulates a user selection of valid parameters * \param view VCreateTreatment object to be set with valid parameters */ -void tst_views::VCreateTreatment_simulate_valid_parameters(View::VCreateTreatment &view) +void tst_views::VCreateTreatment_simulate_valid_parameters(View::VTreatmentCreate &view) { view.set_bloodFlowRate(view.bloodFlowRateMax()); view.set_dialysateFlowRate(view.dialysateFlowRateMax()); @@ -238,7 +238,7 @@ */ void tst_views::VCreateTreatment_validation_ranges() { - View::VCreateTreatment view; + View::VTreatmentCreate view; // adjust quint32 minimums view.bloodFlowRateMin(1); @@ -345,7 +345,7 @@ void tst_views::VCreateTreatment_check_init() { - View::VCreateTreatment view; + View::VTreatmentCreate view; quint32 val = 150; view.bloodFlowRateMin(val); ++val; view.bloodFlowRateMin(val); view.bloodFlowRateMin(val); @@ -522,7 +522,7 @@ void tst_views::VCreateTreatment_save_csv() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QString csvData = view.getParameterRangesDataCSV(); QString filename = QString("/tmp/out_%0.csv").arg(QDateTime::currentDateTime().toString(datetimeFormat)); @@ -543,7 +543,7 @@ */ void tst_views::VCreateTreatment_save() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonObject objectWritten { {"bloodFlowRate", QString::number(view.treatmentData.bloodFlowRate)}, @@ -587,7 +587,7 @@ */ void tst_views::VCreateTreatment_enums() { - View::VCreateTreatment view; + View::VTreatmentCreate view; GuiRequestReasons reason = GuiRequestReasons::REQUEST_REJECT_REASON_NONE; QCOMPARE(view.enumToString(reason), "REQUEST_REJECT_REASON_NONE"); @@ -603,7 +603,7 @@ */ void tst_views::VCreateTreatment_json() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonArray arr; QStringList list; @@ -635,7 +635,7 @@ */ void tst_views::VCreateTreatment_fw_validation_response() { - View::VCreateTreatment view; + View::VTreatmentCreate view; GuiActionType action = GuiActionType::ID_CreateTreatmentRsp; for (int i = 0; i < 18; ++i) @@ -684,7 +684,7 @@ view.onFinishedSaveNewTreatment(true); view.onFinishedSaveNewTreatment(false); view.onFinishedPrime(); - view.onStart(); + view.onStartTreatment(); QCOMPARE(view.treatmentData.bloodFlowRate, dataBackup.bloodFlowRate); QCOMPARE(view.treatmentData.dialysateFlowRate, dataBackup.dialysateFlowRate); @@ -712,7 +712,7 @@ */ void tst_views::VCreateTreatment_load_parameter_ranges() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonObject obj; Index: unittests/tst_views.h =================================================================== diff -u -r97fc44f948bd39ed0b4238558a16bf99f750bf5e -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad --- unittests/tst_views.h (.../tst_views.h) (revision 97fc44f948bd39ed0b4238558a16bf99f750bf5e) +++ unittests/tst_views.h (.../tst_views.h) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) @@ -19,7 +19,7 @@ #include // Project -#include "VCreateTreatment.h" +#include "VTreatmentCreate.h" class tst_views : public QObject { @@ -34,7 +34,7 @@ void VTreatmentAdjustmentUltrafiltrationState_text(); - void VCreateTreatment_simulate_valid_parameters(View::VCreateTreatment &view); + void VCreateTreatment_simulate_valid_parameters(View::VTreatmentCreate &view); void VCreateTreatment_validation(); void VCreateTreatment_validation_ranges(); void VCreateTreatment_save();