summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-15 00:26:35 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-15 00:26:35 +0300
commitff516e9f60e9554e8938d04192a8e5ec9efb5647 (patch)
treeb134dd0202377c5b182f62870b983fe078700e28 /src/gui
parent269f642099ec8e4c6bcf735496c32ee8019aaf1b (diff)
downloadplus-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.gz
plus-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.bz2
plus-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.xz
plus-ff516e9f60e9554e8938d04192a8e5ec9efb5647.zip
fix code style.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/gui.h6
-rw-r--r--src/gui/viewport.cpp8
-rw-r--r--src/gui/viewport.h4
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/scrollarea.h4
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/window.h2
-rw-r--r--src/gui/windows/buydialog.cpp10
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/outfitwindow.cpp2
-rw-r--r--src/gui/windows/questswindow.cpp2
13 files changed, 26 insertions, 26 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 554c1ff42..deed890ae 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -1234,7 +1234,7 @@ Widget* Gui::getKeyEventSource()
return widget;
}
-void Gui::distributeKeyEvent(KeyEvent& keyEvent)
+void Gui::distributeKeyEvent(KeyEvent& keyEvent) const
{
Widget* parent = keyEvent.getSource();
Widget* widget = keyEvent.getSource();
@@ -1437,7 +1437,7 @@ void Gui::handleModalFocusReleased()
}
}
-int Gui::getMousePressLength()
+int Gui::getMousePressLength() const
{
if (!mLastMousePressTimeStamp)
return 0;
diff --git a/src/gui/gui.h b/src/gui/gui.h
index f7c913752..8805f2518 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -302,10 +302,10 @@ class Gui final
*/
void removeGlobalKeyListener(KeyListener *const keyListener);
- bool isLongPress()
+ bool isLongPress() const
{ return getMousePressLength() > 250; }
- int getMousePressLength();
+ int getMousePressLength() const;
protected:
void handleMouseMoved(const MouseInput &mouseInput);
@@ -368,7 +368,7 @@ class Gui final
* @since 0.6.0
*/
- void distributeKeyEvent(KeyEvent& keyEvent);
+ void distributeKeyEvent(KeyEvent& keyEvent) const;
/**
* Distributes a key event to the global key listeners.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9b349c7f6..c2000b562 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -361,7 +361,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
}
}
-bool Viewport::openContextMenu(MouseEvent &event)
+bool Viewport::openContextMenu(const MouseEvent &event)
{
mPlayerFollowMouse = false;
const int eventX = event.getX();
@@ -440,7 +440,7 @@ bool Viewport::leftMouseAction()
Input::KEY_ATTACK)))
{
validateSpeed();
- if (player_node != mHoverBeing)
+ if (!mStatsReUpdated && player_node != mHoverBeing)
{
player_node->attack(mHoverBeing,
!inputManager.isActionActive(
@@ -452,7 +452,7 @@ bool Viewport::leftMouseAction()
Input::KEY_ATTACK)))
{
validateSpeed();
- if (player_node != mHoverBeing)
+ if (!mStatsReUpdated && player_node != mHoverBeing)
{
player_node->setGotoTarget(mHoverBeing);
return true;
@@ -543,7 +543,7 @@ void Viewport::mousePressed(MouseEvent &event)
}
}
-void Viewport::walkByMouse(MouseEvent &event)
+void Viewport::walkByMouse(const MouseEvent &event)
{
if (!mMap || !player_node)
return;
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 61fee37f8..c98350744 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -302,9 +302,9 @@ class Viewport final : public WindowContainer,
bool leftMouseAction();
- bool openContextMenu(MouseEvent &event);
+ bool openContextMenu(const MouseEvent &event);
- void walkByMouse(MouseEvent &event);
+ void walkByMouse(const MouseEvent &event);
/**
* Make the player go to the mouse position.
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 8504e7c2a..0ff1b17c9 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -201,7 +201,7 @@ void Desktop::setBestFittingWallpaper()
}
}
-void Desktop::handleLink(const std::string &link, MouseEvent *event)
+void Desktop::handleLink(const std::string &link, MouseEvent *event A_UNUSED)
{
if (link == "copyright")
inputManager.executeAction(Input::KEY_WINDOW_ABOUT);
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index e2421dc93..47b8b0985 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -509,7 +509,7 @@ void ScrollArea::calcButton(Graphics *const graphics,
}
}
-void ScrollArea::drawVBar(Graphics *const graphics)
+void ScrollArea::drawVBar(Graphics *const graphics) const
{
const Rect &dim = getVerticalBarDimension();
@@ -559,7 +559,7 @@ void ScrollArea::calcVBar(Graphics *const graphics)
}
}
-void ScrollArea::drawHBar(Graphics *const graphics)
+void ScrollArea::drawHBar(Graphics *const graphics) const
{
const Rect &dim = getHorizontalBarDimension();
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 6a91ac0f8..0b0cae2c3 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -446,8 +446,8 @@ class ScrollArea final : public BasicContainer,
void drawButton(Graphics *const graphics, const BUTTON_DIR dir);
void calcButton(Graphics *const graphics, const BUTTON_DIR dir);
- void drawVBar(Graphics *const graphics);
- void drawHBar(Graphics *const graphics);
+ void drawVBar(Graphics *const graphics) const;
+ void drawHBar(Graphics *const graphics) const;
void drawVMarker(Graphics *const graphics);
void drawHMarker(Graphics *const graphics);
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index 8de0fe0bf..e5cfbc7c9 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -255,7 +255,7 @@ class TextBox final : public Widget,
* @return True if the text box is opaque, false otherwise.
* @see setOpaque
*/
- bool isOpaque()
+ bool isOpaque() const
{ return mOpaque; }
/**
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 3a9bf2157..2c4ee5e5f 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -498,7 +498,7 @@ class Window : public BasicContainer2,
* @return The title bar height.
* @see setTitleBarHeight
*/
- unsigned int getTitleBarHeight()
+ unsigned int getTitleBarHeight() const
{ return mTitleBarHeight; }
/**
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 5ae15dfa7..86e819121 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -162,9 +162,9 @@ BuyDialog::BuyDialog() :
Window(_("Create items"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(-2),
mSortModel(nullptr),
mSortDropDown(nullptr),
+ mNpcId(-2),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
@@ -178,9 +178,9 @@ BuyDialog::BuyDialog(const int npcId) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(npcId),
mSortModel(nullptr),
mSortDropDown(nullptr),
+ mNpcId(npcId),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
@@ -194,13 +194,13 @@ BuyDialog::BuyDialog(std::string nick) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
+ mSortModel(new SortListModelBuy),
+ mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")),
mNpcId(-1),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
- mNick(nick),
- mSortModel(new SortListModelBuy),
- mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort"))
+ mNick(nick)
{
init();
}
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 6f48b3f41..1df282189 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -117,7 +117,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mCreateButton(new Button(this, _("Create"), "create", this)),
// TRANSLATORS: char create dialog button
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
- mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace),
+ mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(0U),
nullptr)),
mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
"charcreate_selectedplayerbox.xml")),
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index b78252bef..b1355ba46 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -68,7 +68,7 @@ OutfitWindow::OutfitWindow():
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1))),
// TRANSLATORS: outfits window label
mKeyLabel(new Label(this, strprintf(_("Key: %s"),
- keyName(mCurrentOutfit).c_str()))),
+ keyName(0).c_str()))),
mBorderColor(getThemeColor(Theme::BORDER, 64)),
mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)),
mCurrentOutfit(0),
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 0aaac9b96..8d4eae9c8 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -154,7 +154,7 @@ QuestsWindow::QuestsWindow() :
mText->setLinkHandler(mItemLinkHandler);
mTextScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mQuestsListBox->setWidth(500);
- if (gui && gui->getNpcFont()->getHeight() < 20)
+ if (!gui || gui->getNpcFont()->getHeight() < 20)
mQuestsListBox->setRowHeight(20);
else
mQuestsListBox->setRowHeight(gui->getNpcFont()->getHeight());