settings: Require time zone setting value for stirng

This commit is contained in:
lat9nq 2023-07-04 16:48:48 -04:00
parent 07e8477f5a
commit ff6a5031d5
4 changed files with 7 additions and 5 deletions

View File

@ -66,8 +66,8 @@ SWITCHABLE(u8, true);
Values values; Values values;
std::string GetTimeZoneString() { std::string GetTimeZoneString(TimeZone time_zone) {
const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue()); const auto time_zone_index = static_cast<std::size_t>(time_zone);
ASSERT(time_zone_index < Common::TimeZone::GetTimeZoneStrings().size()); ASSERT(time_zone_index < Common::TimeZone::GetTimeZoneStrings().size());
std::string location_name; std::string location_name;

View File

@ -516,7 +516,7 @@ bool IsFastmemEnabled();
float Volume(); float Volume();
std::string GetTimeZoneString(); std::string GetTimeZoneString(TimeZone time_zone);
void LogSettings(); void LogSettings();

View File

@ -76,7 +76,8 @@ TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
: system{system_}, location_name_cache{BuildLocationNameCache(system)} {} : system{system_}, location_name_cache{BuildLocationNameCache(system)} {}
void TimeZoneContentManager::Initialize(TimeManager& time_manager) { void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
const auto timezone_setting = Settings::GetTimeZoneString(); const auto timezone_setting =
Settings::GetTimeZoneString(Settings::values.time_zone_index.GetValue());
if (FileSys::VirtualFile vfs_file; if (FileSys::VirtualFile vfs_file;
GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) { GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) {

View File

@ -318,7 +318,8 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
{ {
{static_cast<u32>(Settings::TimeZone::Auto), {static_cast<u32>(Settings::TimeZone::Auto),
tr("Auto (%1)", "Auto select time zone") tr("Auto (%1)", "Auto select time zone")
.arg(QString::fromStdString(Settings::GetTimeZoneString()))}, .arg(QString::fromStdString(
Settings::GetTimeZoneString(Settings::TimeZone::Auto)))},
{static_cast<u32>(Settings::TimeZone::Default), {static_cast<u32>(Settings::TimeZone::Default),
tr("Default (%1)", "Default time zone") tr("Default (%1)", "Default time zone")
.arg(QString::fromStdString(Common::TimeZone::GetDefaultTimeZone()))}, .arg(QString::fromStdString(Common::TimeZone::GetDefaultTimeZone()))},