Files
MuditaOS/module-utils/time/DateAndTimeSettings.hpp
Mateusz Grzegorzek 8f0797218f [EGD-5312] Add Time selection window
- add ChangeDateAndTimeWindow,
- extract EventTimeItem to common widgets folder
  and rename it to TimeWidget,
- extract EventDateItem to common widgets folder
  and rename it to DateWidget,
- replace timeWidget with common TimeWidget
  in NightshiftWindow,
- refactor time setting in
  DesktopMainWindow and TopBar,
- Remove dead code from EventManager
  (GetNextAlarmTimestamp and HandleAlarmTrigger)
2021-02-23 15:59:51 +01:00

46 lines
1.5 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <time/time_locale.hpp>
namespace utils
{
class DateAndTimeSettings
{
public:
[[nodiscard]] auto isAutomaticDateAndTimeOn() const noexcept -> bool
{
return automaticDateAndTimeIsOn;
}
[[nodiscard]] auto isAutomaticTimeZoneOn() const noexcept -> bool
{
return automaticTimeZoneIsOn;
}
[[nodiscard]] auto getTimeFormat() const noexcept -> time::Locale::TimeFormat
{
return timeFormat;
}
[[nodiscard]] auto getDateFormat() const noexcept -> time::Locale::DateFormat
{
return dateFormat;
}
[[nodiscard]] bool isTimeFormat12() const noexcept
{
return timeFormat == utils::time::Locale::TimeFormat::FormatTime12H;
}
void setAutomaticDateAndTimeOn(bool value);
void setAutomaticTimeZoneOn(bool value);
void setTimeFormat(time::Locale::TimeFormat format);
void setDateFormat(time::Locale::DateFormat format);
private:
bool automaticDateAndTimeIsOn = false;
bool automaticTimeZoneIsOn = false;
time::Locale::TimeFormat timeFormat = time::Locale::defaultTimeFormat;
time::Locale::DateFormat dateFormat = time::Locale::defaultDateFormat;
};
extern DateAndTimeSettings dateAndTimeSettings;
} // namespace utils