Index: leahi.pro =================================================================== diff -u -r8f4dcc80fadbccfc152b28ea09466a2ab2ee7333 -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- leahi.pro (.../leahi.pro) (revision 8f4dcc80fadbccfc152b28ea09466a2ab2ee7333) +++ leahi.pro (.../leahi.pro) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -72,6 +72,7 @@ sources/model/fp/data \ sources/model/fp/adjustment \ sources/model/fp/adjustment/settings \ + sources/model/rxmanager \ sources/view \ sources/view/td \ sources/view/td/data \ @@ -171,6 +172,7 @@ sources/model/fp/data/MFPROPumpData.h \ sources/model/fp/data/MFPTemperatureData.h \ sources/model/fp/data/MFPValvesStatesData.h \ + sources/model/rxmanager/MRxProfilesData.h \ sources/model/td/adjustment/settings/MAdjustTDSerialNumberResponse.h \ sources/model/td/adjustment/settings/MAdjustTDVersionsRequest.h \ sources/model/td/adjustment/settings/MAdjustTDVersionsResponse.h \ @@ -190,7 +192,7 @@ sources/model/td/data/treatment/MTreatmentStatesData.h \ sources/model/td/data/treatment/MTreatmentTimeData.h \ sources/model/td/data/treatment/MTreatmentUltrafiltrationData.h \ - sources/storage/RxProfiles.h \ + sources/storage/RxProfilesController.h \ sources/storage/Settings.h \ sources/storage/TreatmentLog.h \ sources/bluetooth/BluetoothInterface.h \ @@ -498,6 +500,7 @@ sources/model/fp/data/MFPROPumpData.cpp \ sources/model/fp/data/MFPTemperatureData.cpp \ sources/model/fp/data/MFPValvesStatesData.cpp \ + sources/model/rxmanager/MRxProfilesData.cpp \ sources/model/td/adjustment/settings/MAdjustTDSerialNumberResponse.cpp \ sources/model/td/adjustment/settings/MAdjustTDVersionsRequest.cpp \ sources/model/td/adjustment/settings/MAdjustTDVersionsResponse.cpp \ @@ -518,7 +521,7 @@ sources/model/td/data/treatment/MTreatmentTimeData.cpp \ sources/model/td/data/treatment/MTreatmentUltrafiltrationData.cpp \ sources/model/ui/data/MUIBloodPressureData.cpp \ - sources/storage/RxProfiles.cpp \ + sources/storage/RxProfilesController.cpp \ sources/storage/Settings.cpp \ sources/storage/TreatmentLog.cpp \ sources/view/VRxProfiles.cpp \ Index: main.cpp =================================================================== diff -u -r8f4dcc80fadbccfc152b28ea09466a2ab2ee7333 -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- main.cpp (.../main.cpp) (revision 8f4dcc80fadbccfc152b28ea09466a2ab2ee7333) +++ main.cpp (.../main.cpp) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -52,7 +52,7 @@ #include "DeviceController.h" #include "BluetoothInterface.h" #include "CloudSyncController.h" -#include "RxProfiles.h" +#include "RxProfilesController.h" #include "Settings.h" Index: sources/gui/qml/pages/ManagerStack.qml =================================================================== diff -u -ra3eef4554f2619b7b89822e776032ce8a2b4ca1e -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- sources/gui/qml/pages/ManagerStack.qml (.../ManagerStack.qml) (revision a3eef4554f2619b7b89822e776032ce8a2b4ca1e) +++ sources/gui/qml/pages/ManagerStack.qml (.../ManagerStack.qml) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -127,8 +127,10 @@ clip: true spacing: Variables.defaultMargin id: _listView - model: vRxProfiles.rxProfilesList +// model: vRxProfiles.rxProfilesList + model: vRxProfiles.rxProfiles delegate: _rxProfile + } } @@ -159,7 +161,7 @@ rightMargin: Variables.defaultMargin * 2 } Text { - text: modelData + text: profileName font.pointSize : Fonts.fontPixelButton * 1.4 width: parent.width horizontalAlignment: Text.AlignLeft @@ -171,21 +173,93 @@ anchors { left : _componentColumn.left } - property int componentWidth: parent.width / 10 - 5 - Repeater{ - model: _managerHome.treatmentFields[rxItem.index] - delegate: RxProfileComponent{ -// id: _comp1 - title : qsTr(modelData.title) - height : 370 - (100 + Variables.defaultMargin * 2) - width : parent.width / 10 - 5 - value : modelData.value - unitText : modelData.units - } - } + property int componentWidth: parent.width / 9 - 5 + RxProfileComponent{ + id: _bloodflowComp + title : "Blood Flow" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : bloodFlow + unitText : "mL/min" + } + RxProfileComponent{ + id: _diaflowComp + title : "Dialysate Flow" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : dialysateFlow + unitText : "mL/min" + } + RxProfileComponent{ + id: _txDurComp + title : "Duration" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : treatmentDuration + unitText : "min" + } + RxProfileComponent{ + id: _HeparinComp + title : "Heparin" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : heparinVolume + unitText : "mL" + } + RxProfileComponent{ + id: _ACComp + title : "Acid" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : acidConcentrate + unitText : "" + } + RxProfileComponent{ + id: _BcComp + title : "Bicarbonate" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : bicarbConcentrate + unitText : "" + } + RxProfileComponent{ + id: _DialyzerComp + title : "Dialyzer" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : dialyzertype + unitText : "" + } + RxProfileComponent{ + id: _TempComp + title : "Dialysate Temp" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : dialysateTemperature + unitText : "C" + } + RxProfileComponent{ + id: _VitalsComp + title : "Vitals Interval" + height : 370 - (100 + Variables.defaultMargin * 2) + width : parent.width / 9 - 5 + value : vitalSigns + unitText : "min" + } +// Repeater{ +// model: _managerHome.treatmentFields[rxItem.index] +// delegate: RxProfileComponent{ +//// id: _comp1 +// title : qsTr(modelData.title) +// height : 370 - (100 + Variables.defaultMargin * 2) +// width : parent.width / 10 - 5 +// value : modelData.value +// unitText : modelData.units +// } +// } } Text { - text: 'Last Modified: ' + rxItem.number + text: 'Last Modified: ' + lastModifiedDate width: parent.width // Makes it stretch horizontalAlignment: Text.AlignRight font.pointSize : Fonts.fontPixelButton @@ -200,6 +274,7 @@ if (visible) { _mainMenu.hidden = false vRxProfiles.doInitRxProfilesList() +// console.log("MEOWW", Object.keys(vRxProfiles.rxProfiles.get(0))) } else { stackView.initialItem = null Index: sources/storage/RxProfilesController.cpp =================================================================== diff -u -ra3eef4554f2619b7b89822e776032ce8a2b4ca1e -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- sources/storage/RxProfilesController.cpp (.../RxProfilesController.cpp) (revision a3eef4554f2619b7b89822e776032ce8a2b4ca1e) +++ sources/storage/RxProfilesController.cpp (.../RxProfilesController.cpp) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -327,7 +327,7 @@ for (const QFileInfo fileInfo:vRxProfileList){ vRxProfileDataList.append(initModel(fileInfo)); } - emit didRxProfileList(vRxProfileList); //TODO: change to vRxProfileDataList + emit didRxProfileList(vRxProfileDataList); //TODO: change to vRxProfileDataList } /*! Index: sources/storage/RxProfilesController.h =================================================================== diff -u -ra3eef4554f2619b7b89822e776032ce8a2b4ca1e -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- sources/storage/RxProfilesController.h (.../RxProfilesController.h) (revision a3eef4554f2619b7b89822e776032ce8a2b4ca1e) +++ sources/storage/RxProfilesController.h (.../RxProfilesController.h) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -116,7 +116,7 @@ void didNotification ( const QString &vNotification ); void didFilesList ( const QString &vRxProfileList , const QStringList &vRxProfile ); - void didRxProfileList ( const QFileInfoList &vRxProfileList ); + void didRxProfileList ( const QList &vRxProfileDataList); }; } Index: sources/view/VRxProfiles.cpp =================================================================== diff -u -ra3eef4554f2619b7b89822e776032ce8a2b4ca1e -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- sources/view/VRxProfiles.cpp (.../VRxProfiles.cpp) (revision a3eef4554f2619b7b89822e776032ce8a2b4ca1e) +++ sources/view/VRxProfiles.cpp (.../VRxProfiles.cpp) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -16,6 +16,8 @@ #include "VRxProfiles.h" // Qt +#include +#include // Project #include "ApplicationController.h" @@ -24,32 +26,85 @@ #include "MsgDefs.h" #include "TreatmentLog.h" +#include "MRxProfilesData.h" + using namespace Gui; using namespace View; using namespace Storage; -VRxProfiles::VRxProfiles(QObject *parent) : QObject(parent) +VRxProfiles::VRxProfiles(QObject *parent) : QObject(parent), +_rxProfilesModels(this) { connect (this, SIGNAL(didRxProfileList()), &_RxProfilesController, SLOT(doInitRxProfiles())); - ACTION_METHOD_BRIDGE_CONNECTION(RxProfileList, _RxProfilesController, QFileInfoList) - + ACTION_METHOD_BRIDGE_CONNECTION(RxProfileList, _RxProfilesController, QList) + QQmlEngine::setObjectOwnership(&_rxProfilesModels, QQmlEngine::CppOwnership); + _rxProfilesModels.setRoleNames({ + { eDataRole_BloodFlow , "bloodFlow" }, + { eDataRole_DialysateFlow , "dialysateFlow" }, + { eDataRole_TreatmentDuration , "treatmentDuration" }, + { eDataRole_AcidConcentrateType , "acidConcentrate" }, + { eDataRole_BicarbonateConcentrateType , "bicarbConcentrate" }, + { eDataRole_DialysateTemperature , "dialysateTemperature" }, + { eDataRole_DialyzerType , "dialyzertype" }, + { eDataRole_HeparinConcentration , "heparinConcentrate" }, + { eDataRole_HeparinBolusVolume , "heparinVolume" }, + { eDataRole_HeparinDispenseRate , "heparinDispenseRate" }, + { eDataRole_HeparinStop , "heparinStop" }, + { eDataRole_VitalSigns , "vitalSigns" }, + { eDataRole_ProfileName , "profileName" }, + { eDataRole_Favorite , "favorites" }, + { eDataRole_LastModifiedDate , "lastModifiedDate" }, + { eDataRole_RecentlyUsedDate , "recentlyUsedDate" }, + }); } - void VRxProfiles::doInitRxProfilesList() { emit didRxProfileList(); } - -void VRxProfiles::onRxProfileList(const QFileInfoList &vRxProfiles) +/** + * Converts To MListModel the List of Models + */ +void VRxProfiles::onRxProfileList(const QList &vRxProfileDataList) { - qDebug() << "-meow-" << vRxProfiles; - QStringList fileNames; - for (const QFileInfo fileInfo:vRxProfiles){ - fileNames << fileInfo.baseName().replace("_", " "); + QList> RxProfilesList; + for (const RxProfilesData &rxData : vRxProfileDataList) { + QHash hash; + + for (int i = 0; i < rxData.rxProfileContent.size(); ++i) { + hash.insert(i+Qt::UserRole, QVariant(rxData.rxProfileContent.at(i))); + } +// hash[eDataRole_BloodFlow ] = QVariant(rxData.rxProfileContent.at(eDataRole_BloodFlow )); +// hash[eDataRole_DialysateFlow ] = QVariant(rxData.rxProfileContent.at(eDataRole_DialysateFlow )); +// hash[eDataRole_TreatmentDuration ] = QVariant(rxData.rxProfileContent.at(eDataRole_TreatmentDuration )); +// hash[eDataRole_AcidConcentrateType ] = QVariant(rxData.rxProfileContent.at(eDataRole_AcidConcentrateType )); +// hash[eDataRole_BicarbonateConcentrateType ] = QVariant(rxData.rxProfileContent.at(eDataRole_BicarbonateConcentrateType )); +// hash[eDataRole_DialysateTemperature ] = QVariant(rxData.rxProfileContent.at(eDataRole_DialysateTemperature )); +// hash[eDataRole_DialyzerType ] = QVariant(rxData.rxProfileContent.at(eDataRole_DialyzerType )); +// hash[eDataRole_HeparinConcentration ] = QVariant(rxData.rxProfileContent.at(eDataRole_HeparinConcentration )); +// hash[eDataRole_HeparinBolusVolume ] = QVariant(rxData.rxProfileContent.at(eDataRole_HeparinBolusVolume )); +// hash[eDataRole_HeparinDispenseRate ] = QVariant(rxData.rxProfileContent.at(eDataRole_HeparinDispenseRate )); +// hash[eDataRole_HeparinStop ] = QVariant(rxData.rxProfileContent.at(eDataRole_HeparinStop )); +// hash[eDataRole_VitalSigns ] = QVariant(rxData.rxProfileContent.at(eDataRole_VitalSigns )); +// hash[eDataRole_ProfileName ] = QVariant(rxData.rxProfileContent.at(eDataRole_ProfileName )); +// hash[eDataRole_Favorite ] = QVariant(rxData.rxProfileContent.at(eDataRole_Favorite )); +// hash[eDataRole_LastModifiedDate ] = QVariant(rxData.rxProfileContent.at(eDataRole_LastModifiedDate )); +// hash[eDataRole_RecentlyUsedDate ] = QVariant(rxData.rxProfileContent.at(eDataRole_RecentlyUsedDate )); + + RxProfilesList.append(hash); } - rxProfilesList(fileNames); - qDebug() << _rxProfilesList; + _rxProfilesModels = RxProfilesList; } + +//void VRxProfiles::onRxProfileList(const QFileInfoList &vRxProfiles) +//{ +// qDebug() << "-meow-" << vRxProfiles; +// QStringList fileNames; +// for (const QFileInfo fileInfo:vRxProfiles){ +// fileNames << fileInfo.baseName().replace("_", " "); +// } +// rxProfilesList(fileNames); +// qDebug() << _rxProfilesList; +//} Index: sources/view/VRxProfiles.h =================================================================== diff -u -ra3eef4554f2619b7b89822e776032ce8a2b4ca1e -r1f927e37764a81fb6538b5cf7a74d8beacf56aac --- sources/view/VRxProfiles.h (.../VRxProfiles.h) (revision a3eef4554f2619b7b89822e776032ce8a2b4ca1e) +++ sources/view/VRxProfiles.h (.../VRxProfiles.h) (revision 1f927e37764a81fb6538b5cf7a74d8beacf56aac) @@ -26,6 +26,7 @@ #include "StorageGlobals.h" #include "VView.h" #include "MListModel.h" +#include "MRxProfilesData.h" // forward declaration class tst_views; @@ -47,19 +48,42 @@ PROPERTY(QStringList , rxProfilesList , {}) -// Q_PROPERTY(MListModel* rxProfiles READ rxProfiles NOTIFY alarm_AlarmIDChanged) - + Q_PROPERTY(MListModel* rxProfiles READ rxProfiles CONSTANT) VIEW_DEC_CLASS(VRxProfiles) + + +public: + + enum { + eDataRole_BloodFlow = Qt::UserRole , + eDataRole_DialysateFlow , + eDataRole_TreatmentDuration , + eDataRole_AcidConcentrateType , + eDataRole_BicarbonateConcentrateType , + eDataRole_DialysateTemperature , + eDataRole_DialyzerType , + eDataRole_HeparinConcentration , + eDataRole_HeparinBolusVolume , + eDataRole_HeparinDispenseRate , + eDataRole_HeparinStop , + eDataRole_VitalSigns , + eDataRole_ProfileName , + eDataRole_Favorite , + eDataRole_LastModifiedDate , + eDataRole_RecentlyUsedDate , + } DataRole; + + private: -// MListModel* rxProfiles () { return &_rxProfilesModel; } ; -// MListModel _rxProfilesModel; + MListModel* rxProfiles () { return &_rxProfilesModels; } + MListModel _rxProfilesModels; signals: void didRxProfileList(); private slots: - void onRxProfileList(const QFileInfoList &vRxProfiles); + void onRxProfileList(const QList &vRxProfileDataList); public slots: