summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-18 20:14:23 +0100
committerIra Rice <irarice@gmail.com>2009-02-18 13:19:11 -0700
commitc3f7f72f37adad5103587069ff549798fc9d652d (patch)
treedf268b0bfd478cb3f4d740b1bce9a882bc70c538 /src/gui
parentb8f0e1755ae8c6acf9bc681a83f18ef6ff0a1172 (diff)
downloadmana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.gz
mana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.bz2
mana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.xz
mana-c3f7f72f37adad5103587069ff549798fc9d652d.zip
Introduced a toLower method and grouped string utils
The string utility methods are now grouped together in the stringutils.h header. Also, a toLower method was added for convenience.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/char_server.cpp4
-rw-r--r--src/gui/chat.cpp23
-rw-r--r--src/gui/color.cpp2
-rw-r--r--src/gui/debugwindow.cpp2
-rw-r--r--src/gui/emotecontainer.cpp2
-rw-r--r--src/gui/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/emotewindow.cpp2
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/inttextfield.cpp2
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/itemcontainer.cpp2
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/login.cpp2
-rw-r--r--src/gui/ministatus.cpp2
-rw-r--r--src/gui/recorder.cpp2
-rw-r--r--src/gui/register.cpp2
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp2
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/gui/shortcutcontainer.cpp2
-rw-r--r--src/gui/status.cpp2
-rw-r--r--src/gui/trade.cpp2
-rw-r--r--src/gui/updatewindow.cpp2
-rw-r--r--src/gui/viewport.cpp2
26 files changed, 31 insertions, 44 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index bad6d8de..fa0594d6 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -46,7 +46,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/trim.h"
+#include "../utils/stringutils.h"
// Defined in main.cpp, used here for setting the char create dialog
extern CharServerHandler charServerHandler;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 60f8f5dd..6977a104 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -30,7 +30,7 @@
#include "../serverinfo.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
extern SERVER_INFO **server_info;
@@ -102,7 +102,7 @@ void ServerSelectDialog::action(const gcn::ActionEvent &event)
{
mOkButton->setEnabled(false);
const SERVER_INFO *si = server_info[mServerList->getSelected()];
- mLoginData->hostname = iptostring(si->address);
+ mLoginData->hostname = ipToString(si->address);
mLoginData->port = si->port;
mLoginData->updateHost = si->updateHost;
state = mNextState;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 0e8810ac..91e410ce 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -47,8 +47,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
-#include "../utils/trim.h"
+#include "../utils/stringutils.h"
ChatWindow::ChatWindow(Network * network):
Window(""), mNetwork(network), mTmpVisible(false)
@@ -336,15 +335,8 @@ void ChatWindow::whisper(const std::string &nick, std::string msg)
std::string playerName = player_node->getName();
std::string tempNick = recvnick;
- for (unsigned int i = 0; i < playerName.size(); i++)
- {
- playerName[i] = (char) tolower(playerName[i]);
- }
-
- for (unsigned int i = 0; i < tempNick.size(); i++)
- {
- tempNick[i] = (char) tolower(tempNick[i]);
- }
+ toLower(playerName);
+ toLower(tempNick);
if (tempNick.compare(playerName) == 0 || msg.empty())
return;
@@ -405,14 +397,9 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
start = msg.find('[', start + 1);
}
- std::string temp = msg.substr(start+1, end - start - 1);
-
- trim(temp);
+ std::string temp = msg.substr(start + 1, end - start - 1);
- for (unsigned int i = 0; i < temp.size(); i++)
- {
- temp[i] = (char) tolower(temp[i]);
- }
+ toLower(trim(temp));
const ItemInfo itemInfo = ItemDB::get(temp);
if (itemInfo.getName() != _("Unknown item"))
diff --git a/src/gui/color.cpp b/src/gui/color.cpp
index aa249077..b68bf68b 100644
--- a/src/gui/color.cpp
+++ b/src/gui/color.cpp
@@ -24,7 +24,7 @@
#include "../configuration.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
Color::Color()
{
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 2d8bb826..c41e0a5e 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -34,7 +34,7 @@
#include "../particle.h"
#include "../map.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
DebugWindow::DebugWindow():
Window("Debug")
diff --git a/src/gui/emotecontainer.cpp b/src/gui/emotecontainer.cpp
index 721a0ebd..c4cace55 100644
--- a/src/gui/emotecontainer.cpp
+++ b/src/gui/emotecontainer.cpp
@@ -39,7 +39,7 @@
#include "../utils/dtor.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
const int EmoteContainer::gridWidth = 34; // emote icon width + 4
const int EmoteContainer::gridHeight = 36; // emote icon height + 4
diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp
index af83a743..e828df8b 100644
--- a/src/gui/emoteshortcutcontainer.cpp
+++ b/src/gui/emoteshortcutcontainer.cpp
@@ -39,7 +39,7 @@
#include "../utils/dtor.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
static const int MAX_ITEMS = 12;
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp
index 8cf1d730..30129941 100644
--- a/src/gui/emotewindow.cpp
+++ b/src/gui/emotewindow.cpp
@@ -30,7 +30,7 @@
#include "../localplayer.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
EmoteWindow::EmoteWindow():
Window(_("Emote"))
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index fae517a9..6be55e1c 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -41,7 +41,7 @@
#include "../resources/resourcemanager.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
// Positions of the boxes, 2nd dimension is X and Y respectively.
static const int boxPosition[][2] = {
diff --git a/src/gui/inttextfield.cpp b/src/gui/inttextfield.cpp
index adade3b9..40bbd887 100644
--- a/src/gui/inttextfield.cpp
+++ b/src/gui/inttextfield.cpp
@@ -22,7 +22,7 @@
#include "inttextfield.h"
#include "sdlinput.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
IntTextField::IntTextField(int def):
TextField(toString(def)),
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index ec825ae3..e8457337 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -44,7 +44,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
InventoryWindow::InventoryWindow(int invSize):
Window(_("Inventory")),
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index e84c79ca..79aeb227 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -38,7 +38,7 @@
#include "../resources/image.h"
#include "../resources/resourcemanager.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
const int ItemContainer::gridWidth = 36; // item icon width + 4
const int ItemContainer::gridHeight = 42; // item icon height + 10
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index d13cd1c2..88afcd5b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -36,7 +36,7 @@
#include "../resources/iteminfo.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
ItemPopup::ItemPopup():
Window()
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index 324e1b6c..10ced157 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -36,7 +36,7 @@
#include "../resources/image.h"
#include "../resources/resourcemanager.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
ItemShortcutContainer::ItemShortcutContainer():
ShortcutContainer(),
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 159b7f6f..cd331322 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -39,7 +39,7 @@
#include "../configuration.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
static const int MAX_SERVER_LIST_SIZE = 5;
static const int LOGIN_DIALOG_WIDTH = 220;
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 629cf45c..6537b48e 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -28,7 +28,7 @@
#include "../graphics.h"
#include "../localplayer.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
MiniStatusWindow::MiniStatusWindow():
Window("")
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index 982d808d..ff8825ef 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -28,7 +28,7 @@
#include "widgets/layout.h"
-#include "../utils/trim.h"
+#include "../utils/stringutils.h"
Recorder::Recorder(ChatWindow *chat, const std::string &title,
const std::string &buttonTxt) :
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index fd7df18d..13928e41 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -40,7 +40,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
/**
* Listener used while dealing with wrong data. It is used to direct the focus
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index f3fa3c65..31b56b51 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -40,7 +40,7 @@
#include "../configuration.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
Setup_Colors::Setup_Colors() :
mSelected(-1)
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 1fb0b443..0f79e3c6 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -36,7 +36,7 @@
#include "../keyboardconfig.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
/**
* The list model for key function list.
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 34dfde0f..8b21582e 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -47,7 +47,7 @@
#include "../particle.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
extern Graphics *graphics;
diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp
index cc559def..13ff042d 100644
--- a/src/gui/shortcutcontainer.cpp
+++ b/src/gui/shortcutcontainer.cpp
@@ -26,7 +26,7 @@
#include "../resources/image.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
float ShortcutContainer::mAlpha = config.getValue("guialpha", 0.8);
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 42a48b2f..49af3ae2 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -33,7 +33,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
StatusWindow::StatusWindow(LocalPlayer *player):
Window(player->getName()),
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index c57cac59..ba2e2462 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -44,7 +44,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
TradeWindow::TradeWindow(Network *network):
Window(_("Trade: You")),
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index a25d57d4..81dcb047 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -45,7 +45,7 @@
#include "../resources/resourcemanager.h"
#include "../utils/gettext.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
/**
* Calculates the Alder-32 checksum for the given file.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 79a37227..9a7f6173 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -37,7 +37,7 @@
#include "../resources/monsterinfo.h"
#include "../resources/resourcemanager.h"
-#include "../utils/tostring.h"
+#include "../utils/stringutils.h"
extern volatile int tick_time;