mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-28 22:01:59 +00:00
FullscreenUI: Fix remaining fixed date/time formatting locations
This commit is contained in:
parent
29e92705c4
commit
44237146ef
@ -41,7 +41,6 @@
|
||||
#include "IconsEmoji.h"
|
||||
#include "IconsFontAwesome6.h"
|
||||
#include "IconsPromptFont.h"
|
||||
#include "fmt/chrono.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
@ -249,6 +248,7 @@ static GPUTexture* GetUserThemeableTexture(
|
||||
const ImVec2& svg_size = LayoutScale(LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE, LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE));
|
||||
static bool UserThemeableHorizontalButton(const std::string_view png_name, const std::string_view svg_name,
|
||||
std::string_view title, std::string_view description);
|
||||
static void UpdateCurrentTimeString();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Landing
|
||||
@ -536,6 +536,10 @@ struct ALIGN_TO_CACHE_LINE UIState
|
||||
float transition_total_time = 0.0f;
|
||||
float transition_remaining_time = 0.0f;
|
||||
|
||||
// Pause Menu
|
||||
std::time_t current_time = 0;
|
||||
std::string current_time_string;
|
||||
|
||||
// Settings
|
||||
float settings_last_bg_alpha = 1.0f;
|
||||
SettingsPage settings_page = SettingsPage::Interface;
|
||||
@ -1186,6 +1190,8 @@ void FullscreenUI::Shutdown(bool clear_state)
|
||||
s_state.fullscreen_mode_list_cache = {};
|
||||
s_state.graphics_adapter_list_cache = {};
|
||||
s_state.hotkey_list_cache = {};
|
||||
s_state.current_time_string = {};
|
||||
s_state.current_time = 0;
|
||||
}
|
||||
|
||||
DestroyResources();
|
||||
@ -1400,6 +1406,17 @@ bool FullscreenUI::UserThemeableHorizontalButton(const std::string_view png_name
|
||||
is_colorable ? ImGui::GetColorU32(ImGuiCol_Text) : IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
void FullscreenUI::UpdateCurrentTimeString()
|
||||
{
|
||||
const std::time_t current_time = std::time(nullptr);
|
||||
if (s_state.current_time == current_time)
|
||||
return;
|
||||
|
||||
s_state.current_time = current_time;
|
||||
s_state.current_time_string = {};
|
||||
s_state.current_time_string = Host::FormatNumber(Host::NumberFormatType::ShortTime, static_cast<s64>(current_time));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Utility
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -2085,14 +2102,15 @@ void FullscreenUI::DrawLandingTemplate(ImVec2* menu_pos, ImVec2* menu_size)
|
||||
// draw time
|
||||
ImVec2 time_pos;
|
||||
{
|
||||
heading_str.format(FSUI_FSTR("{:%H:%M}"), fmt::localtime(std::time(nullptr)));
|
||||
UpdateCurrentTimeString();
|
||||
|
||||
const ImVec2 time_size =
|
||||
heading_font->CalcTextSizeA(heading_font_size, heading_font_weight, FLT_MAX, 0.0f, "00:00");
|
||||
const ImVec2 time_size = heading_font->CalcTextSizeA(heading_font_size, heading_font_weight, FLT_MAX, 0.0f,
|
||||
IMSTR_START_END(s_state.current_time_string));
|
||||
time_pos = ImVec2(heading_size.x - LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING) - time_size.x,
|
||||
LayoutScale(LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGuiFullscreen::RenderShadowedTextClipped(heading_font, heading_font_size, heading_font_weight, time_pos,
|
||||
time_pos + time_size, text_color, heading_str, &time_size);
|
||||
time_pos + time_size, text_color, s_state.current_time_string,
|
||||
&time_size);
|
||||
}
|
||||
|
||||
// draw achievements info
|
||||
@ -6439,11 +6457,9 @@ void FullscreenUI::DrawAchievementsSettingsPage(std::unique_lock<std::mutex>& se
|
||||
|
||||
if (bsi->ContainsValue("Cheevos", "Token"))
|
||||
{
|
||||
TinyString ts_string;
|
||||
ts_string.format(
|
||||
FSUI_FSTR("{:%Y-%m-%d %H:%M:%S}"),
|
||||
fmt::localtime(
|
||||
StringUtil::FromChars<u64>(bsi->GetTinyStringValue("Cheevos", "LoginTimestamp", "0")).value_or(0)));
|
||||
const std::string ts_string = Host::FormatNumber(
|
||||
Host::NumberFormatType::LongDateTime,
|
||||
StringUtil::FromChars<s64>(bsi->GetTinyStringValue("Cheevos", "LoginTimestamp", "0")).value_or(0));
|
||||
MenuButtonWithoutSummary(
|
||||
SmallString::from_format(fmt::runtime(FSUI_ICONVSTR(ICON_FA_CLOCK, "Login token generated on {}")), ts_string),
|
||||
false);
|
||||
@ -6994,13 +7010,13 @@ void FullscreenUI::DrawPauseMenu()
|
||||
display_size, text_color, buffer);
|
||||
|
||||
// current time / play time
|
||||
buffer.format("{:%X}", fmt::localtime(std::time(nullptr)));
|
||||
UpdateCurrentTimeString();
|
||||
|
||||
ImVec2 text_size = UIStyle.Font->CalcTextSizeA(UIStyle.LargeFontSize, UIStyle.BoldFontWeight,
|
||||
std::numeric_limits<float>::max(), -1.0f, IMSTR_START_END(buffer));
|
||||
text_pos = ImVec2(display_size.x - scaled_top_bar_padding - text_size.x, scaled_top_bar_padding);
|
||||
RenderShadowedTextClipped(dl, UIStyle.Font, UIStyle.LargeFontSize, UIStyle.BoldFontWeight, text_pos, display_size,
|
||||
title_text_color, buffer);
|
||||
title_text_color, s_state.current_time_string);
|
||||
text_pos.y += UIStyle.LargeFontSize + scaled_text_spacing;
|
||||
|
||||
if (!game_serial.empty())
|
||||
@ -7224,7 +7240,8 @@ bool FullscreenUI::InitializeSaveStateListEntryFromPath(SaveStateListEntry* li,
|
||||
li->title = (slot > 0) ? fmt::format(FSUI_FSTR("Game Slot {0}##game_slot_{0}"), slot) : FSUI_STR("Game Quick Save");
|
||||
}
|
||||
|
||||
li->summary = fmt::format(FSUI_FSTR("Saved {:%c}"), fmt::localtime(ssi->timestamp));
|
||||
li->summary = fmt::format(
|
||||
FSUI_FSTR("Saved {}"), Host::FormatNumber(Host::NumberFormatType::ShortDateTime, static_cast<s64>(ssi->timestamp)));
|
||||
li->timestamp = ssi->timestamp;
|
||||
li->slot = slot;
|
||||
li->state_path = std::move(path);
|
||||
@ -7643,8 +7660,8 @@ void FullscreenUI::DrawResumeStateSelector()
|
||||
SaveStateListEntry& entry = s_state.save_state_selector_slots.front();
|
||||
|
||||
SmallString sick;
|
||||
sick.format(FSUI_FSTR("Do you want to continue from the automatic save created at {:%c}?"),
|
||||
fmt::localtime(entry.timestamp));
|
||||
sick.format(FSUI_FSTR("Do you want to continue from the automatic save created at {}?"),
|
||||
Host::FormatNumber(Host::NumberFormatType::LongDateTime, static_cast<s64>(entry.timestamp)));
|
||||
ImGui::PushFont(nullptr, 0.0f, UIStyle.BoldFontWeight);
|
||||
ImGuiFullscreen::TextAlignedMultiLine(0.5f, IMSTR_START_END(sick));
|
||||
ImGui::PopFont();
|
||||
@ -9566,7 +9583,7 @@ TRANSLATE_NOOP("FullscreenUI", "Displays only the game title in the list, instea
|
||||
TRANSLATE_NOOP("FullscreenUI", "Displays popup messages on events such as achievement unlocks and leaderboard submissions.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Displays popup messages when starting, submitting, or failing a leaderboard challenge.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Dithering");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Do you want to continue from the automatic save created at {:%c}?");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Do you want to continue from the automatic save created at {}?");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Double-Click Toggles Fullscreen");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Download Covers");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Downloads covers from a user-specified URL template.");
|
||||
@ -9901,7 +9918,7 @@ TRANSLATE_NOOP("FullscreenUI", "Save State");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Save State Compression");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Save State On Shutdown");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Save as Serial File Names");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Saved {:%c}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Saved {}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Saves state periodically so you can rewind any mistakes while playing.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Scaled Interlacing");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Scales line skipping in interlaced rendering to the internal resolution, making it less noticeable. Usually safe to enable.");
|
||||
@ -10108,8 +10125,6 @@ TRANSLATE_NOOP("FullscreenUI", "\"PlayStation\" and \"PSX\" are registered trade
|
||||
TRANSLATE_NOOP("FullscreenUI", "change disc");
|
||||
TRANSLATE_NOOP("FullscreenUI", "reset");
|
||||
TRANSLATE_NOOP("FullscreenUI", "shut down");
|
||||
TRANSLATE_NOOP("FullscreenUI", "{:%H:%M}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "{:%Y-%m-%d %H:%M:%S}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "{} Frames");
|
||||
TRANSLATE_NOOP("FullscreenUI", "{} deleted.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "{} does not exist.");
|
||||
|
@ -8067,7 +8067,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7190"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -6879,8 +6879,8 @@ Se eliminarán todas las asignaciones y configuraciones. Esta acción no puede d
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9560"/>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation>¿Deseas retomar el guardado automático creado el: {:%c}?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation>¿Deseas retomar el guardado automático creado el: {}?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9561"/>
|
||||
@ -9175,8 +9175,8 @@ Comprueba tu nombre de usuario y contraseña y vuelve a intentarlo.</translation
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9895"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Archivo guardado: {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Archivo guardado: {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9896"/>
|
||||
|
@ -9162,8 +9162,8 @@ Comprueba el nombre de usuario y contraseña e intenta de nuevo.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9249"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Guardado {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Guardado {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9250"/>
|
||||
|
@ -8094,7 +8094,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7190"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -8059,7 +8059,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7190"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -7220,7 +7220,7 @@ Please check your username and password, and try again.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9632"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -8615,8 +8615,8 @@ L'errore è:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7408"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Salvato {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Salvato {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saves screenshots at internal render resolution and without postprocessing.</source>
|
||||
|
@ -9041,7 +9041,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7602"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -8298,8 +8298,8 @@ Please check your username and password, and try again.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9512"/>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation>{:%c}에 생성된 자동 저장을 계속 진행하시겠습니까?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation>{}에 생성된 자동 저장을 계속 진행하시겠습니까?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9521"/>
|
||||
@ -9485,8 +9485,8 @@ Please check your username and password, and try again.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9840"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>{:%c} 저장</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>{} 저장</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9841"/>
|
||||
|
@ -8066,7 +8066,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7190"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -7811,8 +7811,8 @@ Spowodowany błąd:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7651"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Zapisano {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Zapisano {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7652"/>
|
||||
|
@ -8641,8 +8641,8 @@ Por favor verifique seu nome de usuário e senha, e tente novamente.</translatio
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9512"/>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation>Deseja continuar a partir do salvamento automático criado em {:%c}?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation>Deseja continuar a partir do salvamento automático criado em {}?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9521"/>
|
||||
@ -9982,8 +9982,8 @@ Por favor verifique seu nome de usuário e senha, e tente novamente.</translatio
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9840"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Salvo {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Salvo {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9841"/>
|
||||
|
@ -8065,7 +8065,7 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="7190"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -6924,8 +6924,8 @@ You cannot undo this action.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9584"/>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation type="unfinished">Хотите ли вы продолжить с автоматического сохранения, созданного в {:%c}?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation type="unfinished">Хотите ли вы продолжить с автоматического сохранения, созданного в {}?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9585"/>
|
||||
@ -9231,8 +9231,8 @@ Please check your username and password, and try again.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9917"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation type="unfinished">Сохранен {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation type="unfinished">Сохранен {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9918"/>
|
||||
|
@ -6803,8 +6803,8 @@ Kontrollera ditt användarnamn och lösenord. Försök igen.</translation>
|
||||
<translation type="vanished">Spara tillstånd vid avslut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Sparat {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Sparat {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saves state periodically so you can rewind any mistakes while playing.</source>
|
||||
@ -7719,8 +7719,8 @@ Du kan inte ångra den här åtgärden.</translation>
|
||||
<translation>Standardvärde</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation>Vill du fortsätta från den automatiska sparning som skapades vid {:%c}?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation>Vill du fortsätta från den automatiska sparning som skapades vid {}?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable Achievements to see your user summary.</source>
|
||||
|
@ -9641,8 +9641,8 @@ Hata: {}
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9632"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>Kaydedildi {:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>Kaydedildi {}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9633"/>
|
||||
|
@ -7218,8 +7218,8 @@ You cannot undo this action.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9505"/>
|
||||
<source>Do you want to continue from the automatic save created at {:%c}?</source>
|
||||
<translation>您想要从创建于{:%c}的自动保存中继续吗?</translation>
|
||||
<source>Do you want to continue from the automatic save created at {}?</source>
|
||||
<translation>您想要从创建于{}的自动保存中继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9512"/>
|
||||
@ -8556,8 +8556,8 @@ Error was:</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9831"/>
|
||||
<source>Saved {:%c}</source>
|
||||
<translation>保存{:%c}</translation>
|
||||
<source>Saved {}</source>
|
||||
<translation>保存{}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../core/fullscreen_ui.cpp" line="9282"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user