/*! * * Copyright (c) 2023-2023 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 VDuetRoWaterDG.cpp * \author (last) Behrouz NematiPour * \date (last) 05-Apr-2023 * \author (original) Behrouz NematiPour * \date (original) 03-Apr-2023 * */ #include "VDuetRoWaterDG.h" // Project #include "GuiController.h" VIEW_DEF_CLASS_ADJUSTMENT(VDuetRoWaterDG) /*! * \brief Connection Initializer * \details All the class signal/slot connections are defined here. */ void View::VDuetRoWaterDG::initConnections() { ADJUST_VIEW_CONNECTION(DuetRoWaterModeUIiData) ACTION_VIEW_CONNECTION(DuetRoWaterModeDGrData) ACTION_VIEW_CONNECTION(SettingsData) ACTION_VIEW_CONNECTION(DuetRoWaterStatDGqData) } void View::VDuetRoWaterDG::onActionReceive(const DuetRoWaterStatDGqData & ) // 0xC300 : 195 { _post = true; doAdjustment( _status ); } void View::VDuetRoWaterDG::onActionReceive(const DuetRoWaterModeDGrData &vData) // 0xC400 : 196 { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); if (vData.mAccepted) { status( _data.mStatus ); // apply the request notification(""); } else { if ( _post ) { status( ! _status ); // on post what UI currently has, is rejected, so UI should change to opposite. _post = false; } else { status( _status ); // use the old value to emit signal for UI } notification(tr("The RO Water Mode change request has been rejected [%1]").arg(vData.mReason)); } // *** 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::VDuetRoWaterDG::doAdjustment(bool vStatus) // 0xBC00 : 188 { _data.mStatus = vStatus ? 1 : 0; emit didAdjustment(_data); } /*! * \brief VDuetRoWaterDG::onSettingsDone * \details fills the items below, read from the settings file, when the reading is notified done by ApplicationController. * acidConcentrateOptions */ void View::VDuetRoWaterDG::onActionReceive(const SettingsData &) { _post = true; QString mCategory = Storage::Settings_Category_SettingsSystem; FROMVARIANT( status, "RoWaterMode", "RoWaterMode", UInt ); //POST// doAdjustment(_status); }