diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/platform/posix/PosixTimezone.h | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/platform/posix/PosixTimezone.h')
-rw-r--r-- | xbmc/platform/posix/PosixTimezone.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/xbmc/platform/posix/PosixTimezone.h b/xbmc/platform/posix/PosixTimezone.h new file mode 100644 index 0000000..076e87f --- /dev/null +++ b/xbmc/platform/posix/PosixTimezone.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2005-2018 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#include "settings/lib/ISettingCallback.h" +#include "settings/lib/ISettingsHandler.h" + +#include <map> +#include <string> +#include <vector> + +class CSetting; +struct StringSettingOption; + +class CPosixTimezone : public ISettingCallback, public ISettingsHandler +{ +public: + CPosixTimezone(); + + void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override; + + void OnSettingsLoaded() override; + + std::string GetOSConfiguredTimezone(); + + std::vector<std::string> GetCounties(); + std::vector<std::string> GetTimezonesByCountry(const std::string& country); + std::string GetCountryByTimezone(const std::string& timezone); + + void SetTimezone(const std::string& timezone); + int m_IsDST = 0; + + static void SettingOptionsTimezoneCountriesFiller(const std::shared_ptr<const CSetting>& setting, + std::vector<StringSettingOption>& list, + std::string& current, + void* data); + static void SettingOptionsTimezonesFiller(const std::shared_ptr<const CSetting>& setting, + std::vector<StringSettingOption>& list, + std::string& current, + void* data); + +private: + std::vector<std::string> m_counties; + std::map<std::string, std::string> m_countryByCode; + std::map<std::string, std::string> m_countryByName; + + std::map<std::string, std::vector<std::string> > m_timezonesByCountryCode; + std::map<std::string, std::string> m_countriesByTimezoneName; +}; + +extern CPosixTimezone g_timezone; + |