diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-28 15:46:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-28 16:41:19 +0300 |
commit | f146cd42ce84a08879eb286ecd2ed2aa8ad82300 (patch) | |
tree | f689f832f54f361be8cff61deb47c0e32febd486 /src/gui | |
parent | 409cee51fe11e2495a2741226432666a8702dceb (diff) | |
download | manaplus-f146cd42ce84a08879eb286ecd2ed2aa8ad82300.tar.gz manaplus-f146cd42ce84a08879eb286ecd2ed2aa8ad82300.tar.bz2 manaplus-f146cd42ce84a08879eb286ecd2ed2aa8ad82300.tar.xz manaplus-f146cd42ce84a08879eb286ecd2ed2aa8ad82300.zip |
fix code style.
Diffstat (limited to 'src/gui')
37 files changed, 40 insertions, 118 deletions
diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp index e854e15ff..f323366ad 100644 --- a/src/gui/base/basiccontainer.cpp +++ b/src/gui/base/basiccontainer.cpp @@ -69,8 +69,6 @@ #include <algorithm> -#include "render/graphics.h" - #include "debug.h" namespace gcn diff --git a/src/gui/cliprect.h b/src/gui/cliprect.h index 3bbf5e47e..88a7ab5a4 100644 --- a/src/gui/cliprect.h +++ b/src/gui/cliprect.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GUI_CLIPRECTANGLE_H -#define GUI_CLIPRECTANGLE_H +#ifndef GUI_CLIPRECT_H +#define GUI_CLIPRECT_H #include "gui/rect.h" @@ -97,11 +97,11 @@ class ClipRect final : public Rect * the relative screen coordinate. */ ClipRect(const int x0, - const int y0, - const int width0, - const int height0, - const int xOffset0, - const int yOffset0); + const int y0, + const int width0, + const int height0, + const int xOffset0, + const int yOffset0); /** * Copy constructor. Copies x, y, width and height @@ -123,4 +123,4 @@ class ClipRect final : public Rect int yOffset; }; -#endif // GUI_CLIPRECTANGLE_H +#endif // GUI_CLIPRECT_H diff --git a/src/gui/color.cpp b/src/gui/color.cpp index 9a0034257..aa9ffe840 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -86,9 +86,9 @@ Color::Color(const unsigned int color) : } Color::Color(const unsigned int ar, - const unsigned int ag, - const unsigned int ab, - const unsigned int aa) : + const unsigned int ag, + const unsigned int ab, + const unsigned int aa) : r(ar), g(ag), b(ab), @@ -149,7 +149,7 @@ bool Color::operator!=(const Color& color) const } std::ostream& operator<<(std::ostream& out, - const Color& color) + const Color& color) { out << "Color [r = " << color.r diff --git a/src/gui/color.h b/src/gui/color.h index 646680d96..db8fda970 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -81,7 +81,8 @@ class Color final /** * Constructor. Constructs a color from the bytes in an integer. - * Call it with a hexadecimal constant for HTML-style color representation. + * Call it with a hexadecimal constant for HTML-style color + * representation. * The alpha component is 255 by default. * * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index ed3a08e98..f12819e75 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -335,7 +335,7 @@ class FocusHandler final * @param focusEvent the event to distribute. * @since 0.7.0 */ - void distributeFocusLostEvent(const Event& focusEvent); + static void distributeFocusLostEvent(const Event& focusEvent); /** * Distributes a focus gained event. @@ -343,7 +343,7 @@ class FocusHandler final * @param focusEvent the event to distribute. * @since 0.7.0 */ - void distributeFocusGainedEvent(const Event& focusEvent); + static void distributeFocusGainedEvent(const Event& focusEvent); /** * Typedef. diff --git a/src/gui/font.h b/src/gui/font.h index bdf81dadc..12ba473d8 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -76,6 +76,7 @@ #include "localconsts.h" +class Color; class Graphics; class Image; diff --git a/src/gui/models/ignorechoiceslistmodel.h b/src/gui/models/ignorechoiceslistmodel.h index 7234b57f2..8ba3eadb1 100644 --- a/src/gui/models/ignorechoiceslistmodel.h +++ b/src/gui/models/ignorechoiceslistmodel.h @@ -38,8 +38,8 @@ class IgnoreChoicesListModel final : public ListModel int getNumberOfElements() override final { - return static_cast<int>(player_relations.getPlayerIgnoreStrategies( - )->size()); + return static_cast<int>(player_relations. + getPlayerIgnoreStrategies()->size()); } std::string getElementAt(int i) override final diff --git a/src/gui/models/playerrelationlistmodel.h b/src/gui/models/playerrelationlistmodel.h index 9251631f7..bc343de02 100644 --- a/src/gui/models/playerrelationlistmodel.h +++ b/src/gui/models/playerrelationlistmodel.h @@ -64,4 +64,4 @@ class PlayerRelationListModel final : public ListModel } }; -#endif +#endif // GUI_MODELS_PLAYERRELATIONLISTMODEL_H diff --git a/src/gui/models/soundsmodel.h b/src/gui/models/soundsmodel.h index 2f645e666..3ac679d37 100644 --- a/src/gui/models/soundsmodel.h +++ b/src/gui/models/soundsmodel.h @@ -19,6 +19,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef GUI_MODELS_SOUNDSMODEL_H +#define GUI_MODELS_SOUNDSMODEL_H + #include "gui/theme.h" #include "gui/models/namesmodel.h" @@ -40,3 +43,5 @@ class SoundsModel final : public NamesModel ~SoundsModel() { } }; + +#endif // GUI_MODELS_SOUNDSMODEL_H diff --git a/src/gui/models/tablemodel.h b/src/gui/models/tablemodel.h index ff752e6f1..032facadd 100644 --- a/src/gui/models/tablemodel.h +++ b/src/gui/models/tablemodel.h @@ -151,8 +151,7 @@ public: int getHeight() const A_WARN_UNUSED; int getColumnWidth(const int index) const override final A_WARN_UNUSED; Widget *getElementAt(const int row, - const int column) const - override final A_WARN_UNUSED; + const int column) const override final A_WARN_UNUSED; protected: int mRows, mColumns; diff --git a/src/gui/models/touchactionmodel.cpp b/src/gui/models/touchactionmodel.cpp index e6cc4d046..b32d1479f 100644 --- a/src/gui/models/touchactionmodel.cpp +++ b/src/gui/models/touchactionmodel.cpp @@ -18,19 +18,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "gui/widgets/setuptouchitem.h" - #include "gui/setupactiondata.h" #include "gui/models/touchactionmodel.h" -#include "gui/widgets/dropdown.h" -#include "gui/widgets/horizontcontainer.h" -#include "gui/widgets/label.h" -#include "gui/widgets/vertcontainer.h" - -#include "gui/widgets/tabs/setuptabscroll.h" - #include <algorithm> #include "debug.h" diff --git a/src/gui/rect.h b/src/gui/rect.h index f7cb7ae92..69c0120ca 100644 --- a/src/gui/rect.h +++ b/src/gui/rect.h @@ -159,4 +159,4 @@ class Rect int height; }; -#endif // GUI_RECTANGEL_H +#endif // GUI_RECT_H diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index d8a63b60c..ffb90a883 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -98,7 +98,7 @@ SDLInput::SDLInput() : { } -bool SDLInput::isKeyQueueEmpty() +bool SDLInput::isKeyQueueEmpty() const { return mKeyInputQueue.empty(); } @@ -114,7 +114,7 @@ KeyInput SDLInput::dequeueKeyInput2() return keyInput; } -bool SDLInput::isMouseQueueEmpty() +bool SDLInput::isMouseQueueEmpty() const { return mMouseInputQueue.empty(); } diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 29cb5ce1f..8197aa110 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -107,14 +107,6 @@ public: */ void pushInput(const SDL_Event &event); - /** - * Polls all input. It exists for input driver compatibility. If you - * only use SDL and plan sticking with SDL you can safely ignore this - * function as it in the SDL case does nothing. - */ - void _pollInput() - { } - KeyInput dequeueKeyInput2() A_WARN_UNUSED; KeyInput dequeueKeyInput() A_WARN_UNUSED @@ -122,9 +114,9 @@ public: // Inherited from SDLInput - bool isKeyQueueEmpty() A_WARN_UNUSED; + bool isKeyQueueEmpty() const A_WARN_UNUSED; - bool isMouseQueueEmpty() A_WARN_UNUSED; + bool isMouseQueueEmpty() const A_WARN_UNUSED; MouseInput dequeueMouseInput() A_WARN_UNUSED; diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index e4f65a992..e0711a7b7 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -22,14 +22,10 @@ #ifndef GUI_WIDGETS_AVATARLISTBOX_H #define GUI_WIDGETS_AVATARLISTBOX_H -#include "avatar.h" - #include "listeners/configlistener.h" #include "gui/widgets/listbox.h" -#include "gui/models/listmodel.h" - #include <string> class AvatarListModel; diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 0c3a62609..64faa6eb5 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -27,8 +27,6 @@ #include "gui/base/widgets/listbox.hpp" -#include "render/graphics.h" - #include "localconsts.h" class Skin; diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h index b553c629a..41193b3d6 100644 --- a/src/gui/widgets/radiogroup.h +++ b/src/gui/widgets/radiogroup.h @@ -23,8 +23,6 @@ #include "gui/widgets/widgetgroup.h" -#include "gui/widgets/widget.h" - class RadioGroup final : public WidgetGroup { public: diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 51f2eb94e..7dee860be 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -95,7 +95,7 @@ class SetupItem : public ActionListener, virtual void rereadValue(); - void setValue(const std::string str) + void setValue(const std::string &str) { mValue = str; } std::string getValue() const diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index 99a774ecd..3c8238fd0 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -20,8 +20,6 @@ #include "gui/widgets/setuptouchitem.h" -#include "gui/setupactiondata.h" - #include "gui/models/touchactionmodel.h" #include "gui/widgets/dropdown.h" @@ -31,7 +29,7 @@ #include "gui/widgets/tabs/setuptabscroll.h" -#include <algorithm> +#include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/setuptouchitem.h b/src/gui/widgets/setuptouchitem.h index 2c1aa05d0..f7bbf2691 100644 --- a/src/gui/widgets/setuptouchitem.h +++ b/src/gui/widgets/setuptouchitem.h @@ -21,8 +21,6 @@ #ifndef GUI_WIDGETS_SETUPTOUCHITEM_H #define GUI_WIDGETS_SETUPTOUCHITEM_H -#include "gui/models/namesmodel.h" - #include "gui/widgets/setupitem.h" class TouchActionsModel; diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index d3781b421..0d9aa64a6 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -61,7 +61,7 @@ void ShortcutContainer::widgetResized(const Event &event A_UNUSED) if (mGridWidth < 1) mGridWidth = 1; - mGridHeight = mMaxItems / mGridWidth; + mGridHeight = mMaxItems / static_cast<unsigned int>(mGridWidth); if (mMaxItems % mGridWidth != 0 || mGridHeight < 1) ++mGridHeight; diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp index c8e625ca4..6cf675635 100644 --- a/src/gui/widgets/tabs/setup_audio.cpp +++ b/src/gui/widgets/tabs/setup_audio.cpp @@ -30,7 +30,6 @@ #include "gui/viewport.h" -#include "gui/models/namesmodel.h" #include "gui/models/soundsmodel.h" #include "gui/widgets/layouthelper.h" diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index 419400853..424828694 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -28,7 +28,6 @@ #include "gui/models/extendedlistmodel.h" #include "gui/models/fontsmodel.h" -#include "gui/models/namesmodel.h" #include "gui/models/themesmodel.h" #include "gui/widgets/button.h" diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h index b2dfc99e2..a89dd5144 100644 --- a/src/gui/widgets/tabstrip.h +++ b/src/gui/widgets/tabstrip.h @@ -23,8 +23,6 @@ #include "gui/widgets/widgetgroup.h" -#include "gui/widgets/widget.h" - class TabStrip final : public WidgetGroup { public: diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 23edadac0..5b2024b1f 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -604,16 +604,6 @@ void Widget::setInternalFocusHandler(FocusHandler* focusHandler) mInternalFocusHandler = focusHandler; } -void Widget::setId(const std::string& id) -{ - mId = id; -} - -const std::string& Widget::getId() -{ - return mId; -} - void Widget::distributeResizedEvent() { for (WidgetListenerIterator iter = mWidgetListeners.begin(); diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index e05844e4c..17f016c76 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -973,7 +973,8 @@ class Widget : public Widget2 * @see getId, BasicContainer::findWidgetById * @since 0.8.0 */ - void setId(const std::string& id); + void setId(const std::string& id) + { mId = id; } /** * Gets the id of a widget. An id can be useful if a widget needs to be @@ -985,7 +986,8 @@ class Widget : public Widget2 * @see setId, BasicContainer::findWidgetById * @since 0.8.0 */ - const std::string& getId() A_WARN_UNUSED; + const std::string& getId() const A_WARN_UNUSED + { return mId; } /** * Shows a certain part of a widget in the widget's parent. diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 8b106b489..ec83af9a8 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -99,7 +99,6 @@ Window::Window(const std::string &caption, const bool modal, mPadding(2), mTitleBarHeight(16), mMovable(true), - mOpaque(true), mDragOffsetX(0), mDragOffsetY(0), mMoved(false), diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 7cf34c67c..6369990bb 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -555,25 +555,6 @@ class Window : public gcn::Container, bool isMovable() const { return mMovable; } - /** - * Sets the window to be opaque or not. An opaque window will draw it's background - * and it's content. A non opaque window will only draw it's content. - * - * @param opaque True if the window should be opaque, false otherwise. - * @see isOpaque - */ - void setOpaque(bool opaque) - { mOpaque = opaque; } - - /** - * Checks if the window is opaque. - * - * @return True if the window is opaque, false otherwise. - * @see setOpaque - */ - bool isOpaque() - { return mOpaque; } - virtual Rect getChildrenArea(); /** @@ -626,11 +607,6 @@ class Window : public gcn::Container, bool mMovable; /** - * True if the window is opaque, false otherwise. - */ - bool mOpaque; - - /** * Holds a drag offset as an x coordinate where the drag of the window * started if the window is being dragged. It's used to move the window * correctly when dragged. diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index 215666394..b70d1031b 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -35,8 +35,6 @@ class TypeListModel; #include "listeners/actionlistener.h" #include "listeners/keylistener.h" -#include "gui/models/listmodel.h" - /** * The custom server addition dialog. * diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 5323854fb..ee8c85f06 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -36,7 +36,6 @@ #include "gui/gui.h" #include "gui/viewport.h" -#include "gui/models/listmodel.h" #include "gui/models/sortlistmodelinv.h" #include "gui/popups/textpopup.h" diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index dba69b424..fc0c5880b 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -34,7 +34,6 @@ #include "gui/viewport.h" #include "gui/models/itemsmodel.h" -#include "gui/models/listmodel.h" #include "gui/popups/itempopup.h" diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index be0c840f6..6fcea7d3a 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -325,7 +325,7 @@ void OutfitWindow::draw(Graphics *graphics) { const int itemX = mPadding + ((i % mGridWidth) * mBoxWidth); const int itemY = mPadding + mTitleBarHeight - + ((i / mGridWidth) * mBoxHeight); + + ((i / static_cast<unsigned int>(mGridWidth)) * mBoxHeight); graphics->setColor(mBorderColor); graphics->drawRectangle(Rect(itemX, itemY, 32, 32)); diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 319bf5df0..eee3e4259 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -29,7 +29,6 @@ #include "gui/font.h" #include "gui/gui.h" -#include "gui/models/extendednamesmodel.h" #include "gui/models/questsmodel.h" #include "gui/widgets/browserbox.h" diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index 07e2b5dcc..39c82279e 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -34,16 +34,12 @@ #include "listeners/keylistener.h" #include "listeners/selectionlistener.h" -#include "gui/models/listmodel.h" - #include <string> -#include <vector> class Button; class CheckBox; class Label; class ListBox; -class ServerDialog; class ServersListModel; /** diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 17703388f..dead469bc 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -28,7 +28,6 @@ #include "input/keyboardconfig.h" #include "gui/models/iconsmodel.h" -#include "gui/models/listmodel.h" #include "gui/models/magicschoolmodel.h" #include "gui/models/targettypemodel.h" @@ -41,10 +40,6 @@ #include "utils/gettext.h" -#include "resources/iteminfo.h" - -#include "resources/db/itemdb.h" - #include "debug.h" TextCommandEditor::TextCommandEditor(TextCommand *const command) : diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 7fe1a1e36..506f25c17 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -130,8 +130,7 @@ TradeWindow::TradeWindow(): place(1, 0, mMoneyLabel); place(0, 1, myScroll).setPadding(3); place(1, 1, partnerScroll).setPadding(3); - ContainerPlacer placer; - placer = getPlacer(0, 0); + ContainerPlacer placer = getPlacer(0, 0); placer(0, 0, moneyLabel2); placer(1, 0, mMoneyField, 2); placer(3, 0, mMoneyChangeButton).setHAlign(LayoutCell::LEFT); diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index db17820db..77d167c82 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -33,7 +33,6 @@ #include "gui/widgets/listbox.h" #include "gui/widgets/scrollarea.h" -#include "gui/models/listmodel.h" #include "gui/models/worldlistmodel.h" #include "net/loginhandler.h" |