diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-29 03:51:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-29 03:52:16 +0300 |
commit | 3bf4e26b1319295532bb4396cbd6406d85cbcae0 (patch) | |
tree | 80a4303b29aafa21683e90e45798283a482bf1d1 /src/gui | |
parent | 7f607a0f58a9eba53237955c06bf445c71d57b6c (diff) | |
download | manaverse-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.gz manaverse-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.bz2 manaverse-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.xz manaverse-3bf4e26b1319295532bb4396cbd6406d85cbcae0.zip |
Replace vectors with strings to short names.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/charcreatedialog.h | 5 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/chatwindow.h | 10 | ||||
-rw-r--r-- | src/gui/didyouknowwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/helpwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemamountwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 6 | ||||
-rw-r--r-- | src/gui/setup_relations.cpp | 7 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 8 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/textcommandeditor.cpp | 3 | ||||
-rw-r--r-- | src/gui/theme.cpp | 6 | ||||
-rw-r--r-- | src/gui/theme.h | 10 | ||||
-rw-r--r-- | src/gui/whoisonline.h | 12 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/namesmodel.h | 8 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 2 |
23 files changed, 61 insertions, 70 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 0b20952c8..864ddf0b6 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -396,7 +396,7 @@ int CharCreateDialog::getDistributedPoints() const return points; } -void CharCreateDialog::setAttributes(const std::vector<std::string> &labels, +void CharCreateDialog::setAttributes(const StringVect &labels, int available, int min, int max) { mMaxPoints = available; diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h index 8be421543..15fdf7466 100644 --- a/src/gui/charcreatedialog.h +++ b/src/gui/charcreatedialog.h @@ -32,9 +32,6 @@ #include <guichan/actionlistener.hpp> -#include <string> -#include <vector> - class LocalPlayer; class PlayerBox; class TextField; @@ -64,7 +61,7 @@ class CharCreateDialog : public Window, public gcn::ActionListener */ void unlock(); - void setAttributes(const std::vector<std::string> &labels, + void setAttributes(const StringVect &labels, int available, int min, int max); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 528c1e39e..0403b5e17 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -331,10 +331,10 @@ void ChatWindow::loadGMCommands() const char *fileName = "gmcommands.txt"; ResourceManager *resman = ResourceManager::getInstance(); - std::vector<std::string> list; + StringVect list; resman->loadTextFile(fileName, list); - std::vector<std::string>::const_iterator it = list.begin(); - std::vector<std::string>::const_iterator it_end = list.end(); + StringVectCIter it = list.begin(); + StringVectCIter it_end = list.end(); while (it != it_end) { @@ -1194,7 +1194,7 @@ void ChatWindow::autoComplete() return; ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab()); - std::vector<std::string> nameList; + StringVect nameList; if (cTab) cTab->getAutoCompleteList(nameList); @@ -1243,10 +1243,10 @@ void ChatWindow::autoComplete() } } -std::string ChatWindow::autoComplete(std::vector<std::string> &names, +std::string ChatWindow::autoComplete(StringVect &names, std::string partName) const { - std::vector<std::string>::const_iterator i = names.begin(); + StringVectCIter i = names.begin(); toLower(partName); std::string newName(""); @@ -1282,7 +1282,7 @@ std::string ChatWindow::autoComplete(std::string partName, History *words) return ""; Commands::const_iterator i = words->begin(); - std::vector<std::string> nameList; + StringVect nameList; while (i != words->end()) { @@ -1310,7 +1310,7 @@ void ChatWindow::moveTabRight(ChatTab *tab) std::string ChatWindow::autoCompleteHistory(std::string partName) { History::const_iterator i = mHistory.begin(); - std::vector<std::string> nameList; + StringVect nameList; while (i != mHistory.end()) { diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index df452f9a7..05882aa69 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -29,15 +29,15 @@ #include "gui/widgets/window.h" +#include "utils/stringvector.h" + #include <guichan/actionlistener.hpp> #include <guichan/keylistener.hpp> #include <guichan/widget.hpp> #include <guichan/widgetlistener.hpp> #include <list> -#include <string> #include <map> -#include <vector> #include <set> class BrowserBox; @@ -302,7 +302,7 @@ class ChatWindow : public Window, std::string autoComplete(std::string partName, History *words); - std::string autoComplete(std::vector<std::string> &names, + std::string autoComplete(StringVect &names, std::string partName) const; /** Used for showing item popup on clicking links **/ @@ -341,14 +341,14 @@ class ChatWindow : public Window, bool mReturnToggles; /**< Marks whether <Return> toggles the chat log or not */ - std::vector<std::string> mTradeFilter; + StringVect mTradeFilter; gcn::DropDown *mColorPicker; ColorListModel *mColorListModel; int mChatColor; unsigned int mChatHistoryIndex; std::list<std::string> mAwayLog; - std::vector<std::string> mHighlights; + StringVect mHighlights; bool mGMLoaded; bool mHaveMouse; bool mAutoHide; diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index a071e1ffc..e68f5ab22 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -131,12 +131,12 @@ void DidYouKnowWindow::loadData(int num) void DidYouKnowWindow::loadFile(int num) { const std::string file = strprintf("tips/%d", num); - const std::vector<std::string> langs = getLang(); + const StringVect langs = getLang(); std::string helpPath = branding.getStringValue("helpPath"); if (helpPath.empty()) helpPath = paths.getStringValue("help"); - std::vector<std::string> lines; + StringVect lines; TranslationManager::translateFile(helpPath + file + ".txt", translator, lines); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index f8d68a672..9d111141b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -106,7 +106,7 @@ Gui::Gui(Graphics *graphics): Window::setWindowContainer(guiTop); setTop(guiTop); - const std::vector<std::string> langs = getLang(); + const StringVect langs = getLang(); const bool isJapan = (!langs.empty() && langs[0].size() > 3 && langs[0].substr(0, 3) == "ja_"); diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 0a28855b9..3ae025514 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -107,12 +107,12 @@ void HelpWindow::loadHelp(const std::string &helpFile) void HelpWindow::loadFile(const std::string &file) { - const std::vector<std::string> langs = getLang(); + const StringVect langs = getLang(); std::string helpPath = branding.getStringValue("helpPath"); if (helpPath.empty()) helpPath = paths.getStringValue("help"); - std::vector<std::string> lines; + StringVect lines; TranslationManager::translateFile(helpPath + file + ".txt", translator, lines); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 7ceeb6e34..e21b07f44 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -149,7 +149,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): mFilterLabel = new Label(_("Filter:")); mNameFilter = new TextField("", true, this, "namefilter", true); - std::vector<std::string> tags = ItemDB::getTags(); + StringVect tags = ItemDB::getTags(); for (unsigned f = 0; f < tags.size(); f ++) mFilter->addButton(tags[f]); diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 3b01b559f..ef1aad258 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -95,7 +95,7 @@ public: return mStrings.at(i); } private: - std::vector<std::string> mStrings; + StringVect mStrings; }; void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage) diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 7bd2ee76d..a779fcc64 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -27,12 +27,12 @@ #include "gui/widgets/window.h" +#include "utils/stringvector.h" + #include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> #include <list> -#include <string> -#include <vector> class BrowserBox; class ItemLinkHandler; @@ -201,7 +201,7 @@ class NpcDialog : public Window, public gcn::ActionListener, // Used for choice input ListBox *mItemList; gcn::ScrollArea *mListScrollArea; - std::vector<std::string> mItems; + StringVect mItems; ItemLinkHandler *mItemLinkHandler; // Used for string and integer input diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index d9f7a362d..d685cf6f5 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -42,9 +42,6 @@ #include "utils/dtor.h" #include "utils/gettext.h" -#include <string> -#include <vector> - #define COLUMNS_NR 2 // name plus listbox #define NAME_COLUMN 0 #define RELATION_CHOICE_COLUMN 1 @@ -146,7 +143,7 @@ public: signalBeforeUpdate(); freeWidgets(); - std::vector<std::string> *player_names = player_relations.getPlayers(); + StringVect *player_names = player_relations.getPlayers(); if (!player_names) return; @@ -201,7 +198,7 @@ public: } protected: - std::vector<std::string> *mPlayers; + StringVect *mPlayers; std::vector<gcn::Widget *> mWidgets; PlayerRelationListModel *mListModel; }; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 24d42c83d..a416b2027 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -54,8 +54,6 @@ #include <SDL.h> #include <algorithm> -#include <string> -#include <vector> #include "debug.h" @@ -102,7 +100,7 @@ class ModeListModel : public gcn::ListModel private: void addCustomMode(std::string mode); - std::vector<std::string> mVideoModes; + StringVect mVideoModes; }; bool modeSorter(std::string mode1, std::string mode2); @@ -166,8 +164,8 @@ ModeListModel::ModeListModel() void ModeListModel::addCustomMode(std::string mode) { - std::vector<std::string>::const_iterator it = mVideoModes.begin(); - std::vector<std::string>::const_iterator it_end = mVideoModes.end(); + StringVectCIter it = mVideoModes.begin(); + StringVectCIter it_end = mVideoModes.end(); while (it != it_end) { if (*it == mode) diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index f0ac9e128..361e94037 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -576,7 +576,7 @@ public: if (actorSpriteManager) { - std::vector<std::string> names; + StringVect names; actorSpriteManager->getPlayerNames(names, false); std::vector<Avatar*>::iterator ai = avatars->begin(); @@ -587,7 +587,7 @@ public: if (!ava) break; - std::vector<std::string>::const_iterator i = names.begin(); + StringVectCIter i = names.begin(); while (i != names.end()) { if (ava->getName() == (*i) && (*i) != "") @@ -609,7 +609,7 @@ public: } } - std::vector<std::string>::const_iterator i = names.begin(); + StringVectCIter i = names.begin(); while (i != names.end()) { @@ -1141,7 +1141,7 @@ public: } avatars->clear(); - std::vector<std::string> *players + StringVect *players = player_relations.getPlayersByRelation(PlayerRelation::FRIEND); const std::set<std::string> &players2 = whoIsOnline->getOnlineNicks(); @@ -1149,8 +1149,8 @@ public: if (!players) return; - std::vector<std::string>::iterator it = players->begin(); - std::vector<std::string>::iterator it_end = players->end(); + StringVectIter it = players->begin(); + StringVectIter it_end = players->end(); for (; it != it_end; ++ it) { Avatar *ava = nullptr; diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 3f98b4ea3..fe695e0ea 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -24,7 +24,6 @@ #include <SDL.h> #include <SDL_thread.h> -#include <vector> #include <algorithm> #include "gui/chatwindow.h" @@ -103,7 +102,7 @@ public: return mStrings.at(i); } private: - std::vector<std::string> mStrings; + StringVect mStrings; }; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 3a09810d0..dad553e81 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -533,7 +533,7 @@ bool Theme::tryThemePath(std::string themeName) return false; } -void Theme::fillSkinsList(std::vector<std::string> &list) +void Theme::fillSkinsList(StringVect &list) { char **skins = PHYSFS_enumerateFiles( branding.getStringValue("guiThemePath").c_str()); @@ -550,7 +550,7 @@ void Theme::fillSkinsList(std::vector<std::string> &list) PHYSFS_freeList(skins); } -void Theme::fillFontsList(std::vector<std::string> &list) +void Theme::fillFontsList(StringVect &list) { PHYSFS_permitSymbolicLinks(1); char **fonts = PHYSFS_enumerateFiles( @@ -569,7 +569,7 @@ void Theme::fillFontsList(std::vector<std::string> &list) PHYSFS_permitSymbolicLinks(0); } -void Theme::fillSoundsList(std::vector<std::string> &list) +void Theme::fillSoundsList(StringVect &list) { char **skins = PHYSFS_enumerateFiles( branding.getStringValue("systemsounds").c_str()); diff --git a/src/gui/theme.h b/src/gui/theme.h index c30044dc7..c547e5351 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -30,9 +30,9 @@ #include "gui/palette.h" +#include "utils/stringvector.h" + #include <map> -#include <string> -#include <vector> class DyePalette; class Image; @@ -127,11 +127,11 @@ class Theme : public Palette, public ConfigListener static std::string getThemeName() { return mThemeName; } - static void fillSkinsList(std::vector<std::string> &list); + static void fillSkinsList(StringVect &list); - static void fillFontsList(std::vector<std::string> &list); + static void fillFontsList(StringVect &list); - static void fillSoundsList(std::vector<std::string> &list); + static void fillSoundsList(StringVect &list); /** * Returns the patch to the given gui resource relative to the theme diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index 46fe74f62..4b5b52fe4 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -23,16 +23,16 @@ #ifndef WHOISONLINE_H #define WHOISONLINE_H -#include <string> -#include <set> -#include <vector> - #include "configlistener.h" #include "gui/widgets/linkhandler.h" #include "gui/widgets/window.h" -#include "../utils/mutex.h" +#include "utils/stringvector.h" + +#include "utils/mutex.h" + +#include <set> #include <guichan/actionlistener.hpp> @@ -136,7 +136,7 @@ public: void optionChanged(const std::string &name); - void updateList(std::vector<std::string> &list); + void updateList(StringVect &list); void readFromWeb(); diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index d67f56b54..d11a85138 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -28,6 +28,8 @@ #include "gui/widgets/browserbox.h" #include "gui/widgets/tab.h" +#include "utils/stringvector.h" + #include "localconsts.h" class ScrollArea; @@ -175,7 +177,7 @@ class ChatTab : public Tab virtual void handleCommand(const std::string &msg); - virtual void getAutoCompleteList(std::vector<std::string>&) const + virtual void getAutoCompleteList(StringVect&) const {} void addRow(std::string &line); diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index bad34cfb3..9fed16e92 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -113,7 +113,7 @@ void GuildChatTab::showHelp() chatLog(_("/kick > Kick some one from the guild you are in")); } -void GuildChatTab::getAutoCompleteList(std::vector<std::string> &names) const +void GuildChatTab::getAutoCompleteList(StringVect &names) const { if (!guildManager) return; diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index e729844f4..358c1f1d4 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -49,7 +49,7 @@ class GuildChatTab : public ChatTab protected: void handleInput(const std::string &msg); - void getAutoCompleteList(std::vector<std::string> &names) const; + void getAutoCompleteList(StringVect &names) const; }; #endif diff --git a/src/gui/widgets/namesmodel.h b/src/gui/widgets/namesmodel.h index dc694fc46..e1dbf0a89 100644 --- a/src/gui/widgets/namesmodel.h +++ b/src/gui/widgets/namesmodel.h @@ -21,12 +21,10 @@ #ifndef GUI_WIDGETS_NAMESMODEL_H #define GUI_WIDGETS_NAMESMODEL_H -//#include "guichanfwd.h" +#include "utils/stringvector.h" #include <guichan/listmodel.hpp> -#include <vector> - class NamesModel : public gcn::ListModel { public: @@ -38,14 +36,14 @@ class NamesModel : public gcn::ListModel virtual std::string getElementAt(int i); - std::vector<std::string> &getNames() + StringVect &getNames() { return mNames; } size_t size() { return mNames.size(); } protected: - std::vector<std::string> mNames; + StringVect mNames; }; #endif diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 625c8a392..007002e21 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -166,7 +166,7 @@ void WhisperTab::saveToLogFile(std::string &msg) chatLogger->log(getNick(), msg); } -void WhisperTab::getAutoCompleteList(std::vector<std::string> &names) const +void WhisperTab::getAutoCompleteList(StringVect &names) const { names.push_back(mNick); } diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 72d407ac2..226ebaf40 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -46,7 +46,7 @@ class WhisperTab : public ChatTab void saveToLogFile(std::string &msg); - void getAutoCompleteList(std::vector<std::string> &names) const; + void getAutoCompleteList(StringVect &names) const; protected: friend class ChatWindow; |