summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-01 23:56:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-02 14:28:17 +0300
commit520a495c466793c29f3e721634dfe6cc616b8ede (patch)
tree749b67f5d4df83f6f4997dabeb66ec394eabccd7 /src/gui
parentf9030497b6196ce2fadb6b6ada5d784be227d9a6 (diff)
downloadmv-520a495c466793c29f3e721634dfe6cc616b8ede.tar.gz
mv-520a495c466793c29f3e721634dfe6cc616b8ede.tar.bz2
mv-520a495c466793c29f3e721634dfe6cc616b8ede.tar.xz
mv-520a495c466793c29f3e721634dfe6cc616b8ede.zip
Add missing const.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/focushandler.cpp7
-rw-r--r--src/gui/focushandler.h4
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/gui/popups/popupmenu.cpp12
-rw-r--r--src/gui/popups/popupmenu.h10
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/scrollarea.h4
-rw-r--r--src/gui/windows/changeemaildialog.cpp2
-rw-r--r--src/gui/windows/changepassworddialog.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp6
-rw-r--r--src/gui/windows/chatwindow.h6
-rw-r--r--src/gui/windows/itemamountwindow.cpp6
-rw-r--r--src/gui/windows/itemamountwindow.h14
-rw-r--r--src/gui/windows/logindialog.cpp2
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/gui/windows/unregisterdialog.cpp2
-rw-r--r--src/gui/windows/whoisonline.cpp2
-rw-r--r--src/gui/windows/whoisonline.h2
19 files changed, 49 insertions, 44 deletions
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index ced7c5f6e..4c832c566 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -109,8 +109,7 @@ void FocusHandler::releaseModalFocus(Widget *const widget)
if (mModalFocusedWidget == widget)
{
- if (mModalFocusedWidget == widget)
- mModalFocusedWidget = nullptr;
+ mModalFocusedWidget = nullptr;
/* Check if there were any previously modal widgets that'd still like
* to regain their modal focus.
@@ -353,7 +352,7 @@ void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent)
}
}
-void FocusHandler::requestFocus(Widget *const widget)
+void FocusHandler::requestFocus(const Widget *const widget)
{
if (!widget || widget == mFocusedWidget)
return;
@@ -400,7 +399,7 @@ void FocusHandler::requestModalMouseInputFocus(Widget *const widget)
mModalMouseInputFocusedWidget = widget;
}
-void FocusHandler::releaseModalMouseInputFocus(Widget *const widget)
+void FocusHandler::releaseModalMouseInputFocus(const Widget *const widget)
{
if (mModalMouseInputFocusedWidget == widget)
mModalMouseInputFocusedWidget = nullptr;
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index 58b317024..99ba45094 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -97,7 +97,7 @@ class FocusHandler final
* @param widget The widget to request focus for.
* @see isFocused, Widget::requestFocus
*/
- void requestFocus(Widget *const widget);
+ void requestFocus(const Widget *const widget);
/**
* Requests modal focus for a widget. Focus will only be granted
@@ -144,7 +144,7 @@ class FocusHandler final
* @param widget the widget to release modal mouse input focus for.
* @see requestModalMouseInputFocus, Widget::releaseModalMouseInputFocus
*/
- void releaseModalMouseInputFocus(Widget *const widget);
+ void releaseModalMouseInputFocus(const Widget *const widget);
/**
* Checks if a widget is focused.
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 7be573995..dda1cc64a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -1102,7 +1102,7 @@ void Gui::distributeGlobalFocusGainedEvent(const Event &focusEvent)
}
}
-void Gui::removeDragged(Widget *widget)
+void Gui::removeDragged(const Widget *const widget)
{
if (!mFocusHandler)
return;
@@ -1246,7 +1246,7 @@ Widget* Gui::getKeyEventSource() const
void Gui::distributeKeyEvent(KeyEvent &event) const
{
Widget* parent = event.getSource();
- Widget* widget = event.getSource();
+ Widget* widget = parent;
if (mFocusHandler->getModalFocused() && !widget->isModalFocused())
return;
diff --git a/src/gui/gui.h b/src/gui/gui.h
index b4f9991f0..43594ad9f 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -213,7 +213,7 @@ class Gui final
void distributeGlobalFocusGainedEvent(const Event &focusEvent);
- void removeDragged(Widget *widget);
+ void removeDragged(const Widget *const widget);
int getLastMouseX() const
{ return mLastMouseX; }
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index c8416f66d..9e6968464 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -311,7 +311,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
}
void PopupMenu::showPopup(const int x, const int y,
- std::vector<ActorSprite*> &beings)
+ const std::vector<ActorSprite*> &beings)
{
mX = x;
mY = y;
@@ -1543,7 +1543,7 @@ void PopupMenu::handleLink(const std::string &link,
std::list<std::string> mobs
= actorManager->getAttackMobs();
std::list<std::string>::iterator it = mobs.begin();
- std::list<std::string>::iterator it2 = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
while (it != mobs.end())
{
if (*it == mNick)
@@ -1574,7 +1574,7 @@ void PopupMenu::handleLink(const std::string &link,
std::list<std::string> mobs
= actorManager->getPriorityAttackMobs();
std::list<std::string>::iterator it = mobs.begin();
- std::list<std::string>::iterator it2 = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
while (it != mobs.end())
{
if (*it == mNick)
@@ -1605,7 +1605,7 @@ void PopupMenu::handleLink(const std::string &link,
std::list<std::string> mobs
= actorManager->getAttackMobs();
std::list<std::string>::iterator it = mobs.begin();
- std::list<std::string>::iterator it2 = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
while (it != mobs.end())
{
if (*it == mNick)
@@ -1640,7 +1640,7 @@ void PopupMenu::handleLink(const std::string &link,
std::list<std::string> mobs
= actorManager->getPriorityAttackMobs();
std::list<std::string>::iterator it = mobs.begin();
- std::list<std::string>::iterator it2 = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
while (it != mobs.end())
{
if (*it == mNick)
@@ -2906,7 +2906,7 @@ RenameListener::RenameListener() :
{
}
-void RenameListener::setMapItem(MapItem *const mapItem)
+void RenameListener::setMapItem(const MapItem *const mapItem)
{
if (mapItem)
{
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 8bdbd3b1b..94db12343 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -55,7 +55,7 @@ class RenameListener final : public ActionListener
void action(const ActionEvent &event) override final;
- void setMapItem(MapItem *const mapItem);
+ void setMapItem(const MapItem *const mapItem);
void setDialog(TextDialog *dialog)
{ mDialog = dialog; }
@@ -75,13 +75,13 @@ class PlayerListener : public ActionListener
void action(const ActionEvent &event) override final;
- void setNick(std::string name)
+ void setNick(const std::string &name)
{ mNick = name; }
- void setDialog(TextDialog *dialog)
+ void setDialog(TextDialog *const dialog)
{ mDialog = dialog; }
- void setType(int type)
+ void setType(const int type)
{ mType = type; }
private:
@@ -114,7 +114,7 @@ class PopupMenu final : public Popup, public LinkHandler
* Shows the beings related popup menu at the specified mouse coords.
*/
void showPopup(const int x, const int y,
- std::vector<ActorSprite*> &beings);
+ const std::vector<ActorSprite*> &beings);
void showPlayerPopup(const int x, const int y,
const std::string &nick);
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index b748e30a1..8761e3f7d 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -532,7 +532,7 @@ void ScrollArea::drawVBar(Graphics *const graphics) const
}
}
-void ScrollArea::calcVBar(Graphics *const graphics)
+void ScrollArea::calcVBar(const Graphics *const graphics)
{
const Rect &dim = getVerticalBarDimension();
@@ -587,7 +587,7 @@ void ScrollArea::drawHBar(Graphics *const graphics) const
}
}
-void ScrollArea::calcHBar(Graphics *const graphics)
+void ScrollArea::calcHBar(const Graphics *const graphics)
{
const Rect &dim = getHorizontalBarDimension();
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 0d540c399..01ec4e13c 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -451,8 +451,8 @@ class ScrollArea final : public BasicContainer,
void drawVMarker(Graphics *const graphics);
void drawHMarker(Graphics *const graphics);
- void calcVBar(Graphics *const graphics);
- void calcHBar(Graphics *const graphics);
+ void calcVBar(const Graphics *const graphics);
+ void calcHBar(const Graphics *const graphics);
void calcVMarker(Graphics *const graphics);
void calcHMarker(Graphics *const graphics);
diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp
index 0f4086a0b..420dc3b76 100644
--- a/src/gui/windows/changeemaildialog.cpp
+++ b/src/gui/windows/changeemaildialog.cpp
@@ -118,7 +118,7 @@ void ChangeEmailDialog::action(const ActionEvent &event)
}
else if (eventId == "change_email")
{
- const std::string username = mLoginData->username.c_str();
+ const std::string username = mLoginData->username;
const std::string &newFirstEmail = mFirstEmailField->getText();
const std::string &newSecondEmail = mSecondEmailField->getText();
logger->log("ChangeEmailDialog::Email change, Username is %s",
diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp
index eb7380f20..383b6a63e 100644
--- a/src/gui/windows/changepassworddialog.cpp
+++ b/src/gui/windows/changepassworddialog.cpp
@@ -97,7 +97,7 @@ void ChangePasswordDialog::action(const ActionEvent &event)
}
else if (eventId == "change_password")
{
- const std::string username = mLoginData->username.c_str();
+ const std::string username = mLoginData->username;
const std::string &oldPassword = mOldPassField->getText();
const std::string &newFirstPass = mFirstPassField->getText();
const std::string &newSecondPass = mSecondPassField->getText();
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 1b1973f63..ad646ce82 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1334,7 +1334,7 @@ void ChatWindow::autoComplete()
}
}
-std::string ChatWindow::autoComplete(StringVect &names,
+std::string ChatWindow::autoComplete(const StringVect &names,
std::string partName)
{
StringVectCIter i = names.begin();
@@ -1365,7 +1365,7 @@ std::string ChatWindow::autoComplete(StringVect &names,
}
std::string ChatWindow::autoComplete(const std::string &partName,
- History *const words) const
+ const History *const words) const
{
if (!words)
return "";
@@ -1605,7 +1605,7 @@ void ChatWindow::initTradeFilter()
}
}
-void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers) const
+void ChatWindow::updateOnline(const std::set<std::string> &onlinePlayers) const
{
const Party *party = nullptr;
const Guild *guild = nullptr;
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 3999d6b8a..114c6008c 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -240,7 +240,7 @@ class ChatWindow final : public Window,
const bool ignoreRecord = false,
const bool tryRemoveColors = true);
- void updateOnline(std::set<std::string> &onlinePlayers) const;
+ void updateOnline(const std::set<std::string> &onlinePlayers) const;
void loadState();
@@ -331,9 +331,9 @@ class ChatWindow final : public Window,
std::string autoCompleteHistory(const std::string &partName) const;
std::string autoComplete(const std::string &partName,
- History *const words) const;
+ const History *const words) const;
- static std::string autoComplete(StringVect &names,
+ static std::string autoComplete(const StringVect &names,
std::string partName);
/** Used for showing item popup on clicking links **/
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 9c2e039f9..92ceeae76 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -53,8 +53,10 @@
#include "debug.h"
-void ItemAmountWindow::finish(Item *const item, const int amount,
- const int price, const Usage usage)
+void ItemAmountWindow::finish(const Item *const item,
+ const int amount,
+ const int price,
+ const Usage usage)
{
switch (usage)
{
diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h
index d2dca064e..ec36265af 100644
--- a/src/gui/windows/itemamountwindow.h
+++ b/src/gui/windows/itemamountwindow.h
@@ -93,11 +93,15 @@ class ItemAmountWindow final : public Window,
~ItemAmountWindow();
private:
- static void finish(Item *const item, const int amount,
- const int price, const Usage usage);
-
- ItemAmountWindow(const Usage usage, Window *const parent,
- Item *const item, const int maxRange = 0);
+ static void finish(const Item *const item,
+ const int amount,
+ const int price,
+ const Usage usage);
+
+ ItemAmountWindow(const Usage usage,
+ Window *const parent,
+ Item *const item,
+ const int maxRange = 0);
IntTextField *mItemAmountTextField; /**< Item amount caption. */
IntTextField *mItemPriceTextField; /**< Item price caption. */
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index b2242d3f6..d1202dea7 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -302,7 +302,7 @@ void LoginDialog::prepareUpdate()
if (checkPath(mUpdateHostText->getText()))
{
mLoginData->updateHost = mUpdateHostText->getText();
- *mUpdateHost = mUpdateHostText->getText();
+ *mUpdateHost = mLoginData->updateHost;
}
else
{
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index a45c206f5..e76658b05 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -646,7 +646,7 @@ void StatusWindow::updateMoneyBar(ProgressBar *const bar)
return;
const int money = PlayerInfo::getAttribute(PlayerInfo::MONEY);
- bar->setText(Units::formatCurrency(money).c_str());
+ bar->setText(Units::formatCurrency(money));
if (money > 0)
{
const float progress = static_cast<float>(money)
diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp
index 3d8627add..e35c27aa2 100644
--- a/src/gui/windows/unregisterdialog.cpp
+++ b/src/gui/windows/unregisterdialog.cpp
@@ -110,7 +110,7 @@ void UnRegisterDialog::action(const ActionEvent &event)
}
else if (eventId == "unregister")
{
- const std::string username = mLoginData->username.c_str();
+ const std::string username = mLoginData->username;
const std::string &password = mPasswordField->getText();
logger->log("UnregisterDialog::unregistered, Username is %s",
username.c_str());
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 34ae7aa49..0bf05a129 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -292,7 +292,7 @@ void WhoIsOnline::handlerPlayerRelation(const std::string &nick,
}
}
-void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
+void WhoIsOnline::loadList(const std::vector<OnlinePlayer*> &list)
{
mBrowserBox->clearRows();
const size_t numOnline = list.size();
diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h
index 915150409..448321866 100644
--- a/src/gui/windows/whoisonline.h
+++ b/src/gui/windows/whoisonline.h
@@ -125,7 +125,7 @@ public:
*/
void loadWebList();
- void loadList(std::vector<OnlinePlayer*> &list);
+ void loadList(const std::vector<OnlinePlayer*> &list);
void handleLink(const std::string& link,
MouseEvent *event) override final;