Index: sources/view/hd/alarm/VAlarmActiveList.cpp =================================================================== diff -u -re5ec01a49240a211877006f2958b1f378ebfb610 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/view/hd/alarm/VAlarmActiveList.cpp (.../VAlarmActiveList.cpp) (revision e5ec01a49240a211877006f2958b1f378ebfb610) +++ sources/view/hd/alarm/VAlarmActiveList.cpp (.../VAlarmActiveList.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,23 +1,23 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2024 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 VAlarmActiveList.cpp * \author (last) Behrouz NematiPour - * \date (last) 5/26/2021 + * \date (last) 13-Sep-2023 * \author (original) Behrouz NematiPour - * \date (original) 5/26/2021 + * \date (original) 27-May-2021 * */ #include "VAlarmActiveList.h" // Project #include "GuiController.h" +#include "Settings.h" -VIEW_DEF_CLASS_ADJUSTMENT(VAlarmActiveList) #define PROPERTY_ALARM_SET(vIndex) \ a##vIndex##ID ( vData.mAlarmID##vIndex ) ; \ @@ -32,12 +32,16 @@ a##vIndex##ID ( 0 ) ; \ a##vIndex##Text ( "" ); \ + +VIEW_DEF_CLASS_ADJUSTMENT(VAlarmActiveList) + /*! \brief Connection Initializer \details All the class signal/slot connections are defined here. */ void View::VAlarmActiveList::initConnections() { - ADJUST_VIEW_CONNECTION(AlarmActiveListRequestData ); - ACTION_VIEW_CONNECTION(AlarmActiveListResponseData); + ADJUST_VIEW_CONNECTION(AlarmActiveListRequestData ); + ACTION_VIEW_CONNECTION(AlarmActiveListResponseData ); + ACTION_VIEW_CONNECTION(SettingsData ); } /*! @@ -96,10 +100,35 @@ */ QString View::VAlarmActiveList::alarmIDText(quint32 vID) { + if ( _alarmTitles.contains(vID) ) { + return _alarmTitles[vID]; + } return Model::MAlarmStatus::toText(static_cast(vID)); } /*! + * \brief View::VAlarmActiveList::onActionReceive + * \details This function updates the list of titles for each AlarmID to be used as the text in activeAlarmList screen, + * when the settings controller is done reading the Alarms.conf and signaling this class. + * \todo This function with the same one in VAlarmStatus needs to be moved to a Controller Model structure, for a better performance and memory management. + */ +void View::VAlarmActiveList::onActionReceive(const SettingsData &) { + QString category = Storage::Settings_Category_Alarms; + QStringList groups = _Settings.groups(category); + for (const auto &group : groups) { + bool ok = true; + quint32 id = group.toInt( &ok ); + if ( ! ok ) { LOG_DEBUG(QString("Invalid Alarm List ID [%1]").arg(group)); continue; } + + for (const QString &key : _Settings.keys(category, group)) { + if (Storage::Settings::isKeyListTitle ( key ) ) { + _alarmTitles[id] = _Settings.value(category, group, key).toString(); + } + } + } +} + +/*! * \brief View::VAlarmActiveList::doRequest * \details Sends the request to get the list of active alarms */