diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-26 01:40:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-26 01:40:00 +0300 |
commit | d4febba47388979b26cd4680cb8a6f20e548e399 (patch) | |
tree | 2d520db672ed39b755e668828d27f0dd9d18ed6e /src/gui/widgets | |
parent | 803b6afd00b0e3574b40b866f21a0d3d01f6dc4d (diff) | |
download | plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.gz plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.bz2 plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.xz plus-d4febba47388979b26cd4680cb8a6f20e548e399.zip |
Improve string usage in other files.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 4 |
4 files changed, 25 insertions, 27 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 0e3135b03..b69664ddd 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -212,12 +212,12 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) { if (a->getX() != -1) { - text += strprintf(" [%d,%d %s]", a->getX(), a->getY(), - a->getMap().c_str()); + text.append(strprintf(" [%d,%d %s]", a->getX(), a->getY(), + a->getMap().c_str())); } else { - text += strprintf(" [%s]", a->getMap().c_str()); + text.append(strprintf(" [%s]", a->getMap().c_str())); } } @@ -228,10 +228,10 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) switch (a->getGender()) { case GENDER_FEMALE: - text += strprintf(" \u2640 "); + text.append(" \u2640 "); break; case GENDER_MALE: - text += strprintf(" \u2642 "); + text.append(" \u2642 "); break; default: break; @@ -245,12 +245,12 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) switch (a->getGender()) { case GENDER_FEMALE: - text += strprintf(" \u2640 %s", - a->getAdditionString().c_str()); + text.append(strprintf(" \u2640 %s", + a->getAdditionString().c_str())); break; case GENDER_MALE: - text += strprintf(" \u2642 %s", - a->getAdditionString().c_str()); + text.append(strprintf(" \u2642 %s", + a->getAdditionString().c_str())); break; default: break; @@ -258,7 +258,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) } else { - text += a->getAdditionString(); + text.append(a->getAdditionString()); } } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 51b977bbc..bbd31cee7 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -162,7 +162,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) bLink.y1 = sz * font->getHeight(); bLink.y2 = bLink.y1 + font->getHeight(); - newRow += tmp.substr(0, idx1); + newRow.append(tmp.substr(0, idx1)); std::string tmp2 = newRow; idx1 = tmp2.find("##"); @@ -180,16 +180,16 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) mLinks.push_back(bLink); linksCount ++; - newRow += "##<" + bLink.caption; + newRow.append("##<").append(bLink.caption); tmp.erase(0, idx3 + 2); if (!tmp.empty()) - newRow += "##>"; + newRow.append("##>"); idx1 = tmp.find("@@"); } - newRow += tmp; + newRow.append(tmp); } // Don't use links and user defined colors else @@ -768,7 +768,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const } else { - str += part.mText; + str.append(part.mText); } } diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index fd336e116..ae18740a9 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -146,30 +146,27 @@ void ChatTab::chatLog(std::string line, Own own, case BY_GM: if (tmp.nick.empty()) { - tmp.nick = std::string(_("Global announcement:")); - tmp.nick += " "; + tmp.nick = std::string(_("Global announcement:")).append(" "); lineColor = "##G"; } else { tmp.nick = strprintf(_("Global announcement from %s:"), - tmp.nick.c_str()); - tmp.nick += " "; + tmp.nick.c_str()).append(" "); lineColor = "##1"; // Equiv. to BrowserBox::RED } break; case BY_PLAYER: - tmp.nick += ": "; + tmp.nick.append(": "); lineColor = "##Y"; break; case BY_OTHER: case BY_UNKNOWN: - tmp.nick += ": "; + tmp.nick.append(": "); lineColor = "##C"; break; case BY_SERVER: - tmp.nick = _("Server:"); - tmp.nick += " "; + tmp.nick = std::string(_("Server:")).append(" "); tmp.text = line; lineColor = "##S"; break; @@ -243,7 +240,8 @@ void ChatTab::chatLog(std::string line, Own own, << ":" << (((t / 60) % 60 < 10) ? "0" : "") << static_cast<int>((t / 60) % 60) << "] "; - line = lineColor + timeStr.str() + tmp.nick + tmp.text; + line = std::string(lineColor).append(timeStr.str()).append( + tmp.nick).append(tmp.text); } if (config.getBoolValue("enableChatLog")) @@ -330,7 +328,7 @@ void ChatTab::chatLog(const std::string &nick, std::string msg) const Own byWho = (nick == player_node->getName() ? BY_PLAYER : BY_OTHER); if (byWho == BY_OTHER && config.getBoolValue("removeColors")) msg = removeColors(msg); - chatLog(nick + " : " + msg, byWho, false, false); + chatLog(std::string(nick).append(" : ").append(msg), byWho, false, false); } void ChatTab::chatInput(const std::string &message) diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index d9071aec4..0e9fa993c 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -501,7 +501,7 @@ void SetupItemLabel::createControls() { const std::string str = " \342\200\225\342\200\225\342\200\225" "\342\200\225\342\200\225 "; - mLabel = new Label(this, str + mText + str); + mLabel = new Label(this, std::string(str).append(mText).append(str)); } else { @@ -1032,7 +1032,7 @@ void SetupItemSound::action(const gcn::ActionEvent &event) if (mSlider->getSelected()) { sound.playGuiSfx(branding.getStringValue("systemsounds") - + mSlider->getSelectedString() + ".ogg"); + .append(mSlider->getSelectedString()).append(".ogg")); } } else |