summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/gui/itemamountwindow.cpp7
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/register.h2
-rw-r--r--src/gui/setup_keyboard.cpp3
-rw-r--r--src/gui/specialswindow.cpp1
-rw-r--r--src/gui/unregisterdialog.cpp7
-rw-r--r--src/gui/updaterwindow.cpp2
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/listbox.cpp6
-rw-r--r--src/gui/widgets/listbox.h15
-rw-r--r--src/gui/windowmenu.cpp10
14 files changed, 17 insertions, 47 deletions
diff --git a/src/gui/gui.h b/src/gui/gui.h
index e5f5149a..62a0b3aa 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -68,7 +68,7 @@ enum class Cursor {
*
* \ingroup GUI
*/
-class Gui : public gcn::Gui, public EventListener
+class Gui final : public gcn::Gui, public EventListener
{
public:
Gui(Graphics *screen);
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 285936a5..947b5bdc 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -79,7 +79,7 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
int maxRange):
- Window("", true, parent),
+ Window(std::string(), true, parent),
mItem(item),
mMax(maxRange),
mUsage(usage)
@@ -103,9 +103,8 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
mItemAmountSlide->setActionEventId("slide");
mItemAmountSlide->addActionListener(this);
- //Item icon
- Image *image = item->getImage();
- mItemIcon = new Icon(image);
+ // Item icon
+ mItemIcon = new Icon(item->getImage());
// Buttons
auto *minusButton = new Button(_("-"), "dec", this);
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 640d1d1e..c7199b78 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -63,7 +63,7 @@ class PopupMenu : public Popup, public LinkHandler
void handleLink(const std::string &link) override;
private:
- BrowserBox* mBrowserBox;
+ BrowserBox *mBrowserBox;
int mBeingId = 0;
FloorItem *mFloorItem = nullptr;
diff --git a/src/gui/register.h b/src/gui/register.h
index a8f875cb..1996cd47 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -27,8 +27,6 @@
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
-#include <string>
-
class LoginData;
class OkDialog;
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 0ac64447..ee6e340f 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -178,8 +178,7 @@ void Setup_Keyboard::refreshAssignedKey(int index)
caption = keyboard.getKeyCaption(index) + ": ";
else
{
- const char *temp = SDL_GetKeyName(
- (SDL_Scancode) keyboard.getKeyValue(index));
+ const char *temp = SDL_GetKeyName(keyboard.getKeyValue(index));
caption = strprintf("%-25s",
(keyboard.getKeyCaption(index) + ": ").c_str()) + toString(temp);
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index 17705b47..340a1e41 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -185,7 +185,6 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
mIcon->setPosition(1, 0);
add(mIcon);
-
mNameLabel = new Label(info->name);
mNameLabel->setPosition(35, 0);
add(mNameLabel);
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index 787865ae..94f6ef62 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -28,10 +28,8 @@
#include "gui/register.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/checkbox.h"
#include "gui/widgets/label.h"
#include "gui/widgets/passwordfield.h"
-#include "gui/widgets/textfield.h"
#include "net/logindata.h"
#include "net/loginhandler.h"
@@ -99,10 +97,9 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "unregister")
{
- const std::string username = mLoginData->username.c_str();
- const std::string password = mPasswordField->getText();
+ const std::string &password = mPasswordField->getText();
logger->log("UnregisterDialog::unregistered, Username is %s",
- username.c_str());
+ mLoginData->username.c_str());
std::stringstream errorMessage;
bool error = false;
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index c8ed66e1..802ce271 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -399,8 +399,6 @@ void UpdaterWindow::logic()
mProgressBar->setProgress(mDownloadProgress);
}
- std::string filename = mUpdatesDir + "/" + mCurrentFile;
-
switch (mDownloadStatus)
{
case UPDATE_ERROR:
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index b71e6530..10c4bc1a 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -266,12 +266,11 @@ void Viewport::shakeScreen(int intensity)
void Viewport::shakeScreen(float x, float y, float decay, unsigned duration)
{
- ShakeEffect effect;
+ ShakeEffect &effect = mShakeEffects.emplace_back();
effect.x = x;
effect.y = y;
effect.decay = decay;
effect.duration = duration;
- mShakeEffects.push_back(effect);
}
void Viewport::logic()
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index f4a5449f..4df0c4b9 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -75,7 +75,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
// Draw emote keyboard shortcut.
const char *key = SDL_GetKeyName(
- (SDL_Scancode) keyboard.getKeyValue(KeyboardConfig::KEY_EMOTE_1 + i));
+ keyboard.getKeyValue(KeyboardConfig::KEY_EMOTE_1 + i));
graphics->setColor(Theme::getThemeColor(Theme::TEXT));
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 6c57bd00..e6db7a0b 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -81,7 +81,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
// Draw item keyboard shortcut.
const char *key = SDL_GetKeyName(
- (SDL_Scancode) keyboard.getKeyValue(KeyboardConfig::KEY_SHORTCUT_1 + i));
+ keyboard.getKeyValue(KeyboardConfig::KEY_SHORTCUT_1 + i));
graphics->setColor(Theme::getThemeColor(Theme::TEXT));
g->drawText(key, itemX + 2, itemY + 2, gcn::Graphics::LEFT);
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 8e2c8311..fc4d8a8e 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -39,10 +39,6 @@ ListBox::ListBox(gcn::ListModel *listModel):
{
}
-ListBox::~ListBox()
-{
-}
-
void ListBox::updateAlpha()
{
float alpha = std::max(config.getFloatValue("guialpha"),
@@ -81,7 +77,7 @@ void ListBox::draw(gcn::Graphics *graphics)
void ListBox::keyPressed(gcn::KeyEvent& keyEvent)
{
- gcn::Key key = keyEvent.getKey();
+ const gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE)
{
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index a453b618..d16256b1 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -38,18 +38,6 @@ class ListBox : public gcn::ListBox
public:
ListBox(gcn::ListModel *listModel);
- ~ListBox() override;
-
- /**
- * Sets the font to render the text in.
- *
- * @param font the font to use.
- */
- void setFont(gcn::Font *font)
- {
- mFont = font;
- }
-
/**
* Draws the list box.
*/
@@ -74,9 +62,6 @@ class ListBox : public gcn::ListBox
void mouseDragged(gcn::MouseEvent &event) override;
- private:
- gcn::Font *mFont;
-
protected:
static float mAlpha;
};
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 01194c0b..c6e52ee7 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -162,21 +162,21 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event)
}
}
-static std::string createShortcutCaption(const std::string& text,
- KeyboardConfig::KeyAction key)
+static std::string createShortcutCaption(const std::string &text,
+ KeyboardConfig::KeyAction key)
{
std::string caption = gettext(text.c_str());
if (key != KeyboardConfig::KEY_NO_VALUE)
{
caption += " (";
- caption += SDL_GetKeyName((SDL_Scancode) keyboard.getKeyValue(key));
+ caption += SDL_GetKeyName(keyboard.getKeyValue(key));
caption += ")";
}
return caption;
}
-void WindowMenu::addButton(const std::string& text, int &x, int &h,
- const std::string& iconPath,
+void WindowMenu::addButton(const std::string &text, int &x, int &h,
+ const std::string &iconPath,
KeyboardConfig::KeyAction key)
{
auto *btn = new Button("", text, this);