diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-18 19:46:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-18 21:52:08 +0300 |
commit | c0d5142d1ed98b62ad87603fa9d2620dce256bd7 (patch) | |
tree | 6acc4c089999353ef39c83c3bef34bbf89dbfdd3 /src/gui/widgets | |
parent | e85c6227064c905945a4d49a5e11a0078243a1ac (diff) | |
download | manaplus-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.gz manaplus-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.bz2 manaplus-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.xz manaplus-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.zip |
add consts in gui classes.
Diffstat (limited to 'src/gui/widgets')
34 files changed, 44 insertions, 44 deletions
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp index 28081aed4..3f97af5b9 100644 --- a/src/gui/widgets/battletab.cpp +++ b/src/gui/widgets/battletab.cpp @@ -41,7 +41,7 @@ BattleTab::~BattleTab() { } -void BattleTab::saveToLogFile(const std::string &msg) +void BattleTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log(std::string("#Battle"), std::string(msg)); diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h index 2377cb591..35a0f1b66 100644 --- a/src/gui/widgets/battletab.h +++ b/src/gui/widgets/battletab.h @@ -40,7 +40,7 @@ class BattleTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_BATTLE; } - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; }; extern BattleTab *battleChatTab; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index f7dd927d2..804da2f18 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -280,7 +280,7 @@ void ChatTab::chatLog(std::string line, Own own, return; } - TabbedArea *const tabArea = getTabbedArea(); + const TabbedArea *const tabArea = getTabbedArea(); if (!tabArea) return; @@ -444,7 +444,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args) return handleCommand(type, args); } -void ChatTab::saveToLogFile(const std::string &msg) +void ChatTab::saveToLogFile(const std::string &msg) const { if (chatLogger) { diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 488f9bb2f..8722f894f 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -141,7 +141,7 @@ class ChatTab : public Tab */ virtual int getType() const A_WARN_UNUSED; - virtual void saveToLogFile(const std::string &msg); + virtual void saveToLogFile(const std::string &msg) const; std::list<std::string> &getRows() const A_WARN_UNUSED { return mTextOutput->getRows(); } diff --git a/src/gui/widgets/colormodel.cpp b/src/gui/widgets/colormodel.cpp index 4a3f15d11..68d31cf81 100644 --- a/src/gui/widgets/colormodel.cpp +++ b/src/gui/widgets/colormodel.cpp @@ -48,7 +48,7 @@ std::string ColorModel::getElementAt(int i) return mNames[i]; } -ColorPair *ColorModel::getColorAt(int i) +const ColorPair *ColorModel::getColorAt(const int i) const { if (i >= static_cast<int>(mColors.size()) || i < 0) return nullptr; @@ -56,8 +56,8 @@ ColorPair *ColorModel::getColorAt(int i) return &mColors[i]; } -void ColorModel::add(const std::string &name, const gcn::Color *color1, - const gcn::Color *color2) +void ColorModel::add(const std::string &name, const gcn::Color *const color1, + const gcn::Color *const color2) { mNames.push_back(name); mColors.push_back(ColorPair(color1, color2)); diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h index 5ce7629a4..aaa988846 100644 --- a/src/gui/widgets/colormodel.h +++ b/src/gui/widgets/colormodel.h @@ -55,7 +55,7 @@ class ColorModel : public gcn::ListModel virtual std::string getElementAt(int i) override A_WARN_UNUSED; - virtual ColorPair *getColorAt(int i) A_WARN_UNUSED; + virtual const ColorPair *getColorAt(const int i) const A_WARN_UNUSED; StringVect &getNames() A_WARN_UNUSED { return mNames; } @@ -63,8 +63,8 @@ class ColorModel : public gcn::ListModel size_t size() A_WARN_UNUSED { return mNames.size(); } - void add(const std::string &name, const gcn::Color *color1, - const gcn::Color *color2); + void add(const std::string &name, const gcn::Color *const color1, + const gcn::Color *const color2); static ColorModel *createDefault(const Widget2 *const widget); diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index fb75cf3da..2fb3a50bc 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -48,7 +48,7 @@ void ColorPage::draw(gcn::Graphics *graphics) { BLOCK_START("ColorPage::draw") - ColorModel *const model = static_cast<ColorModel* const>( + const ColorModel *const model = static_cast<ColorModel* const>( mListModel); Graphics *const g = static_cast<Graphics *const>(graphics); diff --git a/src/gui/widgets/gmtab.cpp b/src/gui/widgets/gmtab.cpp index 71d59d44a..c8bf8ac98 100644 --- a/src/gui/widgets/gmtab.cpp +++ b/src/gui/widgets/gmtab.cpp @@ -51,7 +51,7 @@ void GmTab::handleCommand(const std::string &msg A_UNUSED) { } -void GmTab::saveToLogFile(const std::string &msg) +void GmTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log("#GM", msg); diff --git a/src/gui/widgets/gmtab.h b/src/gui/widgets/gmtab.h index 64a53b1fc..53e4e9644 100644 --- a/src/gui/widgets/gmtab.h +++ b/src/gui/widgets/gmtab.h @@ -38,7 +38,7 @@ class GmTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_GM; } - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; protected: void getAutoCompleteList(StringVect &names) const override; diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index 4e18eb16a..99723e7e4 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -134,7 +134,7 @@ void GuildChatTab::getAutoCompleteList(StringVect &names) const names.push_back("/notice "); } -void GuildChatTab::saveToLogFile(const std::string &msg) +void GuildChatTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log("#Guild", msg); diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index 03170626b..e60970b50 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -42,7 +42,7 @@ class GuildChatTab final : public ChatTab, public ConfigListener void showHelp() override; - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; int getType() const override A_WARN_UNUSED { return ChatTab::TAB_GUILD; } diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index 9ce676cd5..1d48c7159 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -40,7 +40,7 @@ void HorizontContainer::add(gcn::Widget *widget) add(widget, mSpacing); } -void HorizontContainer::add(gcn::Widget *widget, int spacing) +void HorizontContainer::add(gcn::Widget *const widget, const int spacing) { if (!widget) return; diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index b326c4698..1deb8f3ea 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -43,7 +43,7 @@ class HorizontContainer final : public Container, public gcn::WidgetListener void add(gcn::Widget *widget) override; - void add(gcn::Widget *widget, int spacing); + void add(gcn::Widget *const widget, const int spacing); void clear() override; diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 0a2e61e25..fd70e2032 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -114,7 +114,7 @@ void ItemLinkHandler::handleLink(const std::string &link, if (!mItemPopup || link.empty()) return; - char ch = link[0]; + const char ch = link[0]; if (ch < '0' || ch > '9') return; @@ -125,7 +125,7 @@ void ItemLinkHandler::handleLink(const std::string &link, int color = 1; if (str.size() > 1) color = str[1]; - int id = str[0]; + const int id = str[0]; if (id > 0) { const ItemInfo &itemInfo = ItemDB::get(id); diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 90c8f6f66..29bd39af9 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -109,7 +109,7 @@ void Label::draw(gcn::Graphics* graphics) void Label::adjustSize() { - gcn::Font *const font = getFont(); + const gcn::Font *const font = getFont(); const int pad2 = 2 * mPadding; setWidth(font->getWidth(mCaption) + pad2); setHeight(font->getHeight() + pad2); diff --git a/src/gui/widgets/langtab.cpp b/src/gui/widgets/langtab.cpp index ddad893b9..1ee4eef75 100644 --- a/src/gui/widgets/langtab.cpp +++ b/src/gui/widgets/langtab.cpp @@ -36,7 +36,7 @@ LangTab::~LangTab() { } -void LangTab::saveToLogFile(const std::string &msg) +void LangTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log(std::string("#Lang"), std::string(msg)); diff --git a/src/gui/widgets/langtab.h b/src/gui/widgets/langtab.h index e4359a9e5..0a0ff48c3 100644 --- a/src/gui/widgets/langtab.h +++ b/src/gui/widgets/langtab.h @@ -35,7 +35,7 @@ class LangTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_LANG; } - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; }; extern LangTab *langChatTab; diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index f5b926ad7..0889bac15 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -57,7 +57,7 @@ ListBox::ListBox(const Widget2 *const widget, Theme *const theme = Theme::instance(); if (theme) - mSkin = Theme::instance()->load(skin, "listbox.xml"); + mSkin = theme->load(skin, "listbox.xml"); if (mSkin) mPadding = mSkin->getPadding(); diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 452dfe1b4..3b382f38a 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -105,7 +105,7 @@ int PopupList::getSelected() const return mListBox->getSelected(); } -void PopupList::setListModel(gcn::ListModel *model) +void PopupList::setListModel(gcn::ListModel *const model) { if (mListBox) mListBox->setListModel(model); diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 9f84b454a..1ffb2d74c 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -52,7 +52,7 @@ class PopupList final : public Popup, int getSelected() const; - void setListModel(gcn::ListModel *model); + void setListModel(gcn::ListModel *const model); gcn::ListModel *getListModel() const { return mListModel; } diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp index 589997660..73d34afce 100644 --- a/src/gui/widgets/radiogroup.cpp +++ b/src/gui/widgets/radiogroup.cpp @@ -31,7 +31,7 @@ RadioGroup::RadioGroup(const Widget2 *const widget, { } -gcn::Widget *RadioGroup::createWidget(const std::string &text) +gcn::Widget *RadioGroup::createWidget(const std::string &text) const { RadioButton *const widget = new RadioButton( this, text, mGroup, mCount == 0); diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h index 60348e4ac..a6c54c15a 100644 --- a/src/gui/widgets/radiogroup.h +++ b/src/gui/widgets/radiogroup.h @@ -35,7 +35,7 @@ class RadioGroup final : public WidgetGroup A_DELETE_COPY(RadioGroup) gcn::Widget *createWidget(const std::string &name) - override A_WARN_UNUSED; + const override A_WARN_UNUSED; }; #endif // GUI_WIDGETS_RADIOGROUP_H diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index 739ed07e7..d8d6eda9a 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -64,7 +64,7 @@ TouchActionsModel::TouchActionsModel() : int cnt = 0; FOR_EACH (std::vector<SetupActionData*>::iterator, it, data) { - const SetupActionData *data1 = *it; + const SetupActionData *const data1 = *it; mNames.push_back(data1->name); mActionId.push_back(data1->actionId); mActionToSelection[data1->actionId] = cnt; @@ -81,7 +81,7 @@ int TouchActionsModel::getActionFromSelection(const int sel) const int TouchActionsModel::getSelectionFromAction(const int action) const { - std::map<int, int>::const_iterator it + const std::map<int, int>::const_iterator it = mActionToSelection.find(action); if (it == mActionToSelection.end()) return 0; diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index e49486329..d71b88e85 100644 --- a/src/gui/widgets/skillinfo.cpp +++ b/src/gui/widgets/skillinfo.cpp @@ -122,7 +122,7 @@ void SkillInfo::addData(const int level1, SkillData *const data1) SkillData *SkillInfo::getData(const int level1) const { - SkillDataMapCIter it = dataMap.find(level1); + const SkillDataMapCIter it = dataMap.find(level1); if (it == dataMap.end()) return nullptr; return (*it).second; @@ -130,7 +130,7 @@ SkillData *SkillInfo::getData(const int level1) const SkillData *SkillInfo::getData1(const int lev) const { - SkillDataMapCIter it = dataMap.find(lev); + const SkillDataMapCIter it = dataMap.find(lev); if (it == dataMap.end()) return (*dataMap.begin()).second; return (*it).second; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index acb638889..a08b8430e 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -230,7 +230,7 @@ bool TabbedArea::isTabSelected(const unsigned int index) const return mSelectedTab == mTabs[index].first; } -bool TabbedArea::isTabSelected(Tab *const tab) const +bool TabbedArea::isTabSelected(const Tab *const tab) const { return mSelectedTab == tab; } @@ -627,7 +627,7 @@ gcn::Widget *TabbedArea::getWidgetByIndex(const int index) const return mTabs[index].second; } -void TabbedArea::removeAll(bool del) +void TabbedArea::removeAll(const bool del) { if (getSelectedTabIndex() != -1) { diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 034257e8f..dd74405fc 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -100,14 +100,14 @@ class TabbedArea final : public Widget2, bool isTabSelected(const unsigned int index) const A_WARN_UNUSED; - bool isTabSelected(Tab *const tab) const A_WARN_UNUSED; + bool isTabSelected(const Tab *const tab) const A_WARN_UNUSED; /** * Overload the remove tab function as it's broken in guichan 0.8. */ void removeTab(Tab *const tab); - void removeAll(bool del = true); + void removeAll(const bool del = true); /** * Overload the logic function since it's broken in guichan 0.8. diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index d0d0ae4b8..8efd7002f 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -37,7 +37,7 @@ TabStrip::TabStrip(const Widget2 *const widget, { } -gcn::Widget *TabStrip::createWidget(const std::string &text) +gcn::Widget *TabStrip::createWidget(const std::string &text) const { Button *const widget = new Button(this); widget->setStick(true); diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h index ed812bc9f..0873290b5 100644 --- a/src/gui/widgets/tabstrip.h +++ b/src/gui/widgets/tabstrip.h @@ -38,7 +38,7 @@ class TabStrip final : public WidgetGroup A_DELETE_COPY(TabStrip) gcn::Widget *createWidget(const std::string &name) - override A_WARN_UNUSED; + const override A_WARN_UNUSED; void action(const gcn::ActionEvent &event) override; }; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 53f071d3d..bf79f80ba 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -87,7 +87,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) text.substr(lastNewlinePos, newlinePos - lastNewlinePos); size_t lastSpacePos = 0; xpos = 0; - gcn::Font *const font = getFont(); + const gcn::Font *const font = getFont(); const int spaceWidth = font->getWidth(" "); size_t sz = line.size(); diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp index fbb36f94a..f266f1c8c 100644 --- a/src/gui/widgets/tradetab.cpp +++ b/src/gui/widgets/tradetab.cpp @@ -44,7 +44,7 @@ void TradeTab::handleInput(const std::string &msg) ChatTab::handleInput(str); } -void TradeTab::saveToLogFile(const std::string &msg) +void TradeTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log(std::string("#Trade"), std::string(msg)); diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h index 01b6b0946..6948a81ff 100644 --- a/src/gui/widgets/tradetab.h +++ b/src/gui/widgets/tradetab.h @@ -40,7 +40,7 @@ class TradeTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_TRADE; } - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; protected: void handleInput(const std::string &msg) override; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index b836ee729..01298880e 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -163,7 +163,7 @@ bool WhisperTab::handleCommand(const std::string &type, return true; } -void WhisperTab::saveToLogFile(const std::string &msg) +void WhisperTab::saveToLogFile(const std::string &msg) const { if (chatLogger) chatLogger->log(getNick(), msg); diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index a28bd4a2e..599350c90 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -44,7 +44,7 @@ class WhisperTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_WHISPER; } - void saveToLogFile(const std::string &msg) override; + void saveToLogFile(const std::string &msg) const override; void setWhisperTabColors(); diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index b7ec6bd29..55507f316 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -54,7 +54,7 @@ class WidgetGroup : public Container, void widgetResized(const gcn::Event &event) override; virtual Widget *createWidget(const std::string &name) - A_WARN_UNUSED = 0; + const A_WARN_UNUSED = 0; protected: int mSpacing; |