Skip to content

Commit

Permalink
Misc: Normalize OSD message keys
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Sep 18, 2024
1 parent 57f4737 commit 140c4ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/core/analog_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void AnalogController::SetAnalogMode(bool enabled, bool show_message)
if (show_message)
{
Host::AddIconOSDMessage(
fmt::format("analog_mode_toggle_{}", m_index), ICON_PF_GAMEPAD_ALT,
fmt::format("Controller{}AnalogMode", m_index), ICON_PF_GAMEPAD_ALT,
enabled ? fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to analog mode."), m_index + 1u) :
fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to digital mode."), m_index + 1u));
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/negcon_rumble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void NeGconRumble::SetAnalogMode(bool enabled, bool show_message)
if (show_message)
{
Host::AddIconOSDMessage(
fmt::format("analog_mode_toggle_{}", m_index), ICON_FA_GAMEPAD,
fmt::format("Controller{}AnalogMode", m_index), ICON_FA_GAMEPAD,
enabled ? fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to analog mode."), m_index + 1u) :
fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to digital mode."), m_index + 1u));
}
Expand Down
22 changes: 11 additions & 11 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ void System::ResetSystem()

ResetPerformanceCounters();
ResetThrottler();
Host::AddIconOSDMessage("system_reset", ICON_FA_POWER_OFF, TRANSLATE_STR("OSDMessage", "System reset."),
Host::AddIconOSDMessage("SystemReset", ICON_FA_POWER_OFF, TRANSLATE_STR("OSDMessage", "System reset."),
Host::OSD_QUICK_DURATION);

InterruptExecution();
Expand Down Expand Up @@ -2475,7 +2475,7 @@ bool System::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di
g_settings.cpu_overclock_denominator != cpu_overclock_denominator))))
{
Host::AddIconOSDMessage(
"state_overclock_difference", ICON_FA_EXCLAMATION_TRIANGLE,
"StateOverclockDifference", ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "WARNING: CPU overclock ({}%) was different in save state ({}%)."),
g_settings.cpu_overclock_enable ? g_settings.GetCPUOverclockPercent() : 100u,
cpu_overclock_active ?
Expand Down Expand Up @@ -2633,7 +2633,7 @@ bool System::LoadState(const char* path, Error* error, bool save_undo_state)
INFO_LOG("Loading state from '{}'...", path);

Host::AddIconOSDMessage(
"load_state", ICON_EMOJI_OPEN_THE_FOLDER,
"LoadState", ICON_EMOJI_OPEN_THE_FOLDER,
fmt::format(TRANSLATE_FS("OSDMessage", "Loading state from '{}'..."), Path::GetFileName(path)),
Host::OSD_INFO_DURATION);

Expand Down Expand Up @@ -4175,7 +4175,7 @@ bool System::SwitchMediaSubImage(u32 index)
Error error;
if (!image->SwitchSubImage(index, &error))
{
Host::AddIconOSDMessage("media_switch_subimage", ICON_FA_COMPACT_DISC,
Host::AddIconOSDMessage("MediaSwitchSubImage", ICON_FA_COMPACT_DISC,
fmt::format(TRANSLATE_FS("System", "Failed to switch to subimage {} in '{}': {}."),
index + 1u, Path::GetFileName(image->GetFileName()), error.GetDescription()),
Host::OSD_INFO_DURATION);
Expand All @@ -4185,7 +4185,7 @@ bool System::SwitchMediaSubImage(u32 index)
return false;
}

Host::AddIconOSDMessage("media_switch_subimage", ICON_FA_COMPACT_DISC,
Host::AddIconOSDMessage("MediaSwitchSubImage", ICON_FA_COMPACT_DISC,
fmt::format(TRANSLATE_FS("System", "Switched to sub-image {} ({}) in '{}'."),
image->GetSubImageMetadata(index, "title"), index + 1u,
image->GetMetadata("title")),
Expand Down Expand Up @@ -5569,7 +5569,7 @@ bool System::SaveCheatList()
if (!System::GetCheatList()->SaveToPCSXRFile(filename.c_str()))
{
Host::AddIconOSDMessage(
"cheat_save_error", ICON_FA_EXCLAMATION_TRIANGLE,
"CheatSaveError", ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Failed to save cheat list to '{}'."), Path::GetFileName(filename)),
Host::OSD_ERROR_DURATION);
}
Expand All @@ -5589,7 +5589,7 @@ bool System::DeleteCheatList()
return false;

Host::AddIconOSDMessage(
"cheat_delete", ICON_FA_EXCLAMATION_TRIANGLE,
"CheatDelete", ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Deleted cheat list '{}'."), Path::GetFileName(filename)),
Host::OSD_INFO_DURATION);
}
Expand Down Expand Up @@ -5633,13 +5633,13 @@ void System::SetCheatCodeState(u32 index, bool enabled)

if (enabled)
{
Host::AddIconOSDMessage(fmt::format("cheat_{}_state", index), ICON_FA_EXCLAMATION_TRIANGLE,
Host::AddIconOSDMessage(fmt::format("Cheat{}State", index), ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Cheat '{}' enabled."), cc.description),
Host::OSD_INFO_DURATION);
}
else
{
Host::AddIconOSDMessage(fmt::format("cheat_{}_state", index), ICON_FA_EXCLAMATION_TRIANGLE,
Host::AddIconOSDMessage(fmt::format("Cheat{}State", index), ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Cheat '{}' disabled."), cc.description),
Host::OSD_INFO_DURATION);
}
Expand All @@ -5656,13 +5656,13 @@ void System::ApplyCheatCode(u32 index)
if (!cc.enabled)
{
cc.Apply();
Host::AddIconOSDMessage(fmt::format("cheat_{}_state", index), ICON_FA_EXCLAMATION_TRIANGLE,
Host::AddIconOSDMessage(fmt::format("Cheat{}State", index), ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Applied cheat '{}'."), cc.description),
Host::OSD_INFO_DURATION);
}
else
{
Host::AddIconOSDMessage(fmt::format("cheat_{}_state", index), ICON_FA_EXCLAMATION_TRIANGLE,
Host::AddIconOSDMessage(fmt::format("Cheat{}State", index), ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format(TRANSLATE_FS("System", "Cheat '{}' is already enabled."), cc.description),
Host::OSD_INFO_DURATION);
}
Expand Down
6 changes: 3 additions & 3 deletions src/duckstation-qt/qthost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,7 @@ void Host::OnInputDeviceConnected(std::string_view identifier, std::string_view

if (System::IsValid() || g_emu_thread->isRunningFullscreenUI())
{
Host::AddIconOSDMessage(fmt::format("controller_connected_{}", identifier), ICON_FA_GAMEPAD,
Host::AddIconOSDMessage(fmt::format("ControllerConnected{}", identifier), ICON_FA_GAMEPAD,
fmt::format(TRANSLATE_FS("QtHost", "Controller {} connected."), identifier),
Host::OSD_INFO_DURATION);
}
Expand All @@ -1924,12 +1924,12 @@ void Host::OnInputDeviceDisconnected(InputBindingKey key, std::string_view ident
// has to be done after pause, otherwise pause message takes precedence
emit g_emu_thread->statusMessage(message);
});
Host::AddIconOSDMessage(fmt::format("controller_connected_{}", identifier), ICON_FA_GAMEPAD, std::move(message),
Host::AddIconOSDMessage(fmt::format("ControllerConnected{}", identifier), ICON_FA_GAMEPAD, std::move(message),
Host::OSD_WARNING_DURATION);
}
else if (System::IsValid() || g_emu_thread->isRunningFullscreenUI())
{
Host::AddIconOSDMessage(fmt::format("controller_connected_{}", identifier), ICON_FA_GAMEPAD,
Host::AddIconOSDMessage(fmt::format("ControllerConnected{}", identifier), ICON_FA_GAMEPAD,
fmt::format(TRANSLATE_FS("QtHost", "Controller {} disconnected."), identifier),
Host::OSD_INFO_DURATION);
}
Expand Down

0 comments on commit 140c4ff

Please sign in to comment.