M module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp => module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp +4 -4
@@ 296,14 296,14 @@ namespace gui
period == Period::AM ? fmt->set_value(utils::time::Locale::getAM())
: fmt->set_value(utils::time::Locale::getPM());
}
- auto TimeSetFmtSpinner::getHour24Format() const noexcept -> std::chrono::hours
+ auto TimeSetFmtSpinner::getHour24Format() const noexcept -> int
{
using namespace utils::time;
if (timeFormat == Locale::TimeFormat::FormatTime24H) {
- return std::chrono::hours{timeSetSpinner->getHour()};
+ return timeSetSpinner->getHour();
}
-
- return date::make24(std::chrono::hours{timeSetSpinner->getHour()}, isPM());
+ auto hours = std::chrono::hours(timeSetSpinner->getHour());
+ return date::make24(hours, isPM()).count();
}
} // namespace gui
M module-apps/apps-common/widgets/TimeSetFmtSpinner.hpp => module-apps/apps-common/widgets/TimeSetFmtSpinner.hpp +1 -1
@@ 52,7 52,7 @@ namespace gui
[[nodiscard]] auto getTime() const noexcept -> std::time_t;
[[nodiscard]] auto getHour() const noexcept -> int;
/// Always returns current hour in 24-hour format, even if the currently set format is set to 12-hour clock.
- [[nodiscard]] auto getHour24Format() const noexcept -> std::chrono::hours;
+ [[nodiscard]] auto getHour24Format() const noexcept -> int;
[[nodiscard]] auto getMinute() const noexcept -> int;
[[nodiscard]] auto isPM() const noexcept -> bool;
M products/BellHybrid/apps/application-bell-settings/models/DateTimeUnitsModel.cpp => products/BellHybrid/apps/application-bell-settings/models/DateTimeUnitsModel.cpp +5 -4
@@ 62,7 62,7 @@ namespace app::bell_settings
timeSetListItem =
new gui::TimeSetListItem(0U, 0U, 0, 0, utils::translate("app_bell_settings_time_units_time_message"));
internalData.push_back(timeSetListItem);
- timeSetListItem->getTimeFormat = [this](void) { return timeFmtSetListItem->getTimeFmt(); };
+ timeSetListItem->getTimeFormat = [this]() { return timeFmtSetListItem->getTimeFmt(); };
timeFmtSetListItem = new gui::TimeFormatSetListItem(
0, 0, 0, 0, utils::translate("app_bell_settings_time_units_time_fmt_top_message"));
@@ 107,7 107,7 @@ namespace app::bell_settings
const auto year = date.year().operator int();
const auto month = static_cast<int>(date.month().operator unsigned int());
const auto day = static_cast<int>(date.day().operator unsigned int());
- const auto hour = timeSetListItem->timeSetSpinner->getHour();
+ const auto hour = timeSetListItem->timeSetSpinner->getHour24Format();
const auto minute = timeSetListItem->timeSetSpinner->getMinute();
const auto timeFormat = timeFmtSetListItem->getTimeFmt();
const auto dateFormat = dateFmtSetListItem->getDateFmt();
@@ 133,8 133,8 @@ namespace app::bell_settings
const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto timeFormat = stm::api::timeFormat();
const auto dateFormat = stm::api::dateFormat();
- timeSetListItem->timeSetSpinner->setTime(now);
timeSetListItem->timeSetSpinner->setTimeFormat(timeFormat);
+ timeSetListItem->timeSetSpinner->setTime(now);
yearSetListItem->dateSetSpinner->setDate(
date::year_month_day{date::floor<date::days>(std::chrono::system_clock::now())});
@@ 191,12 191,13 @@ namespace app::bell_settings
{
using namespace date::literals;
- /// Default date/time after factory reset: 2023/01/01 12:00PM
+ /// Default date/time after factory reset: 2023/01/01 12:00 (in 24h format)
const auto factoryResetDate = 2023_y / jan / 1_d;
const auto factoryResetTimeFmt = utils::time::Locale::TimeFormat::FormatTime24H;
const auto factoryResetDateFmt = utils::time::Locale::DateFormat::DD_MM_YYYY;
yearSetListItem->dateSetSpinner->setDate(factoryResetDate);
+ timeSetListItem->timeSetSpinner->setTimeFormat(factoryResetTimeFmt);
timeSetListItem->timeSetSpinner->setHour(12);
timeSetListItem->timeSetSpinner->setMinute(0);
timeFmtSetListItem->setTimeFmt(factoryResetTimeFmt);
M products/BellHybrid/apps/application-bell-settings/widgets/TimeSetListItem.cpp => products/BellHybrid/apps/application-bell-settings/widgets/TimeSetListItem.cpp +1 -0
@@ 35,6 35,7 @@ namespace gui
focusChangedCallback = [&](Item &item) {
if (getTimeFormat != nullptr) {
timeSetSpinner->setTimeFormat(getTimeFormat());
+ body->resizeItems();
}
setFocusItem(focus ? body : nullptr);
return true;