summaryrefslogtreecommitdiff
path: root/src/guiPasswordChange.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-04-17 06:10:30 +0200
committerest31 <MTest31@outlook.com>2015-04-17 06:10:30 +0200
commitf0a1379e5a9ebc954e95d07c1ad5d71587adc6bc (patch)
tree38114d9be2e6bf1a0740035c41d5925c23f5036f /src/guiPasswordChange.cpp
parent821d0025da3d7dec662e75c6ce2ea32e86aec508 (diff)
downloadminetest-f0a1379e5a9ebc954e95d07c1ad5d71587adc6bc.tar.gz
minetest-f0a1379e5a9ebc954e95d07c1ad5d71587adc6bc.tar.bz2
minetest-f0a1379e5a9ebc954e95d07c1ad5d71587adc6bc.zip
Refactor around translatePassword
Change types for passed password from wstring to string, which removes converting back and forth in most cases. Move the narrow_to_wide conversion, where its neccessary, closer to irrlicht. Remove trailing spaces in guiPasswordChange.cpp. Make parameters for translatePassword passed as const reference.
Diffstat (limited to 'src/guiPasswordChange.cpp')
-rw-r--r--src/guiPasswordChange.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp
index 0e19f571d..1c1a1f06e 100644
--- a/src/guiPasswordChange.cpp
+++ b/src/guiPasswordChange.cpp
@@ -79,7 +79,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
Remove stuff
*/
removeChildren();
-
+
/*
Calculate new sizes and positions
*/
@@ -89,7 +89,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
screensize.X/2 + 580/2,
screensize.Y/2 + 300/2
);
-
+
DesiredRect = rect;
recalculateAbsolutePosition(false);
@@ -112,7 +112,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_client + v2s32(160, ypos);
- gui::IGUIEditBox *e =
+ gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_oldPassword);
Environment->setFocus(e);
e->setPasswordBox(true);
@@ -128,7 +128,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_client + v2s32(160, ypos);
- gui::IGUIEditBox *e =
+ gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_newPassword1);
e->setPasswordBox(true);
}
@@ -143,7 +143,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_client + v2s32(160, ypos);
- gui::IGUIEditBox *e =
+ gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_newPassword2);
e->setPasswordBox(true);
}
@@ -162,7 +162,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 300, 20);
rect += topleft_client + v2s32(35, ypos);
text = wgettext("Passwords do not match!");
- IGUIElement *e =
+ IGUIElement *e =
Environment->addStaticText(
text,
rect, false, true, this, ID_message);
@@ -177,7 +177,7 @@ void GUIPasswordChange::drawMenu()
if (!skin)
return;
video::IVideoDriver* driver = Environment->getVideoDriver();
-
+
video::SColor bgcolor(140,0,0,0);
driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
@@ -203,7 +203,8 @@ bool GUIPasswordChange::acceptInput()
e->setVisible(true);
return false;
}
- m_client->sendChangePassword(oldpass, newpass);
+ m_client->sendChangePassword(wide_to_narrow(oldpass),
+ wide_to_narrow(newpass));
return true;
}