From f9c0a11f184444b82e678b9aea4b14d3982d5201 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 22 May 2013 22:56:46 +0300 Subject: improve textcommandeditor. --- src/gui/textcommandeditor.cpp | 47 ++++++++++++++++--------------------------- src/gui/textcommandeditor.h | 8 +------- src/gui/widgets/window.h | 2 +- 3 files changed, 19 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 7df02e704..7b3703cfb 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -22,9 +22,12 @@ #include "gui/textcommandeditor.h" -#include -#include -#include +#include "configuration.h" +#include "item.h" +#include "localplayer.h" +#include "main.h" +#include "keyboardconfig.h" +#include "spellmanager.h" #include "gui/chatwindow.h" @@ -38,17 +41,14 @@ #include "gui/widgets/radiobutton.h" #include "gui/widgets/guitable.h" -#include "configuration.h" -#include "item.h" -#include "localplayer.h" -#include "main.h" -#include "keyboardconfig.h" -#include "spellmanager.h" - #include "utils/gettext.h" #include "resources/iteminfo.h" +#include +#include +#include + #include "debug.h" class IconsModal final : public gcn::ListModel @@ -68,7 +68,7 @@ public: continue; const ItemInfo &info = (*i->second); - std::string name = info.getName(); + const std::string name = info.getName(); if (name != "unnamed" && !info.getName().empty() && info.getName() != "unnamed") { @@ -86,12 +86,12 @@ public: virtual ~IconsModal() { } - virtual int getNumberOfElements() + virtual int getNumberOfElements() override { return static_cast(mStrings.size()); } - virtual std::string getElementAt(int i) + virtual std::string getElementAt(int i) override { if (i < 0 || i >= getNumberOfElements()) return "???"; @@ -134,12 +134,12 @@ public: virtual ~TargetTypeModel() { } - virtual int getNumberOfElements() + virtual int getNumberOfElements() override { return 3; } - virtual std::string getElementAt(int i) + virtual std::string getElementAt(int i) override { if (i >= getNumberOfElements() || i < 0) return "???"; @@ -153,12 +153,12 @@ public: virtual ~MagicSchoolModel() { } - virtual int getNumberOfElements() + virtual int getNumberOfElements() override { return 6; } - virtual std::string getElementAt(int i) + virtual std::string getElementAt(int i) override { if (i >= getNumberOfElements() || i < 0) return "???"; @@ -325,7 +325,6 @@ TextCommandEditor::~TextCommandEditor() void TextCommandEditor::action(const gcn::ActionEvent &event) { const std::string &eventId = event.getId(); - if (eventId == "magic") { mIsMagicCommand = true; @@ -352,18 +351,6 @@ void TextCommandEditor::action(const gcn::ActionEvent &event) } } -void TextCommandEditor::update() -{ -} - -void TextCommandEditor::updateList() -{ -} - -void TextCommandEditor::reset() -{ -} - void TextCommandEditor::showControls(const bool show) { mManaField->setVisible(show); diff --git a/src/gui/textcommandeditor.h b/src/gui/textcommandeditor.h index 86d1c7c7d..3036c5d5f 100644 --- a/src/gui/textcommandeditor.h +++ b/src/gui/textcommandeditor.h @@ -59,13 +59,7 @@ class TextCommandEditor final : public Window, public gcn::ActionListener void action(const gcn::ActionEvent &event) override; - void update(); - - void updateList(); - - void reset(); - - void scheduleDelete(); + void scheduleDelete() override; private: void showControls(const bool show); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 45a70dbeb..8ff32d273 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -248,7 +248,7 @@ class Window : public gcn::Window, * Schedule this window for deletion. It will be deleted at the start * of the next logic update. */ - void scheduleDelete(); + virtual void scheduleDelete(); /** * Starts window resizing when appropriate. -- cgit v1.2.3-70-g09d2