From 67068cfaf43ef95e526401d9f788790516b9f8ed Mon Sep 17 00:00:00 2001 From: Desour Date: Fri, 3 Mar 2023 01:18:38 +0100 Subject: Get rid of wgettext --- src/gui/guiVolumeChange.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'src/gui/guiVolumeChange.cpp') diff --git a/src/gui/guiVolumeChange.cpp b/src/gui/guiVolumeChange.cpp index 0f6f43fe9..aec24f590 100644 --- a/src/gui/guiVolumeChange.cpp +++ b/src/gui/guiVolumeChange.cpp @@ -73,21 +73,14 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 160 * s, 20 * s); rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s); - wchar_t text[100]; - const wchar_t *str = wgettext("Sound Volume: %d%%"); - swprintf(text, sizeof(text) / sizeof(wchar_t), str, volume); - delete[] str; - core::stringw volume_text = text; - - Environment->addStaticText(volume_text.c_str(), rect, false, - true, this, ID_soundText); + Environment->addStaticText(fwgettext("Sound Volume: %d%%", volume).c_str(), + rect, false, true, this, ID_soundText); } { core::rect rect(0, 0, 80 * s, 30 * s); rect = rect + v2s32(size.X / 2 - 80 * s / 2, size.Y / 2 + 55 * s); - const wchar_t *text = wgettext("Exit"); - GUIButton::addButton(Environment, rect, m_tsrc, this, ID_soundExitButton, text); - delete[] text; + GUIButton::addButton(Environment, rect, m_tsrc, this, ID_soundExitButton, + wstrgettext("Exit").c_str()); } { core::rect rect(0, 0, 300 * s, 20 * s); @@ -100,10 +93,8 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 160 * s, 20 * s); rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 35 * s); - const wchar_t *text = wgettext("Muted"); Environment->addCheckBox(g_settings->getBool("mute_sound"), rect, this, - ID_soundMuteButton, text); - delete[] text; + ID_soundMuteButton, wstrgettext("Muted").c_str()); } } @@ -164,14 +155,7 @@ bool GUIVolumeChange::OnEvent(const SEvent& event) g_settings->setFloat("sound_volume", (float) pos / 100); gui::IGUIElement *e = getElementFromId(ID_soundText); - wchar_t text[100]; - const wchar_t *str = wgettext("Sound Volume: %d%%"); - swprintf(text, sizeof(text) / sizeof(wchar_t), str, pos); - delete[] str; - - core::stringw volume_text = text; - - e->setText(volume_text.c_str()); + e->setText(fwgettext("Sound Volume: %d%%", pos).c_str()); return true; } } -- cgit v1.2.3