forked from Mirrorlandia_minetest/minetest
Get rid of wgettext
This commit is contained in:
parent
35929d27e3
commit
67068cfaf4
@ -1751,7 +1751,7 @@ struct TextureUpdateArgs {
|
|||||||
gui::IGUIEnvironment *guienv;
|
gui::IGUIEnvironment *guienv;
|
||||||
u64 last_time_ms;
|
u64 last_time_ms;
|
||||||
u16 last_percent;
|
u16 last_percent;
|
||||||
const wchar_t* text_base;
|
std::wstring text_base;
|
||||||
ITextureSource *tsrc;
|
ITextureSource *tsrc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1786,8 +1786,6 @@ void Client::afterContentReceived()
|
|||||||
assert(m_nodedef_received); // pre-condition
|
assert(m_nodedef_received); // pre-condition
|
||||||
assert(mediaReceived()); // pre-condition
|
assert(mediaReceived()); // pre-condition
|
||||||
|
|
||||||
const wchar_t* text = wgettext("Loading textures...");
|
|
||||||
|
|
||||||
// Clear cached pre-scaled 2D GUI images, as this cache
|
// Clear cached pre-scaled 2D GUI images, as this cache
|
||||||
// might have images with the same name but different
|
// might have images with the same name but different
|
||||||
// content from previous sessions.
|
// content from previous sessions.
|
||||||
@ -1795,21 +1793,20 @@ void Client::afterContentReceived()
|
|||||||
|
|
||||||
// Rebuild inherited images and recreate textures
|
// Rebuild inherited images and recreate textures
|
||||||
infostream<<"- Rebuilding images and textures"<<std::endl;
|
infostream<<"- Rebuilding images and textures"<<std::endl;
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, m_tsrc, 0, 70);
|
m_rendering_engine->draw_load_screen(wstrgettext("Loading textures..."),
|
||||||
|
guienv, m_tsrc, 0, 70);
|
||||||
m_tsrc->rebuildImagesAndTextures();
|
m_tsrc->rebuildImagesAndTextures();
|
||||||
delete[] text;
|
|
||||||
|
|
||||||
// Rebuild shaders
|
// Rebuild shaders
|
||||||
infostream<<"- Rebuilding shaders"<<std::endl;
|
infostream<<"- Rebuilding shaders"<<std::endl;
|
||||||
text = wgettext("Rebuilding shaders...");
|
m_rendering_engine->draw_load_screen(wstrgettext("Rebuilding shaders..."),
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, m_tsrc, 0, 71);
|
guienv, m_tsrc, 0, 71);
|
||||||
m_shsrc->rebuildShaders();
|
m_shsrc->rebuildShaders();
|
||||||
delete[] text;
|
|
||||||
|
|
||||||
// Update node aliases
|
// Update node aliases
|
||||||
infostream<<"- Updating node aliases"<<std::endl;
|
infostream<<"- Updating node aliases"<<std::endl;
|
||||||
text = wgettext("Initializing nodes...");
|
m_rendering_engine->draw_load_screen(wstrgettext("Initializing nodes..."),
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, m_tsrc, 0, 72);
|
guienv, m_tsrc, 0, 72);
|
||||||
m_nodedef->updateAliases(m_itemdef);
|
m_nodedef->updateAliases(m_itemdef);
|
||||||
for (const auto &path : getTextureDirs()) {
|
for (const auto &path : getTextureDirs()) {
|
||||||
TextureOverrideSource override_source(path + DIR_DELIM + "override.txt");
|
TextureOverrideSource override_source(path + DIR_DELIM + "override.txt");
|
||||||
@ -1818,7 +1815,6 @@ void Client::afterContentReceived()
|
|||||||
}
|
}
|
||||||
m_nodedef->setNodeRegistrationStatus(true);
|
m_nodedef->setNodeRegistrationStatus(true);
|
||||||
m_nodedef->runNodeResolveCallbacks();
|
m_nodedef->runNodeResolveCallbacks();
|
||||||
delete[] text;
|
|
||||||
|
|
||||||
// Update node textures and assign shaders to each tile
|
// Update node textures and assign shaders to each tile
|
||||||
infostream<<"- Updating node textures"<<std::endl;
|
infostream<<"- Updating node textures"<<std::endl;
|
||||||
@ -1826,10 +1822,9 @@ void Client::afterContentReceived()
|
|||||||
tu_args.guienv = guienv;
|
tu_args.guienv = guienv;
|
||||||
tu_args.last_time_ms = porting::getTimeMs();
|
tu_args.last_time_ms = porting::getTimeMs();
|
||||||
tu_args.last_percent = 0;
|
tu_args.last_percent = 0;
|
||||||
tu_args.text_base = wgettext("Initializing nodes");
|
tu_args.text_base = wstrgettext("Initializing nodes");
|
||||||
tu_args.tsrc = m_tsrc;
|
tu_args.tsrc = m_tsrc;
|
||||||
m_nodedef->updateTextures(this, &tu_args);
|
m_nodedef->updateTextures(this, &tu_args);
|
||||||
delete[] tu_args.text_base;
|
|
||||||
|
|
||||||
// Start mesh update thread after setting up content definitions
|
// Start mesh update thread after setting up content definitions
|
||||||
infostream<<"- Starting mesh update thread"<<std::endl;
|
infostream<<"- Starting mesh update thread"<<std::endl;
|
||||||
@ -1841,10 +1836,8 @@ void Client::afterContentReceived()
|
|||||||
if (m_mods_loaded)
|
if (m_mods_loaded)
|
||||||
m_script->on_client_ready(m_env.getLocalPlayer());
|
m_script->on_client_ready(m_env.getLocalPlayer());
|
||||||
|
|
||||||
text = wgettext("Done!");
|
m_rendering_engine->draw_load_screen(wstrgettext("Done!"), guienv, m_tsrc, 0, 100);
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, m_tsrc, 0, 100);
|
|
||||||
infostream<<"Client::afterContentReceived() done"<<std::endl;
|
infostream<<"Client::afterContentReceived() done"<<std::endl;
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Client::getRTT()
|
float Client::getRTT()
|
||||||
|
@ -208,12 +208,10 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||||||
while (m_rendering_engine->run() && !*kill &&
|
while (m_rendering_engine->run() && !*kill &&
|
||||||
!g_gamecallback->shutdown_requested) {
|
!g_gamecallback->shutdown_requested) {
|
||||||
// Set the window caption
|
// Set the window caption
|
||||||
const wchar_t *text = wgettext("Main Menu");
|
|
||||||
m_rendering_engine->get_raw_device()->
|
m_rendering_engine->get_raw_device()->
|
||||||
setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
|
setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
|
||||||
L" " + utf8_to_wide(g_version_hash) +
|
L" " + utf8_to_wide(g_version_hash) +
|
||||||
L" [" + text + L"]").c_str());
|
L" [" + wstrgettext("Main Menu") + L"]").c_str());
|
||||||
delete[] text;
|
|
||||||
|
|
||||||
try { // This is used for catching disconnects
|
try { // This is used for catching disconnects
|
||||||
|
|
||||||
|
@ -1520,17 +1520,10 @@ bool Game::createClient(const GameStartData &start_data)
|
|||||||
std::wstring str = utf8_to_wide(PROJECT_NAME_C);
|
std::wstring str = utf8_to_wide(PROJECT_NAME_C);
|
||||||
str += L" ";
|
str += L" ";
|
||||||
str += utf8_to_wide(g_version_hash);
|
str += utf8_to_wide(g_version_hash);
|
||||||
{
|
|
||||||
const wchar_t *text = nullptr;
|
|
||||||
if (simple_singleplayer_mode)
|
|
||||||
text = wgettext("Singleplayer");
|
|
||||||
else
|
|
||||||
text = wgettext("Multiplayer");
|
|
||||||
str += L" [";
|
str += L" [";
|
||||||
str += text;
|
str += simple_singleplayer_mode ? wstrgettext("Singleplayer")
|
||||||
|
: wstrgettext("Multiplayer");
|
||||||
str += L"]";
|
str += L"]";
|
||||||
delete[] text;
|
|
||||||
}
|
|
||||||
str += L" [";
|
str += L" [";
|
||||||
str += driver->getName();
|
str += driver->getName();
|
||||||
str += L"]";
|
str += L"]";
|
||||||
@ -1746,17 +1739,13 @@ bool Game::getServerContent(bool *aborted)
|
|||||||
int progress = 25;
|
int progress = 25;
|
||||||
|
|
||||||
if (!client->itemdefReceived()) {
|
if (!client->itemdefReceived()) {
|
||||||
const wchar_t *text = wgettext("Item definitions...");
|
|
||||||
progress = 25;
|
progress = 25;
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, texture_src,
|
m_rendering_engine->draw_load_screen(wstrgettext("Item definitions..."),
|
||||||
dtime, progress);
|
guienv, texture_src, dtime, progress);
|
||||||
delete[] text;
|
|
||||||
} else if (!client->nodedefReceived()) {
|
} else if (!client->nodedefReceived()) {
|
||||||
const wchar_t *text = wgettext("Node definitions...");
|
|
||||||
progress = 30;
|
progress = 30;
|
||||||
m_rendering_engine->draw_load_screen(text, guienv, texture_src,
|
m_rendering_engine->draw_load_screen(wstrgettext("Node definitions..."),
|
||||||
dtime, progress);
|
guienv, texture_src, dtime, progress);
|
||||||
delete[] text;
|
|
||||||
} else {
|
} else {
|
||||||
std::ostringstream message;
|
std::ostringstream message;
|
||||||
std::fixed(message);
|
std::fixed(message);
|
||||||
@ -4279,10 +4268,8 @@ void FpsControl::limit(IrrlichtDevice *device, f32 *dtime)
|
|||||||
|
|
||||||
void Game::showOverlayMessage(const char *msg, float dtime, int percent, bool draw_clouds)
|
void Game::showOverlayMessage(const char *msg, float dtime, int percent, bool draw_clouds)
|
||||||
{
|
{
|
||||||
const wchar_t *wmsg = wgettext(msg);
|
m_rendering_engine->draw_load_screen(wstrgettext(msg), guienv, texture_src,
|
||||||
m_rendering_engine->draw_load_screen(wmsg, guienv, texture_src, dtime, percent,
|
dtime, percent, draw_clouds);
|
||||||
draw_clouds);
|
|
||||||
delete[] wmsg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::settingChangedCallback(const std::string &setting_name, void *data)
|
void Game::settingChangedCallback(const std::string &setting_name, void *data)
|
||||||
|
@ -226,9 +226,7 @@ void GameUI::showMinimap(bool show)
|
|||||||
|
|
||||||
void GameUI::showTranslatedStatusText(const char *str)
|
void GameUI::showTranslatedStatusText(const char *str)
|
||||||
{
|
{
|
||||||
const wchar_t *wmsg = wgettext(str);
|
showStatusText(wstrgettext(str));
|
||||||
showStatusText(wmsg);
|
|
||||||
delete[] wmsg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameUI::setChatText(const EnrichedString &chat_text, u32 recent_chat_count)
|
void GameUI::setChatText(const EnrichedString &chat_text, u32 recent_chat_count)
|
||||||
|
@ -20,8 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "config.h" // for USE_GETTEXT
|
#include "config.h" // for USE_GETTEXT
|
||||||
#include <string>
|
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
#include "util/string.h"
|
||||||
|
|
||||||
#if USE_GETTEXT
|
#if USE_GETTEXT
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
@ -46,18 +46,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
void init_gettext(const char *path, const std::string &configured_language,
|
void init_gettext(const char *path, const std::string &configured_language,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
|
||||||
extern wchar_t *utf8_to_wide_c(const char *str);
|
inline std::string strgettext(const char *str)
|
||||||
|
|
||||||
// The returned string must be freed using delete[]
|
|
||||||
inline const wchar_t *wgettext(const char *str)
|
|
||||||
{
|
{
|
||||||
// We must check here that is not an empty string to avoid trying to translate it
|
// We must check here that is not an empty string to avoid trying to translate it
|
||||||
return str[0] ? utf8_to_wide_c(gettext(str)) : utf8_to_wide_c("");
|
return str[0] ? gettext(str) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string strgettext(const std::string &text)
|
inline std::string strgettext(const std::string &str)
|
||||||
{
|
{
|
||||||
return text.empty() ? "" : gettext(text.c_str());
|
return strgettext(str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::wstring wstrgettext(const char *str)
|
||||||
|
{
|
||||||
|
return utf8_to_wide(strgettext(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::wstring wstrgettext(const std::string &str)
|
||||||
|
{
|
||||||
|
return wstrgettext(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,9 +79,8 @@ template <typename ...Args>
|
|||||||
inline std::wstring fwgettext(const char *src, Args&&... args)
|
inline std::wstring fwgettext(const char *src, Args&&... args)
|
||||||
{
|
{
|
||||||
wchar_t buf[255];
|
wchar_t buf[255];
|
||||||
const wchar_t* str = wgettext(src);
|
swprintf(buf, sizeof(buf) / sizeof(wchar_t), wstrgettext(src).c_str(),
|
||||||
swprintf(buf, sizeof(buf) / sizeof(wchar_t), str, std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
delete[] str;
|
|
||||||
return std::wstring(buf);
|
return std::wstring(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3405,9 +3405,8 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||||||
size.X / 2 - 70, pos.Y,
|
size.X / 2 - 70, pos.Y,
|
||||||
size.X / 2 - 70 + 140, pos.Y + m_btn_height * 2
|
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,
|
||||||
GUIButton::addButton(Environment, mydata.rect, m_tsrc, this, 257, text);
|
wstrgettext("Proceed").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
|||||||
key_used_text = nullptr;
|
key_used_text = nullptr;
|
||||||
|
|
||||||
for (key_setting *ks : key_settings) {
|
for (key_setting *ks : key_settings) {
|
||||||
delete[] ks->button_name;
|
|
||||||
delete ks;
|
delete ks;
|
||||||
}
|
}
|
||||||
key_settings.clear();
|
key_settings.clear();
|
||||||
@ -124,10 +123,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
core::rect<s32> rect(0, 0, 600 * s, 40 * s);
|
core::rect<s32> rect(0, 0, 600 * s, 40 * s);
|
||||||
rect += topleft + v2s32(25 * s, 3 * s);
|
rect += topleft + v2s32(25 * s, 3 * s);
|
||||||
//gui::IGUIStaticText *t =
|
//gui::IGUIStaticText *t =
|
||||||
const wchar_t *text = wgettext("Keybindings.");
|
Environment->addStaticText(wstrgettext("Keybindings.").c_str(),
|
||||||
Environment->addStaticText(text,
|
|
||||||
rect, false, true, this, -1);
|
rect, false, true, this, -1);
|
||||||
delete[] text;
|
|
||||||
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
//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);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft + v2s32(offset.X, offset.Y);
|
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);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(offset.X + 150 * s, offset.Y - 5 * 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,
|
||||||
k->button = GUIButton::addButton(Environment, rect, m_tsrc, this, k->id, text);
|
wstrgettext(k->key.name()).c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
if ((i + 1) % KMaxButtonPerColumns == 0) {
|
if ((i + 1) % KMaxButtonPerColumns == 0) {
|
||||||
offset.X += 260 * s;
|
offset.X += 260 * s;
|
||||||
@ -166,10 +163,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
rect += topleft + v2s32(option_x, option_y);
|
||||||
const wchar_t *text = wgettext("\"Aux1\" = climb down");
|
|
||||||
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
||||||
GUI_ID_CB_AUX1_DESCENDS, text);
|
GUI_ID_CB_AUX1_DESCENDS, wstrgettext("\"Aux1\" = climb down").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
offset += v2s32(0, 25 * s);
|
offset += v2s32(0, 25 * s);
|
||||||
}
|
}
|
||||||
@ -181,10 +176,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
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,
|
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
|
||||||
GUI_ID_CB_DOUBLETAP_JUMP, text);
|
GUI_ID_CB_DOUBLETAP_JUMP, wstrgettext("Double tap \"jump\" to toggle fly").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
offset += v2s32(0, 25 * s);
|
offset += v2s32(0, 25 * s);
|
||||||
}
|
}
|
||||||
@ -196,10 +189,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
rect += topleft + v2s32(option_x, option_y);
|
||||||
const wchar_t *text = wgettext("Automatic jumping");
|
|
||||||
Environment->addCheckBox(g_settings->getBool("autojump"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("autojump"), rect, this,
|
||||||
GUI_ID_CB_AUTOJUMP, text);
|
GUI_ID_CB_AUTOJUMP, wstrgettext("Automatic jumping").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
offset += v2s32(0, 25);
|
offset += v2s32(0, 25);
|
||||||
}
|
}
|
||||||
@ -207,16 +198,14 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(size.X / 2 - 105 * s, size.Y - 40 * 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,
|
||||||
GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_BACK_BUTTON, text);
|
wstrgettext("Save").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(size.X / 2 + 5 * s, size.Y - 40 * 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,
|
||||||
GUIButton::addButton(Environment, rect, m_tsrc, this, GUI_ID_ABORT_BUTTON, text);
|
wstrgettext("Cancel").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,9 +260,7 @@ bool GUIKeyChangeMenu::acceptInput()
|
|||||||
bool GUIKeyChangeMenu::resetMenu()
|
bool GUIKeyChangeMenu::resetMenu()
|
||||||
{
|
{
|
||||||
if (active_key) {
|
if (active_key) {
|
||||||
const wchar_t *text = wgettext(active_key->key.name());
|
active_key->button->setText(wstrgettext(active_key->key.name()).c_str());
|
||||||
active_key->button->setText(text);
|
|
||||||
delete[] text;
|
|
||||||
active_key = nullptr;
|
active_key = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -313,10 +300,9 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
|||||||
if (key_in_use && !this->key_used_text) {
|
if (key_in_use && !this->key_used_text) {
|
||||||
core::rect<s32> rect(0, 0, 600, 40);
|
core::rect<s32> rect(0, 0, 600, 40);
|
||||||
rect += v2s32(0, 0) + v2s32(25, 30);
|
rect += v2s32(0, 0) + v2s32(25, 30);
|
||||||
const wchar_t *text = wgettext("Key already in use");
|
this->key_used_text = Environment->addStaticText(
|
||||||
this->key_used_text = Environment->addStaticText(text,
|
wstrgettext("Key already in use").c_str(),
|
||||||
rect, false, true, this, -1);
|
rect, false, true, this, -1);
|
||||||
delete[] text;
|
|
||||||
} else if (!key_in_use && this->key_used_text) {
|
} else if (!key_in_use && this->key_used_text) {
|
||||||
this->key_used_text->remove();
|
this->key_used_text->remove();
|
||||||
this->key_used_text = nullptr;
|
this->key_used_text = nullptr;
|
||||||
@ -325,9 +311,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
|||||||
// But go on
|
// But go on
|
||||||
{
|
{
|
||||||
active_key->key = kp;
|
active_key->key = kp;
|
||||||
const wchar_t *text = wgettext(kp.name());
|
active_key->button->setText(wstrgettext(kp.name()).c_str());
|
||||||
active_key->button->setText(text);
|
|
||||||
delete[] text;
|
|
||||||
|
|
||||||
// Allow characters made with shift
|
// Allow characters made with shift
|
||||||
if (shift_went_down){
|
if (shift_went_down){
|
||||||
@ -377,9 +361,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
|||||||
FATAL_ERROR_IF(!active_key, "Key setting not found");
|
FATAL_ERROR_IF(!active_key, "Key setting not found");
|
||||||
|
|
||||||
shift_down = false;
|
shift_down = false;
|
||||||
const wchar_t *text = wgettext("press key");
|
active_key->button->setText(wstrgettext("press key").c_str());
|
||||||
active_key->button->setText(text);
|
|
||||||
delete[] text;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Environment->setFocus(this);
|
Environment->setFocus(this);
|
||||||
@ -388,12 +370,12 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
|||||||
return Parent ? Parent->OnEvent(event) : false;
|
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;
|
key_setting *k = new key_setting;
|
||||||
k->id = id;
|
k->id = id;
|
||||||
|
|
||||||
k->button_name = button_name;
|
k->button_name = std::move(button_name);
|
||||||
k->setting_name = setting_name;
|
k->setting_name = setting_name;
|
||||||
k->key = getKeySetting(k->setting_name.c_str());
|
k->key = getKeySetting(k->setting_name.c_str());
|
||||||
key_settings.push_back(k);
|
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()
|
void GUIKeyChangeMenu::init_keys()
|
||||||
{
|
{
|
||||||
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wgettext("Forward"), "keymap_forward");
|
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wstrgettext("Forward"), "keymap_forward");
|
||||||
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wgettext("Backward"), "keymap_backward");
|
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wstrgettext("Backward"), "keymap_backward");
|
||||||
this->add_key(GUI_ID_KEY_LEFT_BUTTON, wgettext("Left"), "keymap_left");
|
this->add_key(GUI_ID_KEY_LEFT_BUTTON, wstrgettext("Left"), "keymap_left");
|
||||||
this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wgettext("Right"), "keymap_right");
|
this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wstrgettext("Right"), "keymap_right");
|
||||||
this->add_key(GUI_ID_KEY_AUX1_BUTTON, wgettext("Aux1"), "keymap_aux1");
|
this->add_key(GUI_ID_KEY_AUX1_BUTTON, wstrgettext("Aux1"), "keymap_aux1");
|
||||||
this->add_key(GUI_ID_KEY_JUMP_BUTTON, wgettext("Jump"), "keymap_jump");
|
this->add_key(GUI_ID_KEY_JUMP_BUTTON, wstrgettext("Jump"), "keymap_jump");
|
||||||
this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wgettext("Sneak"), "keymap_sneak");
|
this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wstrgettext("Sneak"), "keymap_sneak");
|
||||||
this->add_key(GUI_ID_KEY_DROP_BUTTON, wgettext("Drop"), "keymap_drop");
|
this->add_key(GUI_ID_KEY_DROP_BUTTON, wstrgettext("Drop"), "keymap_drop");
|
||||||
this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory");
|
this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wstrgettext("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_PREV_BUTTON, wstrgettext("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_HOTBAR_NEXT_BUTTON, wstrgettext("Next item"), "keymap_hotbar_next");
|
||||||
this->add_key(GUI_ID_KEY_ZOOM_BUTTON, wgettext("Zoom"), "keymap_zoom");
|
this->add_key(GUI_ID_KEY_ZOOM_BUTTON, wstrgettext("Zoom"), "keymap_zoom");
|
||||||
this->add_key(GUI_ID_KEY_CAMERA_BUTTON, wgettext("Change camera"), "keymap_camera_mode");
|
this->add_key(GUI_ID_KEY_CAMERA_BUTTON, wstrgettext("Change camera"), "keymap_camera_mode");
|
||||||
this->add_key(GUI_ID_KEY_MINIMAP_BUTTON, wgettext("Toggle minimap"), "keymap_minimap");
|
this->add_key(GUI_ID_KEY_MINIMAP_BUTTON, wstrgettext("Toggle minimap"), "keymap_minimap");
|
||||||
this->add_key(GUI_ID_KEY_FLY_BUTTON, wgettext("Toggle fly"), "keymap_freemove");
|
this->add_key(GUI_ID_KEY_FLY_BUTTON, wstrgettext("Toggle fly"), "keymap_freemove");
|
||||||
this->add_key(GUI_ID_KEY_PITCH_MOVE, wgettext("Toggle pitchmove"), "keymap_pitchmove");
|
this->add_key(GUI_ID_KEY_PITCH_MOVE, wstrgettext("Toggle pitchmove"), "keymap_pitchmove");
|
||||||
this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove");
|
this->add_key(GUI_ID_KEY_FAST_BUTTON, wstrgettext("Toggle fast"), "keymap_fastmove");
|
||||||
this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wgettext("Toggle noclip"), "keymap_noclip");
|
this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wstrgettext("Toggle noclip"), "keymap_noclip");
|
||||||
this->add_key(GUI_ID_KEY_MUTE_BUTTON, wgettext("Mute"), "keymap_mute");
|
this->add_key(GUI_ID_KEY_MUTE_BUTTON, wstrgettext("Mute"), "keymap_mute");
|
||||||
this->add_key(GUI_ID_KEY_DEC_VOLUME_BUTTON, wgettext("Dec. volume"), "keymap_decrease_volume");
|
this->add_key(GUI_ID_KEY_DEC_VOLUME_BUTTON, wstrgettext("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_INC_VOLUME_BUTTON, wstrgettext("Inc. volume"), "keymap_increase_volume");
|
||||||
this->add_key(GUI_ID_KEY_AUTOFWD_BUTTON, wgettext("Autoforward"), "keymap_autoforward");
|
this->add_key(GUI_ID_KEY_AUTOFWD_BUTTON, wstrgettext("Autoforward"), "keymap_autoforward");
|
||||||
this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat");
|
this->add_key(GUI_ID_KEY_CHAT_BUTTON, wstrgettext("Chat"), "keymap_chat");
|
||||||
this->add_key(GUI_ID_KEY_SCREENSHOT_BUTTON, wgettext("Screenshot"), "keymap_screenshot");
|
this->add_key(GUI_ID_KEY_SCREENSHOT_BUTTON, wstrgettext("Screenshot"), "keymap_screenshot");
|
||||||
this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect");
|
this->add_key(GUI_ID_KEY_RANGE_BUTTON, wstrgettext("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_DEC_RANGE_BUTTON, wstrgettext("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_INC_RANGE_BUTTON, wstrgettext("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_CONSOLE_BUTTON, wstrgettext("Console"), "keymap_console");
|
||||||
this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd");
|
this->add_key(GUI_ID_KEY_CMD_BUTTON, wstrgettext("Command"), "keymap_cmd");
|
||||||
this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wgettext("Local command"), "keymap_cmd_local");
|
this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wstrgettext("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_BLOCK_BOUNDS_BUTTON, wstrgettext("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_HUD_BUTTON, wstrgettext("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_CHATLOG_BUTTON, wstrgettext("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_FOG_BUTTON, wstrgettext("Toggle fog"), "keymap_toggle_fog");
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class ISimpleTextureSource;
|
|||||||
struct key_setting
|
struct key_setting
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
const wchar_t *button_name;
|
std::wstring button_name;
|
||||||
KeyPress key;
|
KeyPress key;
|
||||||
std::string setting_name;
|
std::string setting_name;
|
||||||
gui::IGUIButton *button;
|
gui::IGUIButton *button;
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
|
|
||||||
bool resetMenu();
|
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;
|
bool shift_down = false;
|
||||||
|
|
||||||
|
@ -82,8 +82,6 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
|||||||
v2s32 size = DesiredRect.getSize();
|
v2s32 size = DesiredRect.getSize();
|
||||||
v2s32 topleft_client(40 * s, 0);
|
v2s32 topleft_client(40 * s, 0);
|
||||||
|
|
||||||
const wchar_t *text;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add stuff
|
Add stuff
|
||||||
*/
|
*/
|
||||||
@ -91,9 +89,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
|||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("Old Password");
|
Environment->addStaticText(wstrgettext("Old Password").c_str(), rect,
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
false, true, this, -1);
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
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);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("New Password");
|
Environment->addStaticText(wstrgettext("New Password").c_str(), rect, false, true,
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
this, -1);
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
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);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("Confirm Password");
|
Environment->addStaticText(wstrgettext("Confirm Password").c_str(), rect,
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
false, true, this, -1);
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
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);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X / 4 + 56 * s, ypos);
|
rect = rect + v2s32(size.X / 4 + 56 * s, ypos);
|
||||||
text = wgettext("Change");
|
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_change,
|
||||||
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_change, text);
|
wstrgettext("Change").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X / 4 + 185 * s, ypos);
|
rect = rect + v2s32(size.X / 4 + 185 * s, ypos);
|
||||||
text = wgettext("Cancel");
|
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_cancel,
|
||||||
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_cancel, text);
|
wstrgettext("Cancel").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ypos += 50 * s;
|
ypos += 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
|
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(35 * s, ypos);
|
rect += topleft_client + v2s32(35 * s, ypos);
|
||||||
text = wgettext("Passwords do not match!");
|
IGUIElement *e = Environment->addStaticText(
|
||||||
IGUIElement *e =
|
wstrgettext("Passwords do not match!").c_str(), rect, false,
|
||||||
Environment->addStaticText(
|
true, this, ID_message);
|
||||||
text, rect, false, true, this, ID_message);
|
|
||||||
e->setVisible(false);
|
e->setVisible(false);
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,21 +73,14 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
|||||||
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
|
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);
|
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);
|
||||||
|
|
||||||
wchar_t text[100];
|
Environment->addStaticText(fwgettext("Sound Volume: %d%%", volume).c_str(),
|
||||||
const wchar_t *str = wgettext("Sound Volume: %d%%");
|
rect, false, true, this, ID_soundText);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 80 * s, 30 * s);
|
core::rect<s32> rect(0, 0, 80 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 80 * s / 2, size.Y / 2 + 55 * 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,
|
||||||
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_soundExitButton, text);
|
wstrgettext("Exit").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
|
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);
|
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 35 * 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,
|
Environment->addCheckBox(g_settings->getBool("mute_sound"), rect, this,
|
||||||
ID_soundMuteButton, text);
|
ID_soundMuteButton, wstrgettext("Muted").c_str());
|
||||||
delete[] text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,14 +155,7 @@ bool GUIVolumeChange::OnEvent(const SEvent& event)
|
|||||||
g_settings->setFloat("sound_volume", (float) pos / 100);
|
g_settings->setFloat("sound_volume", (float) pos / 100);
|
||||||
|
|
||||||
gui::IGUIElement *e = getElementFromId(ID_soundText);
|
gui::IGUIElement *e = getElementFromId(ID_soundText);
|
||||||
wchar_t text[100];
|
e->setText(fwgettext("Sound Volume: %d%%", pos).c_str());
|
||||||
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());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ int ModApiClient::l_disconnect(lua_State *L)
|
|||||||
// gettext(text)
|
// gettext(text)
|
||||||
int ModApiClient::l_gettext(lua_State *L)
|
int ModApiClient::l_gettext(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string text = strgettext(std::string(luaL_checkstring(L, 1)));
|
std::string text = strgettext(luaL_checkstring(L, 1));
|
||||||
lua_pushstring(L, text.c_str());
|
lua_pushstring(L, text.c_str());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -161,15 +161,6 @@ std::string wide_to_utf8(const std::wstring &input)
|
|||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
wchar_t *utf8_to_wide_c(const char *str)
|
|
||||||
{
|
|
||||||
std::wstring ret = utf8_to_wide(std::string(str));
|
|
||||||
size_t len = ret.length();
|
|
||||||
wchar_t *ret_c = new wchar_t[len + 1];
|
|
||||||
memcpy(ret_c, ret.c_str(), (len + 1) * sizeof(wchar_t));
|
|
||||||
return ret_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string urlencode(const std::string &str)
|
std::string urlencode(const std::string &str)
|
||||||
{
|
{
|
||||||
|
@ -79,10 +79,6 @@ struct FlagDesc {
|
|||||||
std::wstring utf8_to_wide(const std::string &input);
|
std::wstring utf8_to_wide(const std::string &input);
|
||||||
std::string wide_to_utf8(const std::wstring &input);
|
std::string wide_to_utf8(const std::wstring &input);
|
||||||
|
|
||||||
// You must free the returned string!
|
|
||||||
// The returned string is allocated using new[]
|
|
||||||
wchar_t *utf8_to_wide_c(const char *str);
|
|
||||||
|
|
||||||
std::string urlencode(const std::string &str);
|
std::string urlencode(const std::string &str);
|
||||||
std::string urldecode(const std::string &str);
|
std::string urldecode(const std::string &str);
|
||||||
u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask);
|
u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask);
|
||||||
|
Loading…
Reference in New Issue
Block a user