Index: sources/view/settings/VDateTime.cpp =================================================================== diff -u -r1c18f738693756ca1f0342c2cc158e32bc28f90b -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/view/settings/VDateTime.cpp (.../VDateTime.cpp) (revision 1c18f738693756ca1f0342c2cc158e32bc28f90b) +++ sources/view/settings/VDateTime.cpp (.../VDateTime.cpp) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,24 +1,25 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-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 VDateTime.cpp - * \author (last) Peter Lucia - * \date (last) 16-Apr-2021 - * \author (original) Peter Lucia + * \author (last) Behrouz NematiPour + * \date (last) 08-Jun-2022 + * \author (original) Behrouz NematiPour * \date (original) 16-Apr-2021 * */ #include "VDateTime.h" // Qt -#include +#include // Project #include "GuiController.h" +#include "ApplicationController.h" using namespace View; @@ -53,6 +54,8 @@ month (_currentTime.toString("MM" )); year (_currentTime.toString("yyyy" )); + timezone(QTimeZone::systemTimeZone().abbreviation(_currentTime)); + status(""); } @@ -175,7 +178,7 @@ void VDateTime::dateTimeUI(const QString &vDateTime) { if ( _process.state() != QProcess::NotRunning ) { return; } - QString mScript = Storage::Scripts_Path_Name; + QString mScript = Storage::Scripts_Path_Name(); mScript += Storage::Date_Time_Set_Sh; _process.start(mScript, QStringList() << vDateTime); } @@ -195,13 +198,12 @@ switch (vStatus) { case SUCCEED: return mSucceed; - break; + case FAILED: return mFailed.arg(vReason); - break; + default: return mNotSet; - break; } } @@ -215,15 +217,33 @@ .arg(status(_acceptHD, _reasonHD)) .arg(status(_acceptDG, _reasonDG)) .arg(status(_acceptUI, _reasonUI)) - ); + ); } /*! + * \brief VDateTime::greeting + * \details sets the greeting property string to be used on the standby/home screen regarding the device's current time of the day. + * \param vMilitaryTime + */ +void VDateTime::greeting(quint16 vMilitaryTime) +{ + if ( eMorningMin /* 05:00 AM */ <= vMilitaryTime && vMilitaryTime < eMorningMax /* 12:00 PM */ ) { greeting(tr("Good Morning" )); return; } + if ( eAfternoonMin /* 12:00 PM */ <= vMilitaryTime && vMilitaryTime < eAfternoonMax /* 18:00 PM */ ) { greeting(tr("Good Afternoon")); return; } + /* 18:00 PM */ /* 05:00 AM */ greeting(tr("Good Evening" )); +} + +/*! * \brief VDateTime::timerEvent * \details The overloaded member function of the QObject to send the current date/time to the UI. * \note The interval has been set in _timerInterval as 1000 ms (1sec). */ void VDateTime::timerEvent(QTimerEvent *) { - current(QDateTime::currentDateTime().toString("MM/dd/yyyy HH:mm:ss")); + _currentDateTime = QDateTime::currentDateTime(); + + current (_currentDateTime.toString(_Settings.getDatetimeFormat())); + timezone(QTimeZone::systemTimeZone().abbreviation(_currentDateTime)); + + quint16 military = _currentDateTime.time().hour() * 100 + _currentDateTime.time().minute(); + greeting(military); }