/*! * * 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 vtreatmentultrafiltrationstate.cpp * \date 5/20/2020 * \author Behrouz NematiPour * */ #include "vtreatmentultrafiltrationstate.h" // Project #include "guicontroller.h" VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentUltrafiltrationState, TreatmentUltrafiltrationStateData) void VTreatmentUltrafiltrationState::initConnections() { ACTION_RECEIVE_BRIDGE_CONNECTION(Gui::_GuiController, TreatmentUltrafiltrationStateData); connect(this , SIGNAL(didUltrafiltrationStateRequest(quint32)), &_GuiController, SLOT( doUltrafiltrationStateRequest(quint32))); } void VTreatmentUltrafiltrationState::onActionReceive(const TreatmentUltrafiltrationStateData &vData) { adjustment_Accepted ( vData.mAccepted ); if (adjustment_Accepted()) { isPaused ( _requestedState == GuiActionData::Pause); } // *** has to be the last to let the information to be set and then emit the signal *** // *** otherwise will use the previous values before being set. *** adjustment ( true ); } void View::VTreatmentUltrafiltrationState::doPause() { _requestedState = GuiActionData::Pause; emit didUltrafiltrationStateRequest(static_cast(_requestedState)); } void View::VTreatmentUltrafiltrationState::doResume() { _requestedState = GuiActionData::Resume; emit didUltrafiltrationStateRequest(static_cast(_requestedState)); } /*! * \brief View::VTreatmentUltrafiltrationState::text * \details The slot to ge the Reason Description * \return Reason description as string * \note The ultrafiltration state (Resume/Pause) change has no returned reason code and it's only bool. */ QString View::VTreatmentUltrafiltrationState::text() { QString mText = VTreatmentAdjustmentsResponse::text(); if (! mText.isEmpty()) return mText; if (! adjustment_Accepted()) { switch (_requestedState) { case GuiActionData::Resume: mText = tr("Unable to Resume Ultrafiltration or already running"); break; case GuiActionData::Pause: mText = tr("Unable to Pause Ultrafiltration or already paused"); break; default: break; } } return mText; }