diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-08 13:51:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-08 17:55:40 +0300 |
commit | 9247c5a23757e01ef7ee91dd5655fcab177e5e6d (patch) | |
tree | 38e947cdaa6f1ec33651560b81851b7a255a58ac | |
parent | fcf53dd7d524c2204f39269be5768a1919daef42 (diff) | |
download | mv-9247c5a23757e01ef7ee91dd5655fcab177e5e6d.tar.gz mv-9247c5a23757e01ef7ee91dd5655fcab177e5e6d.tar.bz2 mv-9247c5a23757e01ef7ee91dd5655fcab177e5e6d.tar.xz mv-9247c5a23757e01ef7ee91dd5655fcab177e5e6d.zip |
fix code style.
28 files changed, 39 insertions, 61 deletions
diff --git a/src/events/inputguievent.h b/src/events/inputguievent.h index dbd2593d7..e42bec27f 100644 --- a/src/events/inputguievent.h +++ b/src/events/inputguievent.h @@ -81,7 +81,7 @@ class InputGuiEvent: public Event * @param source The source widget of the event. * @param isMetaPressed True if meta is pressed, false otherwise. */ - InputGuiEvent(Widget *const source) : + explicit InputGuiEvent(Widget *const source) : Event(source), mIsConsumed(false) { } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d5fbd6e86..55da1b9e3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -72,8 +72,6 @@ #include "gui/theme.h" #include "gui/viewport.h" -#include "events/mouseevent.h" - #include "gui/widgets/window.h" #include "client.h" @@ -1337,8 +1335,8 @@ void Gui::handleModalMouseInputFocus() } // Check if modal mouse input focus has been released. else if ((mFocusHandler->getLastWidgetWithModalMouseInputFocus() - != mFocusHandler->getModalMouseInputFocused()) - && (mFocusHandler->getLastWidgetWithModalMouseInputFocus())) + != mFocusHandler->getModalMouseInputFocused()) + && (mFocusHandler->getLastWidgetWithModalMouseInputFocus())) { handleModalFocusReleased(); mFocusHandler->setLastWidgetWithModalMouseInputFocus(nullptr); @@ -1360,8 +1358,8 @@ void Gui::handleModalFocus() } // Check if modal focus has been released. else if ((mFocusHandler->getLastWidgetWithModalFocus() - != mFocusHandler->getModalFocused()) - && (mFocusHandler->getLastWidgetWithModalFocus())) + != mFocusHandler->getModalFocused()) + && (mFocusHandler->getLastWidgetWithModalFocus())) { handleModalFocusReleased(); mFocusHandler->setLastWidgetWithModalFocus(nullptr); diff --git a/src/gui/models/beingslistmodel.h b/src/gui/models/beingslistmodel.h index 9f3c48bcc..f774321e9 100644 --- a/src/gui/models/beingslistmodel.h +++ b/src/gui/models/beingslistmodel.h @@ -24,6 +24,10 @@ #include "gui/models/avatarlistmodel.h" +#include "utils/dtor.h" + +#include <vector> + class BeingsListModel final : public AvatarListModel { public: diff --git a/src/gui/models/playerrelationlistmodel.h b/src/gui/models/playerrelationlistmodel.h index bc343de02..84531852d 100644 --- a/src/gui/models/playerrelationlistmodel.h +++ b/src/gui/models/playerrelationlistmodel.h @@ -25,6 +25,8 @@ #include "being/playerrelations.h" +#include "gui/models/listmodel.h" + #include "utils/gettext.h" static const char *const RELATION_NAMES[PlayerRelation::RELATIONS_NR] = diff --git a/src/gui/models/serverslistmodel.h b/src/gui/models/serverslistmodel.h index 630d9664e..5c7e73387 100644 --- a/src/gui/models/serverslistmodel.h +++ b/src/gui/models/serverslistmodel.h @@ -25,17 +25,18 @@ #include "net/serverinfo.h" +#include "gui/font.h" +#include "gui/gui.h" + +#include "gui/windows/serverdialog.h" + #include "utils/mutex.h" #include "gui/models/listmodel.h" -#include "net/serverinfo.h" - #include <string> #include <vector> -class ServerDialog; - /** * Server and Port List Model */ diff --git a/src/gui/models/worldlistmodel.h b/src/gui/models/worldlistmodel.h index 7d9dc322c..6913e1c69 100644 --- a/src/gui/models/worldlistmodel.h +++ b/src/gui/models/worldlistmodel.h @@ -25,6 +25,8 @@ #include "gui/models/listmodel.h" +#include "utils/stringutils.h" + #include "net/worldinfo.h" /** diff --git a/src/gui/widgets/basiccontainer.h b/src/gui/widgets/basiccontainer.h index bf018e0de..6e753a445 100644 --- a/src/gui/widgets/basiccontainer.h +++ b/src/gui/widgets/basiccontainer.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GCN_BASICCONTAINER_HPP -#define GCN_BASICCONTAINER_HPP +#ifndef GUI_WIDGETS_BASICCONTAINER_H +#define GUI_WIDGETS_BASICCONTAINER_H #include <vector> @@ -212,4 +212,4 @@ class BasicContainer : public Widget, WidgetList mWidgets; }; -#endif // end GCN_BASICCONTAINER_HPP +#endif // GUI_WIDGETS_BASICCONTAINER_H diff --git a/src/gui/widgets/basiccontainer2.cpp b/src/gui/widgets/basiccontainer2.cpp index 5a34ee0dc..9bd4d1593 100644 --- a/src/gui/widgets/basiccontainer2.cpp +++ b/src/gui/widgets/basiccontainer2.cpp @@ -67,8 +67,6 @@ #include "gui/widgets/basiccontainer2.h" -#include "render/graphics.h" - #include "debug.h" BasicContainer2::BasicContainer2(const Widget2 *const widget) : diff --git a/src/gui/widgets/basiccontainer2.h b/src/gui/widgets/basiccontainer2.h index 16078016f..c6f1d996b 100644 --- a/src/gui/widgets/basiccontainer2.h +++ b/src/gui/widgets/basiccontainer2.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GUI_WIDGETS_BASICCONTAINER2_HPP -#define GUI_WIDGETS_BASICCONTAINER2_HPP +#ifndef GUI_WIDGETS_BASICCONTAINER2_H +#define GUI_WIDGETS_BASICCONTAINER2_H #include "gui/widgets/basiccontainer.h" @@ -171,4 +171,4 @@ class BasicContainer2: public BasicContainer bool mOpaque; }; -#endif // GUI_WIDGETS_BASICCONTAINER2_HPP +#endif // GUI_WIDGETS_BASICCONTAINER2_H diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 8e020370f..308c75413 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -220,7 +220,6 @@ Button::Button(const Widget2 *const widget, mStick(false), mPressed(false) { - init(); loadImageSet(imageName); adjustSize(); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index c905ae0c4..f01495bcf 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -67,8 +67,6 @@ #include "client.h" -#include "events/keyevent.h" - #include "input/keydata.h" #include "resources/image.h" diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 64dce1a84..b500ec7bb 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -88,7 +88,7 @@ Label::Label(const Widget2 *const widget, mAlignment(Graphics::LEFT), mPadding(0) { - Font *const font = getFont(); + const Font *const font = getFont(); if (font) { setWidth(font->getWidth(caption)); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index c12a3fe53..6f0c192c6 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -67,8 +67,6 @@ #include "client.h" -#include "events/keyevent.h" - #include "input/keydata.h" #include "listeners/selectionlistener.h" @@ -79,8 +77,6 @@ #include "gui/models/listmodel.h" -#include "render/graphics.h" - #include "debug.h" float ListBox::mAlpha = 1.0; diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index aae2eefe6..1a9067378 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_PLAYERBOX_H #define GUI_WIDGETS_PLAYERBOX_H -#include "gui/widgets/scrollarea.h" +#include "gui/widgets/widget.h" #include "listeners/mouselistener.h" diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 1aa77a0db..411216455 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -67,8 +67,6 @@ #include "client.h" -#include "events/keyevent.h" - #include "input/keydata.h" #include "resources/image.h" diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 8da4f34ae..700d31416 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -100,7 +100,6 @@ Slider::Slider(Widget2 *const widget, mOrientation(HORIZONTAL), mVertexes(new ImageCollection), mMarkerLength(10), - mDragged(false), mHasMouse(false), mRedraw(true) { @@ -120,7 +119,6 @@ Slider::Slider(Widget2 *const widget, mOrientation(HORIZONTAL), mVertexes(new ImageCollection), mMarkerLength(10), - mDragged(false), mHasMouse(false), mRedraw(true) { diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 3fbb66a5c..23d06de48 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -348,11 +348,6 @@ class Slider final : public Widget, */ int mMarkerLength; - /** - * True if the slider is dragged, false otherwise. - */ - bool mDragged; - bool mHasMouse; bool mRedraw; }; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index c075cbc62..445f17982 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -75,8 +75,6 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabs/tab.h" -#include "gui/widgets/basiccontainer2.h" - #include "debug.h" TabbedArea::TabbedArea(const Widget2 *const widget) : diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index a00d0ccf8..5f565259b 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -65,8 +65,6 @@ #include "gui/widgets/textbox.h" -#include "events/keyevent.h" - #include "input/keydata.h" #include "gui/font.h" @@ -567,16 +565,13 @@ void TextBox::setCaretRowColumn(const int row, const int column) void TextBox::scrollToCaret() { + const Font *const font = getFont(); Rect scroll; - Font *const font = getFont(); - scroll.x = font->getWidth( - mTextRows[mCaretRow].substr(0, mCaretColumn)); + scroll.x = font->getWidth(mTextRows[mCaretRow].substr(0, mCaretColumn)); scroll.y = font->getHeight() * mCaretRow; scroll.width = font->getWidth(" "); - // add 2 for some extra space scroll.height = font->getHeight() + 2; - showPart(scroll); } @@ -619,7 +614,7 @@ void TextBox::drawCaret(Graphics *const graphics, const int x, const int y) void TextBox::adjustSize() { int width = 0; - Font *const font = getFont(); + const Font *const font = getFont(); for (size_t i = 0, sz = mTextRows.size(); i < sz; ++i) { const int w = font->getWidth(mTextRows[i]); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 98e852b00..7fe8c1bf3 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -69,8 +69,6 @@ #include "input/inputmanager.h" -#include "events/keyevent.h" - #include "gui/font.h" #include "gui/gui.h" #include "gui/viewport.h" diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 71915ab08..e9436bd34 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -351,7 +351,7 @@ void ChatWindow::adjustTabSize() { const int chatButtonSize = 20; int w = awFrame2 - chatButtonSize; - int x = aw - frame - chatButtonSize; + const int x = aw - frame - chatButtonSize; if (mSkin) { const int ipad = mSkin->getOption("emoteButtonSpacing", 2); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index a12dca882..92b21dfd1 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -59,8 +59,6 @@ #include "net/inventoryhandler.h" #include "net/net.h" -#include "utils/gettext.h" - #include <string> #include "debug.h" @@ -281,7 +279,7 @@ InventoryWindow::~InventoryWindow() mTextPopup = nullptr; } -void InventoryWindow::storeSortOrder() +void InventoryWindow::storeSortOrder() const { if (mInventory) { @@ -669,7 +667,8 @@ void InventoryWindow::updateButtons(const Item *item) void InventoryWindow::setSplitAllowed(const bool allowed) { - mSplitButton->setVisible(allowed); + if (mSplitButton) + mSplitButton->setVisible(allowed); } void InventoryWindow::close() @@ -699,7 +698,7 @@ void InventoryWindow::processEvent(const Channels channel A_UNUSED, void InventoryWindow::updateWeight() { - if (!isMainInventory()) + if (!isMainInventory() || !mWeightBar) return; const int total = PlayerInfo::getAttribute(PlayerInfo::TOTAL_WEIGHT); diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index c81e83d77..7e47e0362 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -71,7 +71,7 @@ class InventoryWindow final : public Window, void postInit() override final; - void storeSortOrder(); + void storeSortOrder() const; /** * Called when receiving actions from the widgets. diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index f4557a460..456af0ebb 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -34,7 +34,6 @@ #include "being/playerinfo.h" #include "utils/gettext.h" -#include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 506f25c17..443c38619 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -440,7 +440,7 @@ void TradeWindow::initTrade(const std::string &nick) const Inventory *const inv = PlayerInfo::getInventory(); if (inv) { - Item *const item = inv->findItem(mAutoAddItem->getId(), + const Item *const item = inv->findItem(mAutoAddItem->getId(), mAutoAddItem->getColor()); if (item) tradeItem(item, mAutoAddAmount); diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index df1516b8b..174263dcd 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -291,7 +291,7 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) const client->setState(STATE_ERROR); } -void LoginHandler::loginOrRegister(LoginData *const data) +void LoginHandler::loginOrRegister(LoginData *const data) const { if (!data) return; diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index ec1610013..a6e7160cb 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -96,7 +96,7 @@ class LoginHandler : public Net::LoginHandler virtual void processServerVersion(Net::MessageIn &msg) = 0; - void loginOrRegister(LoginData *const data) override final; + void loginOrRegister(LoginData *const data) const override final; protected: LoginHandler(); diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 949ef5b67..6e832aeda 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -99,7 +99,7 @@ class LoginHandler virtual void clearWorlds() = 0; - virtual void loginOrRegister(LoginData *const data) = 0; + virtual void loginOrRegister(LoginData *const data) const = 0; virtual ~LoginHandler() { } |