summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-25 22:18:26 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-25 22:18:26 +0300
commit853757df15383c2e9cc33023dc04a256c458e671 (patch)
treef12cf49d6ddc17b6b4fc96d066359872b108f144 /src/gui
parent8e57e80d73a58077615924d50ac206d19efddae6 (diff)
downloadmv-853757df15383c2e9cc33023dc04a256c458e671.tar.gz
mv-853757df15383c2e9cc33023dc04a256c458e671.tar.bz2
mv-853757df15383c2e9cc33023dc04a256c458e671.tar.xz
mv-853757df15383c2e9cc33023dc04a256c458e671.zip
fix some code style by cpplint.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/beingpopup.h2
-rw-r--r--src/gui/buydialog.cpp3
-rw-r--r--src/gui/popupmenu.cpp3
-rw-r--r--src/gui/registerdialog.cpp2
-rw-r--r--src/gui/sdlfont_unittest.cc9
-rw-r--r--src/gui/setup_colors.cpp6
-rw-r--r--src/gui/socialwindow.cpp8
-rw-r--r--src/gui/updaterwindow.cpp2
-rw-r--r--src/gui/userpalette.cpp6
-rw-r--r--src/gui/widgets/browserbox.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp1
-rw-r--r--src/gui/widgets/tab.cpp2
12 files changed, 12 insertions, 34 deletions
diff --git a/src/gui/beingpopup.h b/src/gui/beingpopup.h
index 82b04ca85..417adc42e 100644
--- a/src/gui/beingpopup.h
+++ b/src/gui/beingpopup.h
@@ -50,8 +50,6 @@ class BeingPopup final : public Popup
*/
void show(const int x, const int y, Being *const b);
- // TODO: Add a version for monsters, NPCs, etc?
-
private:
Label *mBeingName;
Label *mBeingParty;
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 936adc2d5..3930ae715 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -407,9 +407,6 @@ void BuyDialog::action(const gcn::ActionEvent &event)
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
- // TODO: Actually we'd have a bug elsewhere if this check for the number
- // of items to be bought ever fails, Bertram removed the assertions, is
- // there a better way to ensure this fails in an _obvious_ way in C++?
else if (eventId == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems)
{
if (mNpcId != -1)
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index ecb24849f..0b56b300a 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -83,7 +83,7 @@ extern int serverVersion;
std::string tradePartnerName("");
-PopupMenu::PopupMenu():
+PopupMenu::PopupMenu() :
Popup("PopupMenu", "popupmenu.xml"),
mBrowserBox(new BrowserBox(this)),
mScrollArea(nullptr),
@@ -1736,7 +1736,6 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y,
mBrowserBox->addRow("split", _("Split"));
}
// Assume in storage for now
- // TODO: make this whole system more flexible, if needed
else
{
mBrowserBox->addRow("retrieve", _("Retrieve"));
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index bb76bc8b2..8628e4010 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -229,8 +229,6 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
error = 2;
}
- // TODO: Check if a valid email address was given
-
if (error > 0)
{
if (error == 1)
diff --git a/src/gui/sdlfont_unittest.cc b/src/gui/sdlfont_unittest.cc
index 7575772f0..eab4d2994 100644
--- a/src/gui/sdlfont_unittest.cc
+++ b/src/gui/sdlfont_unittest.cc
@@ -256,9 +256,12 @@ TEST(TextChunkList, moveToFirst4)
{
TextChunkList list;
- SDLTextChunk *chunk1 = new SDLTextChunk("test", gcn::Color(), gcn::Color());
- SDLTextChunk *chunk2 = new SDLTextChunk("test2", gcn::Color(), gcn::Color());
- SDLTextChunk *chunk3 = new SDLTextChunk("test3", gcn::Color(), gcn::Color());
+ SDLTextChunk *chunk1 = new SDLTextChunk("test",
+ gcn::Color(), gcn::Color());
+ SDLTextChunk *chunk2 = new SDLTextChunk("test2",
+ gcn::Color(), gcn::Color());
+ SDLTextChunk *chunk3 = new SDLTextChunk("test3",
+ gcn::Color(), gcn::Color());
list.insertFirst(chunk1);
list.insertFirst(chunk3);
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index f52bbb09c..a46e8d5bd 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -343,11 +343,7 @@ void Setup_Colors::setEntry(Slider *const s, TextField *const t,
if (s)
s->setValue(value);
if (t)
- {
- char buffer[100];
- sprintf(buffer, "%d", value);
- t->setText(buffer);
- }
+ t->setText(toString(value));
}
void Setup_Colors::apply()
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index b787c685e..b0a80eaa4 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -219,7 +219,6 @@ public:
void invite()
{
- // TODO - Give feedback on whether the invite succeeded
mInviteDialog = new TextDialog(_("Member Invite to Guild"),
strprintf(_("Who would you like to invite to guild %s?"),
mGuild->getName().c_str()),
@@ -393,7 +392,6 @@ public:
void invite()
{
- // TODO - Give feedback on whether the invite succeeded
mInviteDialog = new TextDialog(_("Member Invite to Party"),
strprintf(_("Who would you like to invite to party %s?"),
mParty->getName().c_str()),
@@ -1506,10 +1504,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
std::string name = mGuildCreateDialog->getText();
if (name.size() > 16)
- {
- // TODO : State too many characters in input.
return;
- }
Net::getGuildHandler()->create(name);
if (localChatTab)
@@ -1529,10 +1524,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
std::string name = mPartyCreateDialog->getText();
if (name.size() > 16)
- {
- // TODO : State too many characters in input.
return;
- }
Net::getPartyHandler()->create(name);
if (localChatTab)
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 935408714..0542bf6eb 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -517,7 +517,6 @@ void UpdaterWindow::download()
setLabel(mCurrentFile + " (0%)");
mDownloadComplete = false;
- // TODO: check return
mDownload->start();
}
@@ -648,7 +647,6 @@ void UpdaterWindow::logic()
switch (mDownloadStatus)
{
case UPDATE_ERROR:
- // TODO: Only send complete sentences to gettext
mBrowserBox->addRow("");
mBrowserBox->addRow(_("##1 The update process is incomplete."));
// TRANSLATORS: Continues "you try again later.".
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 9077da6c0..e378aef6c 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -183,7 +183,8 @@ UserPalette::~UserPalette()
if (col->grad == STATIC || col->grad == PULSE)
{
char buffer[20];
- sprintf(buffer, "0x%06x", col->getRGB());
+ snprintf(buffer, sizeof(buffer), "0x%06x", col->getRGB());
+ buffer[19] = 0;
config.setValue(configName, std::string(buffer));
}
}
@@ -286,7 +287,8 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb,
const std::string &configName = ColorTypeNames[type];
char buffer[20];
- sprintf(buffer, "0x%06x", rgb);
+ snprintf(buffer, sizeof(buffer), "0x%06x", rgb);
+ buffer[19] = 0;
const std::string rgbString = config.getValue(configName,
std::string(buffer));
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 35cd2aa32..2edd5d67b 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -516,8 +516,6 @@ int BrowserBox::calcHeight()
prevColor[1] = selColor[1];
bold = false;
- // TODO: Check if we must take texture size limits into account here
- // TODO: Check if some of the O(n) calls can be removed
for (size_t start = 0, end = std::string::npos;
start != std::string::npos;
start = end, end = std::string::npos)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index b4eef0352..95f46385b 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -174,7 +174,6 @@ void ChatTab::chatLog(std::string line, Own own,
break;
case BY_CHANNEL:
tmp.nick.clear();
- // TODO: Use a predefined color
lineColor = "##2"; // Equiv. to BrowserBox::GREEN
break;
case ACT_WHISPER:
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index ed9436c11..1f3d71192 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -133,8 +133,6 @@ void Tab::updateAlpha()
const float alpha = std::max(Client::getGuiAlpha(),
Theme::instance()->getMinimumOpacity());
- // TODO We don't need to do this for every tab on every draw
- // Maybe use a config listener to do it as the value changes.
if (alpha != mAlpha)
{
mAlpha = alpha;