Index: sources/view/settings/VHDUsageInfo.cpp =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r17f5bc42d292b6b0b4e326d6f3042c217f3166b2 --- sources/view/settings/VHDUsageInfo.cpp (.../VHDUsageInfo.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/view/settings/VHDUsageInfo.cpp (.../VHDUsageInfo.cpp) (revision 17f5bc42d292b6b0b4e326d6f3042c217f3166b2) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file VHDUsageInfo.cpp - * \author (last) Behrouz NematiPour - * \date (last) 11-Sep-2023 + * \author (last) Dara Navaei + * \date (last) 23-Sep-2024 * \author (original) Vy * \date (original) 08-Sep-2023 * @@ -24,6 +24,7 @@ void View::VHDUsageInfo::initConnections() { ADJUST_VIEW_CONNECTION( HDUsageInfoRequestData) ACTION_VIEW_CONNECTION(HDUsageInfoResponseData) + ACTION_VIEW_CONNECTION(SettingsData) } /*! @@ -33,21 +34,23 @@ */ void View::VHDUsageInfo::onActionReceive(const HDUsageInfoResponseData &vData) { - - int hours = vData.mTotalTxHours; - int minutes = (vData.mTotalTxHours - hours) * 60; - QString timeFormatted = QString("%1:%2").arg(hours).arg(minutes); + // Format the time in hours to be only one decimal point. + // In .arg(), the second field is the field width + // The third field is the number notation so 'f' in this case means no scientific notation + // The fourth field is the number of decimal places which 1 decimal is needed here. + QString timeFormatted = QString("%1").arg(vData.mTotalTxHours, 0, 'f', 0); totalTxHours(timeFormatted); - hours = vData.mTotalTxHoursSinceLastService; - minutes = (vData.mTotalTxHoursSinceLastService - hours) * 60; - timeFormatted = QString("%1:%2").arg(hours).arg(minutes); + timeFormatted = QString("%1").arg(vData.mTotalTxHoursSinceLastService, 0, 'f', 0); totalTxHoursSinceLastService(timeFormatted); + epochOfStartOfLastTx (Format::fromEpoch(vData.mEpochOfStartOfLastTx, _dateFormat)); - epochOfStartOfLastTx (vData.mEpochOfStartOfLastTx ? QString("%1").arg(vData.mEpochOfStartOfLastTx ) : "" ); - epochOfLastRecordReset (vData.mEpochOfLastRecordReset ? QString("%1").arg(vData.mEpochOfLastRecordReset) : "" ); - // *** 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::VHDUsageInfo::onActionReceive(const SettingsData &) +{ + _dateFormat = _Settings.dateFormat(); +}