summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-01 20:49:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-02 00:37:51 +0300
commit4df121e6dcdf53436f50ce81dd60096ce0138a2c (patch)
tree7cadc707bb49e4c148ba9c182075697a9643e20a /src/gui
parented3410d7eb61593a2235ddba97ce257c85e405a6 (diff)
downloadmanaverse-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.gz
manaverse-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.bz2
manaverse-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.xz
manaverse-4df121e6dcdf53436f50ce81dd60096ce0138a2c.zip
Add const to more classes.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/shopwindow.cpp2
-rw-r--r--src/gui/shopwindow.h2
-rw-r--r--src/gui/socialwindow.cpp8
-rw-r--r--src/gui/widgets/avatarlistbox.cpp6
-rw-r--r--src/gui/widgets/avatarlistbox.h2
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/layout.cpp2
-rw-r--r--src/gui/widgets/layout.h2
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h2
-rw-r--r--src/gui/widgets/scrollarea.cpp2
-rw-r--r--src/gui/widgets/setupitem.cpp5
-rw-r--r--src/gui/widgets/setupitem.h4
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tab.cpp2
-rw-r--r--src/gui/windowmenu.cpp2
20 files changed, 28 insertions, 27 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index a22ff6a28..829d45d14 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -69,7 +69,7 @@ static const int SLOTS_PER_ROW = 5;
class CharDeleteConfirm : public ConfirmDialog
{
public:
- CharDeleteConfirm(CharSelectDialog *m, int index):
+ CharDeleteConfirm(CharSelectDialog *const m, const int index) :
ConfirmDialog(_("Confirm Character Delete"),
_("Are you sure you want to delete this character?"),
false, false, m),
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index e05cee111..a75b8d810 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -850,7 +850,7 @@ int ShopWindow::sumAmount(const Item *const shopItem)
return sum;
}
-bool ShopWindow::isShopEmpty()
+bool ShopWindow::isShopEmpty() const
{
if (!mBuyShopItems || !mSellShopItems)
return true;
diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h
index 58725afcf..874353873 100644
--- a/src/gui/shopwindow.h
+++ b/src/gui/shopwindow.h
@@ -136,7 +136,7 @@ class ShopWindow : public Window, public gcn::ActionListener,
bool checkFloodCounter(int &counterTime) const;
- bool isShopEmpty();
+ bool isShopEmpty() const;
private:
void startTrade();
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index eb0dc5549..2db0efb85 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -581,7 +581,7 @@ private:
class SocialNavigationTab : public SocialTab
{
public:
- SocialNavigationTab(bool showBackground) :
+ SocialNavigationTab(const bool showBackground) :
mBeings(new BeingsListModal())
{
mList = new AvatarListBox(mBeings);
@@ -916,7 +916,7 @@ protected:
class SocialAttackTab : public SocialTab
{
public:
- SocialAttackTab(bool showBackground) :
+ SocialAttackTab(const bool showBackground) :
mBeings(new BeingsListModal())
{
mList = new AvatarListBox(mBeings);
@@ -971,7 +971,7 @@ private:
class SocialPickupTab : public SocialTab
{
public:
- SocialPickupTab(bool showBackground) :
+ SocialPickupTab(const bool showBackground) :
mBeings(new BeingsListModal())
{
mList = new AvatarListBox(mBeings);
@@ -1068,7 +1068,7 @@ public:
if (!actorSpriteManager)
return;
- std::vector<Avatar*> *avatars = mBeings->getMembers();
+ std::vector<Avatar*> *const avatars = mBeings->getMembers();
if (!avatars)
return;
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index b33233d73..b54b3d945 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -45,7 +45,7 @@ int AvatarListBox::instances = 0;
Image *AvatarListBox::onlineIcon = nullptr;
Image *AvatarListBox::offlineIcon = nullptr;
-AvatarListBox::AvatarListBox(AvatarListModel *model):
+AvatarListBox::AvatarListBox(AvatarListModel *const model) :
ListBox(model),
mShowGender(config.getBoolValue("showgender")),
mShowLevel(config.getBoolValue("showlevel")),
@@ -344,8 +344,8 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
const Avatar *const avatar = model->getAvatarAt(selected);
if (avatar)
{
- Being *const being = actorSpriteManager->findBeingByName(
- avatar->getName(), Being::PLAYER);
+ const Being *const being = actorSpriteManager
+ ->findBeingByName(avatar->getName(), Being::PLAYER);
if (being)
viewport->showPopup(being);
else
diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h
index b2b135a9c..0148a24d0 100644
--- a/src/gui/widgets/avatarlistbox.h
+++ b/src/gui/widgets/avatarlistbox.h
@@ -46,7 +46,7 @@ public:
class AvatarListBox : public ListBox, public ConfigListener
{
public:
- AvatarListBox(AvatarListModel *model);
+ AvatarListBox(AvatarListModel *const model);
~AvatarListBox();
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 2f475db88..3f253932b 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -196,7 +196,7 @@ Button::~Button()
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < BUTTON_COUNT; mode ++)
theme->unloadRect(button[mode]);
}
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index bb18ff2dd..0aab1f165 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -139,7 +139,7 @@ DropDown::~DropDown()
void DropDown::updateAlpha()
{
- float alpha = std::max(Client::getGuiAlpha(),
+ const float alpha = std::max(Client::getGuiAlpha(),
Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index d530a1594..04c6de606 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -391,7 +391,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event)
else if (itemId < SKILL_MIN_ID && spellManager)
{
mItemPopup->setVisible(false);
- TextCommand *const spell = spellManager->getSpellByItem(itemId);
+ const TextCommand *const spell = spellManager->getSpellByItem(itemId);
if (spell && viewport)
{
mSpellPopup->setItem(spell);
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 1597cdc33..bfb190e41 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -226,7 +226,7 @@ LayoutCell &LayoutArray::place(gcn::Widget *const widget, const int x,
void LayoutArray::align(int &pos, int &size, const int dim,
LayoutCell const &cell, const int *const sizes,
- int sizeCount) const
+ const int sizeCount) const
{
int size_max = sizes[0];
int cnt = cell.mExtent[dim];
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index a30cff1e1..71de85320 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -130,7 +130,7 @@ class LayoutArray
* Gets the position and size of a widget along a given axis
*/
void align(int &pos, int &size, const int dim, LayoutCell const &cell,
- const int *const sizes, int sizeCount) const;
+ const int *const sizes, const int sizeCount) const;
/**
* Ensures the private vectors are large enough.
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 2a4065ac2..8c0e938ba 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -138,7 +138,7 @@ void Popup::setContentSize(int width, int height)
mRedraw = true;
}
-void Popup::setLocationRelativeTo(gcn::Widget *const widget)
+void Popup::setLocationRelativeTo(const gcn::Widget *const widget)
{
if (!widget)
return;
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 61aac98c1..2442aa220 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -83,7 +83,7 @@ class Popup : public Container, public gcn::MouseListener,
/**
* Sets the location relative to the given widget.
*/
- void setLocationRelativeTo(gcn::Widget *const widget);
+ void setLocationRelativeTo(const gcn::Widget *const widget);
void mouseMoved(gcn::MouseEvent &event);
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index b752eb245..28532927b 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -91,7 +91,7 @@ ScrollArea::~ScrollArea()
delete getContent();
instances--;
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
if (theme)
{
theme->unloadRect(background);
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index a835bf51a..f569fddb5 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -125,7 +125,7 @@ void SetupItem::load()
}
}
-void SetupItem::save()
+void SetupItem::save() const
{
Configuration *const cfg = getConfig();
cfg->setValue(mKeyName, mValue);
@@ -629,7 +629,8 @@ SetupItemSlider::SetupItemSlider(std::string text, std::string description,
}
SetupItemSlider::SetupItemSlider(std::string text, std::string description,
- std::string keyName, SetupTabScroll *parent,
+ std::string keyName,
+ SetupTabScroll *const parent,
std::string eventName,
const double min, const double max,
std::string def, const int width,
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 32304ac22..f1ec4d23b 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -72,7 +72,7 @@ class SetupItem : public gcn::ActionListener
void load();
- void save();
+ void save() const;
virtual void fromWidget() = 0;
@@ -288,7 +288,7 @@ class SetupItemSlider : public SetupItem
const bool mainConfig = true);
SetupItemSlider(std::string text, std::string description,
- std::string keyName, SetupTabScroll *parent,
+ std::string keyName, SetupTabScroll *const parent,
std::string eventName,
const double min, const double max,
std::string def, const int width = 150,
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index c5eac9769..da6cb31f6 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -62,7 +62,7 @@ Slider::~Slider()
mInstances--;
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < 2; mode ++)
theme->unloadRect(buttons[mode]);
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ec79ccb93..2a3799ca8 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -279,7 +279,7 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event)
(mNumber * SPELL_SHORTCUT_ITEMS) + index);
mSpellPopup->setVisible(false);
- TextCommand *const spell = spellManager->getSpell(itemId);
+ const TextCommand *const spell = spellManager->getSpell(itemId);
if (spell && !spell->isEmpty())
{
mSpellPopup->setItem(spell);
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index bf37a643e..eb470cc02 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -78,7 +78,7 @@ Tab::~Tab()
mInstances--;
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < TAB_COUNT; mode ++)
theme->unloadRect(tabImg[mode]);
}
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 0e25c1f18..5a81f73be 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -228,7 +228,7 @@ void WindowMenu::addButton(const char *const text,
const std::string &description,
int &x, int &h, const int key, const bool visible)
{
- Button *btn = new Button(gettext(text), text, this);
+ Button *const btn = new Button(gettext(text), text, this);
btn->setPosition(x, 0);
btn->setDescription(description);
btn->setTag(key);