Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -r2216ac6ac7f77437a7c29ac8b4043be01bc4609e -r7077e38c74db9cccb5496ffefcf8936c0916de76 --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 2216ac6ac7f77437a7c29ac8b4043be01bc4609e) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) @@ -27,6 +27,11 @@ #define ADDTOLOG(vINDEX) index = vINDEX; logContent += _titles[index] + sep + _values[index] + sep + _units[index] + "\n"; +/*! + * \brief TreatmentLog::TreatmentLog + * The constructor to initial the Treatment Log + * \param parent + */ TreatmentLog::TreatmentLog(QObject *parent) : QObject(parent) { initConnections(); _treatmentLogPath = QString("%1%2") @@ -45,6 +50,11 @@ this , SLOT(onSave ())); } +/*! + * \brief TreatmentLog::initModel + * Initializing the model for the constant values. + * \param vData - the response model data. + */ void TreatmentLog::initModel(const AdjustTreatmentLogResponseData &vData) { // Formatted values @@ -56,11 +66,12 @@ QString mTreatmentDuration = QTime (0, 0).addSecs(vData.mTreatmentDuration ).toString("HH:mm"); QString mActualTreatmentDuration = QTime (0, 0).addSecs(vData.mActualTreatmentDuration ).toString("HH:mm"); - QString mTreatmentDateTime = QDateTime::fromSecsSinceEpoch ( vData.mTreatmentDateTime ).toString("yyyy/MM/dd HH:mm"); + QString mTreatmentDateTime = QDateTime::fromSecsSinceEpoch ( vData.mTreatmentDateTime ).toString("yyyy/MM/dd HH:mm"); + quint32 mHeparinConcentration = 1000; // vData.mHeparinConcentration - //// TODO: The settings needs modification not only to define the category and groups in a common header but also the settings itself needs some mods. - //// - the category shall become as part of the group - //// - the structure of the settings should become horizontal which vertical now. + // TODO : The settings needs modification not only to define the category and groups in a common header but also the settings itself needs some mods. + // - the category shall become as part of the group + // - the structure of the settings should become horizontal which vertical now. QString mAcidConcentrateType = _Settings.key("Acid Concentrate" , vData.mAcidConcentrateType ); QString mBicarbonateConcentrateType = _Settings.key("Bicarbonate Concentrate" , vData.mBicarbonateConcentrateType ); QString mDialyzerType = _Settings.key("Dialyzer Type" , vData.mDialyzerType ); @@ -88,7 +99,7 @@ _values[eDialysateTemperature ] = mStrText.arg(vData.mDialysateTemperature ,0,'f',3); _values[eDialyzerType ] = mDialyzerType ; _values[eHeparinType ] = mHeparinType ; - _values[eHeparinConcentration ] = mStrText.arg(vData.mHeparinConcentration ); + _values[eHeparinConcentration ] = mStrText.arg(mHeparinConcentration ); // Decided to be removed, but has to be here until it is actually removed from the message _values[eHeparinBolusVolume ] = mStrText.arg(vData.mHeparinBolusVolume ,0,'f',3); _values[eHeparinDispenseRate ] = mStrText.arg(vData.mHeparinDispenseRate ,0,'f',3); _values[eHeparinStop ] = mStrText.arg(vData.mHeparinStop ); @@ -110,20 +121,33 @@ } // ----- Save +/*! + * \brief TreatmentLog::doSave + * The save slot to be exposed to the UI to be able to request for save + */ void TreatmentLog::doSave() { if (_saveWatcher.isRunning()) return; isIdle(false); saveLogConcurrent(); } +/*! + * \brief TreatmentLog::saveLogConcurrent + * The treatment log save which is using a thread pool to run the save process. + */ void TreatmentLog::saveLogConcurrent() { LOG_EVENT("Save Treatment Log Started"); QFuture mFuture = QtConcurrent::run(this, &TreatmentLog::saveLog); _saveWatcher.setFuture(mFuture); } +/*! + * \brief TreatmentLog::saveLog + * The actual treatment log save function which does the save into the treatment log + * \return true on successful save and false otherwise. + */ bool TreatmentLog::saveLog() { bool ok = (unsigned)_values.count() >= eTreatmentLogIndexCount; @@ -135,22 +159,39 @@ uint index = 0; logContent += tr("Patient ID") + sep + QString("None") + "\n"; - ADDTOLOG(eBloodFlowRate); - ADDTOLOG(eDialysateFlowRate); - ADDTOLOG(eTreatmentDuration); - ADDTOLOG(eAcidConcentrateType); - ADDTOLOG(eBicarbonateConcentrateType); - ADDTOLOG(ePotassiumConcentration); - ADDTOLOG(eCalciumConcentration); - ADDTOLOG(eBicarbonateConcentration); - ADDTOLOG(eSodiumConcentration); - ADDTOLOG(eDialysateTemperature); - ADDTOLOG(eDialyzerType); - ADDTOLOG(eHeparinType); - ADDTOLOG(eHeparinConcentration); - ADDTOLOG(eHeparinBolusVolume); - ADDTOLOG(eHeparinDispenseRate); - ADDTOLOG(eHeparinStop); + ADDTOLOG( eDeviceID ); + ADDTOLOG( eBloodFlowRate ); + ADDTOLOG( eDialysateFlowRate ); + ADDTOLOG( eTreatmentDuration ); + ADDTOLOG( eActualTreatmentDuration ); + ADDTOLOG( eAcidConcentrateType ); + ADDTOLOG( eBicarbonateConcentrateType ); + ADDTOLOG( ePotassiumConcentration ); + ADDTOLOG( eCalciumConcentration ); + ADDTOLOG( eBicarbonateConcentration ); + ADDTOLOG( eSodiumConcentration ); + ADDTOLOG( eDialysateTemperature ); + ADDTOLOG( eDialyzerType ); + ADDTOLOG( eHeparinType ); + ADDTOLOG( eHeparinConcentration ); + ADDTOLOG( eHeparinBolusVolume ); + ADDTOLOG( eHeparinDispenseRate ); + ADDTOLOG( eHeparinStop ); + ADDTOLOG( eHeparinDeliveredVolume ); + ADDTOLOG( eTreatmentDateTime ); + ADDTOLOG( eWaterSampleTestResult ); + ADDTOLOG( eDialysateVolumeUsed ); + ADDTOLOG( eTargetUFVolume ); + ADDTOLOG( eActualUFVolume ); + ADDTOLOG( eTargetUFRate ); + ADDTOLOG( eActualUFRate ); + ADDTOLOG( eSalineBolusVolume ); + ADDTOLOG( eAverageBloodFlow ); + ADDTOLOG( eAverageDialysateFlow ); + ADDTOLOG( eAverageDialysateTemp ); + ADDTOLOG( eAverageArterialPressure ); + ADDTOLOG( eAverageVenousPressure ); + ADDTOLOG( eEndTreatmentEarlyAlarm ); QString mDateTime = _values[eTreatmentDateTime]; mDateTime.replace("/", "" ); // remove date separator @@ -167,27 +208,44 @@ return ok; } +/*! + * \brief TreatmentLog::onSave + * The private save slot which is called after the save process is finished saving. + */ void TreatmentLog::onSave() { LOG_EVENT(QString("Save Treatment Log Ended: %1").arg(_saveWatcher.result())); isIdle(true); } // ----- Export +/*! + * \brief TreatmentLog::doExport + * The export treatment log slot to be exposed to the UI to be able to request for the export. + */ void TreatmentLog::doExport() { if (_exportWatcher.isRunning()) return; isIdle(false); exportLogConcurrent(); } +/*! + * \brief TreatmentLog::exportLogConcurrent + * The treatment log export which is using a thread pool to run the save process. + */ void TreatmentLog::exportLogConcurrent() { LOG_EVENT("Export Treatment Log Started"); QFuture mFuture = QtConcurrent::run(this, &TreatmentLog::exportLog); _exportWatcher.setFuture(mFuture); } +/*! + * \brief TreatmentLog::exportLog + * The actual treatment log export function which does the export of the treatment log into the USB drive. + * \return + */ bool TreatmentLog::exportLog() { bool ok; @@ -197,6 +255,10 @@ return ok; } +/*! + * \brief TreatmentLog::onExport + * The private export slot which is called after the export process is finished exporting. + */ void TreatmentLog::onExport() { LOG_EVENT(QString("Export Treatment Log Ended: %1").arg(_exportWatcher.result()));