aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorDesour <ds.desour@proton.me>2023-03-03 01:18:38 +0100
committersfan5 <sfan5@live.de>2023-04-08 20:17:50 +0200
commit67068cfaf43ef95e526401d9f788790516b9f8ed (patch)
treef4e219f632bff88aa0c798b42b4a27e2e353acef /src/gui
parent35929d27e3a93085c3a27180c1805711dcfe95d5 (diff)
downloadminetest-67068cfaf43ef95e526401d9f788790516b9f8ed.tar.xz
Get rid of wgettext
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiFormSpecMenu.cpp5
-rw-r--r--src/gui/guiKeyChangeMenu.cpp124
-rw-r--r--src/gui/guiKeyChangeMenu.h4
-rw-r--r--src/gui/guiPasswordChange.cpp35
-rw-r--r--src/gui/guiVolumeChange.cpp28
5 files changed, 76 insertions, 120 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 68222b319..aed765ed8 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -3405,9 +3405,8 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
size.X / 2 - 70, pos.Y,
size.X / 2 - 70 + 140, pos.Y + m_btn_height * 2
);
- const wchar_t *text = wgettext("Proceed");
- GUIButton::addButton(Environment, mydata.rect, m_tsrc, this, 257, text);
- delete[] text;
+ GUIButton::addButton(Environment, mydata.rect, m_tsrc, this, 257,
+ wstrgettext("Proceed").c_str());
}
}
diff --git a/src/gui/guiKeyChangeMenu.cpp b/src/gui/guiKeyChangeMenu.cpp
index 021f5f0a9..b048c229f 100644
--- a/src/gui/guiKeyChangeMenu.cpp
+++ b/src/gui/guiKeyChangeMenu.cpp
@@ -97,7 +97,6 @@ GUIKeyChangeMenu::~GUIKeyChangeMenu()
key_used_text = nullptr;
for (key_setting *ks : key_settings) {
- delete[] ks->button_name;
delete ks;
}
key_settings.clear();
@@ -124,10 +123,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 600 * s, 40 * s);
rect += topleft + v2s32(25 * s, 3 * s);
//gui::IGUIStaticText *t =
- const wchar_t *text = wgettext("Keybindings.");
- Environment->addStaticText(text,
+ Environment->addStaticText(wstrgettext("Keybindings.").c_str(),
rect, false, true, this, -1);
- delete[] text;
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
}
@@ -141,15 +138,15 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft + v2s32(offset.X, offset.Y);
- Environment->addStaticText(k->button_name, rect, false, true, this, -1);
+ Environment->addStaticText(k->button_name.c_str(), rect, false, true,
+ this, -1);
}
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(offset.X + 150 * s, offset.Y - 5 * s);
- const wchar_t *text = wgettext(k->key.name());
- k->button = GUIButton::addButton(Environment, rect, m_tsrc, this, k->id, text);
- delete[] text;
+ k->button = GUIButton::addButton(Environment, rect, m_tsrc, this, k->id,
+ wstrgettext(k->key.name()).c_str());
}
if ((i + 1) % KMaxButtonPerColumns == 0) {
offset.X += 260 * s;
@@ -166,10 +163,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, option_w, 30 * s);
rect += topleft + v2s32(option_x, option_y);
- const wchar_t *text = wgettext("\"Aux1\" = climb down");
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
- GUI_ID_CB_AUX1_DESCENDS, text);
- delete[] text;
+ GUI_ID_CB_AUX1_DESCENDS, wstrgettext("\"Aux1\" = climb down").c_str());
}
offset += v2s32(0, 25 * s);
}
@@ -181,10 +176,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, option_w, 30 * s);
rect += topleft + v2s32(option_x, option_y);
- const wchar_t *text = wgettext("Double tap \"jump\" to toggle fly");
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
- GUI_ID_CB_DOUBLETAP_JUMP, text);
- delete[] text;
+ GUI_ID_CB_DOUBLETAP_JUMP, wstrgettext("Double tap \"jump\" to toggle fly").c_str());
}
offset += v2s32(0, 25 * s);
}
@@ -196,10 +189,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, option_w, 30 * s);
rect += topleft + v2s32(option_x, option_y);
- const wchar_t *text = wgettext("Automatic jumping");
Environment->addCheckBox(g_settings->getBool("autojump"), rect, this,
- GUI_ID_CB_AUTOJUMP, text);
- delete[] text;
+ GUI_ID_CB_AUTOJUMP, wstrgettext("Automatic jumping").c_str());
}
offset += v2s32(0, 25);
}
@@ -207,16 +198,14 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(size.X / 2 - 105 * s, size.Y - 40 * s);
- const wchar_t *text = wgettext("Save");
- GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_BACK_BUTTON, text);
- delete[] text;
+ GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_BACK_BUTTON,
+ wstrgettext("Save").c_str());
}
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(size.X / 2 + 5 * s, size.Y - 40 * s);
- const wchar_t *text = wgettext("Cancel");
- GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_ABORT_BUTTON, text);
- delete[] text;
+ GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_ABORT_BUTTON,
+ wstrgettext("Cancel").c_str());
}
}
@@ -271,9 +260,7 @@ bool GUIKeyChangeMenu::acceptInput()
bool GUIKeyChangeMenu::resetMenu()
{
if (active_key) {
- const wchar_t *text = wgettext(active_key->key.name());
- active_key->button->setText(text);
- delete[] text;
+ active_key->button->setText(wstrgettext(active_key->key.name()).c_str());
active_key = nullptr;
return false;
}
@@ -313,10 +300,9 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
if (key_in_use && !this->key_used_text) {
core::rect<s32> rect(0, 0, 600, 40);
rect += v2s32(0, 0) + v2s32(25, 30);
- const wchar_t *text = wgettext("Key already in use");
- this->key_used_text = Environment->addStaticText(text,
+ this->key_used_text = Environment->addStaticText(
+ wstrgettext("Key already in use").c_str(),
rect, false, true, this, -1);
- delete[] text;
} else if (!key_in_use && this->key_used_text) {
this->key_used_text->remove();
this->key_used_text = nullptr;
@@ -325,9 +311,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
// But go on
{
active_key->key = kp;
- const wchar_t *text = wgettext(kp.name());
- active_key->button->setText(text);
- delete[] text;
+ active_key->button->setText(wstrgettext(kp.name()).c_str());
// Allow characters made with shift
if (shift_went_down){
@@ -377,9 +361,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
FATAL_ERROR_IF(!active_key, "Key setting not found");
shift_down = false;
- const wchar_t *text = wgettext("press key");
- active_key->button->setText(text);
- delete[] text;
+ active_key->button->setText(wstrgettext("press key").c_str());
break;
}
Environment->setFocus(this);
@@ -388,12 +370,12 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
return Parent ? Parent->OnEvent(event) : false;
}
-void GUIKeyChangeMenu::add_key(int id, const wchar_t *button_name, const std::string &setting_name)
+void GUIKeyChangeMenu::add_key(int id, std::wstring button_name, const std::string &setting_name)
{
key_setting *k = new key_setting;
k->id = id;
- k->button_name = button_name;
+ k->button_name = std::move(button_name);
k->setting_name = setting_name;
k->key = getKeySetting(k->setting_name.c_str());
key_settings.push_back(k);
@@ -401,38 +383,38 @@ void GUIKeyChangeMenu::add_key(int id, const wchar_t *button_name, const std::st
void GUIKeyChangeMenu::init_keys()
{
- this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wgettext("Forward"), "keymap_forward");
- this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wgettext("Backward"), "keymap_backward");
- this->add_key(GUI_ID_KEY_LEFT_BUTTON, wgettext("Left"), "keymap_left");
- this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wgettext("Right"), "keymap_right");
- this->add_key(GUI_ID_KEY_AUX1_BUTTON, wgettext("Aux1"), "keymap_aux1");
- this->add_key(GUI_ID_KEY_JUMP_BUTTON, wgettext("Jump"), "keymap_jump");
- this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wgettext("Sneak"), "keymap_sneak");
- this->add_key(GUI_ID_KEY_DROP_BUTTON, wgettext("Drop"), "keymap_drop");
- this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory");
- this->add_key(GUI_ID_KEY_HOTBAR_PREV_BUTTON, wgettext("Prev. item"), "keymap_hotbar_previous");
- this->add_key(GUI_ID_KEY_HOTBAR_NEXT_BUTTON, wgettext("Next item"), "keymap_hotbar_next");
- this->add_key(GUI_ID_KEY_ZOOM_BUTTON, wgettext("Zoom"), "keymap_zoom");
- this->add_key(GUI_ID_KEY_CAMERA_BUTTON, wgettext("Change camera"), "keymap_camera_mode");
- this->add_key(GUI_ID_KEY_MINIMAP_BUTTON, wgettext("Toggle minimap"), "keymap_minimap");
- this->add_key(GUI_ID_KEY_FLY_BUTTON, wgettext("Toggle fly"), "keymap_freemove");
- this->add_key(GUI_ID_KEY_PITCH_MOVE, wgettext("Toggle pitchmove"), "keymap_pitchmove");
- this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove");
- this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wgettext("Toggle noclip"), "keymap_noclip");
- this->add_key(GUI_ID_KEY_MUTE_BUTTON, wgettext("Mute"), "keymap_mute");
- this->add_key(GUI_ID_KEY_DEC_VOLUME_BUTTON, wgettext("Dec. volume"), "keymap_decrease_volume");
- this->add_key(GUI_ID_KEY_INC_VOLUME_BUTTON, wgettext("Inc. volume"), "keymap_increase_volume");
- this->add_key(GUI_ID_KEY_AUTOFWD_BUTTON, wgettext("Autoforward"), "keymap_autoforward");
- this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat");
- this->add_key(GUI_ID_KEY_SCREENSHOT_BUTTON, wgettext("Screenshot"), "keymap_screenshot");
- this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect");
- this->add_key(GUI_ID_KEY_DEC_RANGE_BUTTON, wgettext("Dec. range"), "keymap_decrease_viewing_range_min");
- this->add_key(GUI_ID_KEY_INC_RANGE_BUTTON, wgettext("Inc. range"), "keymap_increase_viewing_range_min");
- this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, wgettext("Console"), "keymap_console");
- this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd");
- this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wgettext("Local command"), "keymap_cmd_local");
- this->add_key(GUI_ID_KEY_BLOCK_BOUNDS_BUTTON, wgettext("Block bounds"), "keymap_toggle_block_bounds");
- this->add_key(GUI_ID_KEY_HUD_BUTTON, wgettext("Toggle HUD"), "keymap_toggle_hud");
- this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wgettext("Toggle chat log"), "keymap_toggle_chat");
- this->add_key(GUI_ID_KEY_FOG_BUTTON, wgettext("Toggle fog"), "keymap_toggle_fog");
+ this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wstrgettext("Forward"), "keymap_forward");
+ this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wstrgettext("Backward"), "keymap_backward");
+ this->add_key(GUI_ID_KEY_LEFT_BUTTON, wstrgettext("Left"), "keymap_left");
+ this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wstrgettext("Right"), "keymap_right");
+ this->add_key(GUI_ID_KEY_AUX1_BUTTON, wstrgettext("Aux1"), "keymap_aux1");
+ this->add_key(GUI_ID_KEY_JUMP_BUTTON, wstrgettext("Jump"), "keymap_jump");
+ this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wstrgettext("Sneak"), "keymap_sneak");
+ this->add_key(GUI_ID_KEY_DROP_BUTTON, wstrgettext("Drop"), "keymap_drop");
+ this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wstrgettext("Inventory"), "keymap_inventory");
+ this->add_key(GUI_ID_KEY_HOTBAR_PREV_BUTTON, wstrgettext("Prev. item"), "keymap_hotbar_previous");
+ this->add_key(GUI_ID_KEY_HOTBAR_NEXT_BUTTON, wstrgettext("Next item"), "keymap_hotbar_next");
+ this->add_key(GUI_ID_KEY_ZOOM_BUTTON, wstrgettext("Zoom"), "keymap_zoom");
+ this->add_key(GUI_ID_KEY_CAMERA_BUTTON, wstrgettext("Change camera"), "keymap_camera_mode");
+ this->add_key(GUI_ID_KEY_MINIMAP_BUTTON, wstrgettext("Toggle minimap"), "keymap_minimap");
+ this->add_key(GUI_ID_KEY_FLY_BUTTON, wstrgettext("Toggle fly"), "keymap_freemove");
+ this->add_key(GUI_ID_KEY_PITCH_MOVE, wstrgettext("Toggle pitchmove"), "keymap_pitchmove");
+ this->add_key(GUI_ID_KEY_FAST_BUTTON, wstrgettext("Toggle fast"), "keymap_fastmove");
+ this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wstrgettext("Toggle noclip"), "keymap_noclip");
+ this->add_key(GUI_ID_KEY_MUTE_BUTTON, wstrgettext("Mute"), "keymap_mute");
+ this->add_key(GUI_ID_KEY_DEC_VOLUME_BUTTON, wstrgettext("Dec. volume"), "keymap_decrease_volume");
+ this->add_key(GUI_ID_KEY_INC_VOLUME_BUTTON, wstrgettext("Inc. volume"), "keymap_increase_volume");
+ this->add_key(GUI_ID_KEY_AUTOFWD_BUTTON, wstrgettext("Autoforward"), "keymap_autoforward");
+ this->add_key(GUI_ID_KEY_CHAT_BUTTON, wstrgettext("Chat"), "keymap_chat");
+ this->add_key(GUI_ID_KEY_SCREENSHOT_BUTTON, wstrgettext("Screenshot"), "keymap_screenshot");
+ this->add_key(GUI_ID_KEY_RANGE_BUTTON, wstrgettext("Range select"), "keymap_rangeselect");
+ this->add_key(GUI_ID_KEY_DEC_RANGE_BUTTON, wstrgettext("Dec. range"), "keymap_decrease_viewing_range_min");
+ this->add_key(GUI_ID_KEY_INC_RANGE_BUTTON, wstrgettext("Inc. range"), "keymap_increase_viewing_range_min");
+ this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, wstrgettext("Console"), "keymap_console");
+ this->add_key(GUI_ID_KEY_CMD_BUTTON, wstrgettext("Command"), "keymap_cmd");
+ this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wstrgettext("Local command"), "keymap_cmd_local");
+ this->add_key(GUI_ID_KEY_BLOCK_BOUNDS_BUTTON, wstrgettext("Block bounds"), "keymap_toggle_block_bounds");
+ this->add_key(GUI_ID_KEY_HUD_BUTTON, wstrgettext("Toggle HUD"), "keymap_toggle_hud");
+ this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wstrgettext("Toggle chat log"), "keymap_toggle_chat");
+ this->add_key(GUI_ID_KEY_FOG_BUTTON, wstrgettext("Toggle fog"), "keymap_toggle_fog");
}
diff --git a/src/gui/guiKeyChangeMenu.h b/src/gui/guiKeyChangeMenu.h
index 84a898774..6bb3a9050 100644
--- a/src/gui/guiKeyChangeMenu.h
+++ b/src/gui/guiKeyChangeMenu.h
@@ -33,7 +33,7 @@ class ISimpleTextureSource;
struct key_setting
{
int id;
- const wchar_t *button_name;
+ std::wstring button_name;
KeyPress key;
std::string setting_name;
gui::IGUIButton *button;
@@ -68,7 +68,7 @@ private:
bool resetMenu();
- void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
+ void add_key(int id, std::wstring button_name, const std::string &setting_name);
bool shift_down = false;
diff --git a/src/gui/guiPasswordChange.cpp b/src/gui/guiPasswordChange.cpp
index c39df176b..d8e1c702f 100644
--- a/src/gui/guiPasswordChange.cpp
+++ b/src/gui/guiPasswordChange.cpp
@@ -82,8 +82,6 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
v2s32 size = DesiredRect.getSize();
v2s32 topleft_client(40 * s, 0);
- const wchar_t *text;
-
/*
Add stuff
*/
@@ -91,9 +89,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
- text = wgettext("Old Password");
- Environment->addStaticText(text, rect, false, true, this, -1);
- delete[] text;
+ Environment->addStaticText(wstrgettext("Old Password").c_str(), rect,
+ false, true, this, -1);
}
{
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
@@ -107,9 +104,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
- text = wgettext("New Password");
- Environment->addStaticText(text, rect, false, true, this, -1);
- delete[] text;
+ Environment->addStaticText(wstrgettext("New Password").c_str(), rect, false, true,
+ this, -1);
}
{
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
@@ -122,9 +118,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
- text = wgettext("Confirm Password");
- Environment->addStaticText(text, rect, false, true, this, -1);
- delete[] text;
+ Environment->addStaticText(wstrgettext("Confirm Password").c_str(), rect,
+ false, true, this, -1);
}
{
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
@@ -138,28 +133,24 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect = rect + v2s32(size.X / 4 + 56 * s, ypos);
- text = wgettext("Change");
- GUIButton::addButton(Environment, rect, m_tsrc, this, ID_change, text);
- delete[] text;
+ GUIButton::addButton(Environment, rect, m_tsrc, this, ID_change,
+ wstrgettext("Change").c_str());
}
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect = rect + v2s32(size.X / 4 + 185 * s, ypos);
- text = wgettext("Cancel");
- GUIButton::addButton(Environment, rect, m_tsrc, this, ID_cancel, text);
- delete[] text;
+ GUIButton::addButton(Environment, rect, m_tsrc, this, ID_cancel,
+ wstrgettext("Cancel").c_str());
}
ypos += 50 * s;
{
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
rect += topleft_client + v2s32(35 * s, ypos);
- text = wgettext("Passwords do not match!");
- IGUIElement *e =
- Environment->addStaticText(
- text, rect, false, true, this, ID_message);
+ IGUIElement *e = Environment->addStaticText(
+ wstrgettext("Passwords do not match!").c_str(), rect, false,
+ true, this, ID_message);
e->setVisible(false);
- delete[] text;
}
}
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<s32> 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<s32> 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<s32> rect(0, 0, 300 * s, 20 * s);
@@ -100,10 +93,8 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> 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;
}
}