diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-07 01:03:48 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-07 01:03:48 -0500 |
commit | 7459a5a34a5bcf7011c4164e3c92c7770da09514 (patch) | |
tree | 57c53a9fad0dbff587bc8249ec2e0d09308f5f7a | |
parent | 67aefdbacc16395bda2a8bfb14004190ced25e00 (diff) | |
download | sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.tar.gz sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.tar.xz sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.zip |
Renamed CoinListObject to CoinListItem and added documentation for it
-rw-r--r-- | sigmod/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sigmod/CoinList.cpp | 92 | ||||
-rw-r--r-- | sigmod/CoinList.h | 74 | ||||
-rw-r--r-- | sigmod/CoinListItem.cpp (renamed from sigmod/CoinListObject.cpp) | 38 | ||||
-rw-r--r-- | sigmod/CoinListItem.h | 155 | ||||
-rw-r--r-- | sigmod/CoinListObject.h | 69 | ||||
-rw-r--r-- | sigmod/sigmod.pro | 4 | ||||
-rw-r--r-- | sigmodr/CMakeLists.txt | 10 | ||||
-rw-r--r-- | sigmodr/CoinListItemUI.cpp | 103 | ||||
-rw-r--r-- | sigmodr/CoinListItemUI.h (renamed from sigmodr/CoinListObjectUI.h) | 14 | ||||
-rw-r--r-- | sigmodr/CoinListObjectUI.cpp | 103 | ||||
-rw-r--r-- | sigmodr/gui/coinlistitem.ui (renamed from sigmodr/gui/coinlistobject.ui) | 10 | ||||
-rw-r--r-- | sigmodr/models/CoinListItemModel.cpp (renamed from sigmodr/models/CoinListObjectModel.cpp) | 32 | ||||
-rw-r--r-- | sigmodr/models/CoinListItemModel.h (renamed from sigmodr/models/CoinListObjectModel.h) | 12 | ||||
-rw-r--r-- | sigmodr/models/CoinListModel.cpp | 22 | ||||
-rw-r--r-- | sigmodr/sigmodr.pro | 10 | ||||
-rw-r--r-- | sigscript/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sigscript/CoinListItemWrapper.cpp (renamed from sigscript/CoinListObjectWrapper.cpp) | 30 | ||||
-rw-r--r-- | sigscript/CoinListItemWrapper.h (renamed from sigscript/CoinListObjectWrapper.h) | 22 | ||||
-rw-r--r-- | sigscript/CoinListWrapper.cpp | 10 | ||||
-rw-r--r-- | sigscript/CoinListWrapper.h | 6 | ||||
-rw-r--r-- | sigscript/sigscript.pro | 4 |
22 files changed, 457 insertions, 371 deletions
diff --git a/sigmod/CMakeLists.txt b/sigmod/CMakeLists.txt index 69d856e6..891d5ec4 100644 --- a/sigmod/CMakeLists.txt +++ b/sigmod/CMakeLists.txt @@ -9,7 +9,7 @@ SET(sigmod_HEADERS Author.h Badge.h CoinList.h - CoinListObject.h + CoinListItem.h EggGroup.h Global.h GlobalScript.h @@ -49,7 +49,7 @@ SET(sigmod_SRCS Author.cpp Badge.cpp CoinList.cpp - CoinListObject.cpp + CoinListItem.cpp EggGroup.cpp GlobalScript.cpp Item.cpp diff --git a/sigmod/CoinList.cpp b/sigmod/CoinList.cpp index aeeceb46..4f0519e7 100644 --- a/sigmod/CoinList.cpp +++ b/sigmod/CoinList.cpp @@ -19,7 +19,7 @@ #include "CoinList.h" // Sigmod includes -#include "CoinListObject.h" +#include "CoinListItem.h" #include "Macros.h" #include "Sigmod.h" @@ -62,20 +62,20 @@ void Sigmod::CoinList::validate() TEST_BEGIN(); if (m_name.isEmpty()) emit(error("Name is empty")); - if (!objectCount()) - emit(error("There are no objects")); + if (!itemCount()) + emit(error("There are no items")); QSet<int> idChecker; QSet<int> itemChecker; QSet<int> speciesChecker; - TEST_SUB_BEGIN(CoinListObject, objects); - TEST_SUB("object", id); - if (object->type() == CoinListObject::Item) + TEST_SUB_BEGIN(CoinListItem, items); + TEST_SUB("item", id); + if (object->type() == CoinListItem::Item) { - TEST_SUB_RAW(item, "object item", object); + TEST_SUB_RAW(item, "item item", object); } - else if (object->type() == CoinListObject::Species) + else if (object->type() == CoinListItem::Species) { - TEST_SUB_RAW(species, "object species", object); + TEST_SUB_RAW(species, "item species", object); } TEST_SUB_END(); // foreach (CoinListObject* object, m_objects) @@ -105,7 +105,7 @@ void Sigmod::CoinList::load(const QDomElement& xml) LOAD_BEGIN(); LOAD(name); LOAD(script); - LOAD_SUB(newObject, CoinListObject); + LOAD_SUB(newItem, CoinListItem); } QDomElement Sigmod::CoinList::save() const @@ -113,7 +113,7 @@ QDomElement Sigmod::CoinList::save() const SAVE_CREATE(); SAVE(name); SAVE(script); - SAVE_SUB(CoinListObject, objects); + SAVE_SUB(CoinListItem, items); return xml; } @@ -137,84 +137,84 @@ Sigcore::Script Sigmod::CoinList::script() const return m_script; } -const Sigmod::CoinListObject* Sigmod::CoinList::object(const int index) const +const Sigmod::CoinListItem* Sigmod::CoinList::item(const int index) const { - if (index < objectCount()) - return m_objects.at(index); + if (index < itemCount()) + return m_items.at(index); return NULL; } -Sigmod::CoinListObject* Sigmod::CoinList::object(const int index) +Sigmod::CoinListItem* Sigmod::CoinList::item(const int index) { - if (index < objectCount()) - return m_objects[index]; + if (index < itemCount()) + return m_items[index]; return NULL; } -const Sigmod::CoinListObject* Sigmod::CoinList::objectById(const int id) const +const Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id) const { - return object(objectIndex(id)); + return item(itemIndex(id)); } -Sigmod::CoinListObject* Sigmod::CoinList::objectById(const int id) +Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id) { - return object(objectIndex(id)); + return item(itemIndex(id)); } -int Sigmod::CoinList::objectIndex(const int id) const +int Sigmod::CoinList::itemIndex(const int id) const { - for (int i = 0; i < objectCount(); ++i) + for (int i = 0; i < itemCount(); ++i) { - if (m_objects[i]->id() == id) + if (m_items[i]->id() == id) return i; } return INT_MAX; } -int Sigmod::CoinList::objectCount() const +int Sigmod::CoinList::itemCount() const { - return m_objects.size(); + return m_items.size(); } -Sigmod::CoinListObject* Sigmod::CoinList::newObject() +Sigmod::CoinListItem* Sigmod::CoinList::newItem() { - return newObject(new CoinListObject(this, objectId())); + return newItem(new CoinListItem(this, itemId())); } -Sigmod::CoinListObject* Sigmod::CoinList::newObject(const QDomElement& xml) +Sigmod::CoinListItem* Sigmod::CoinList::newItem(const QDomElement& xml) { - return newObject(new CoinListObject(xml, this, objectId())); + return newItem(new CoinListItem(xml, this, itemId())); } -Sigmod::CoinListObject* Sigmod::CoinList::newObject(const CoinListObject& object) +Sigmod::CoinListItem* Sigmod::CoinList::newItem(const CoinListItem& item) { - return newObject(new CoinListObject(object, this, objectId())); + return newItem(new CoinListItem(item, this, itemId())); } -Sigmod::CoinListObject* Sigmod::CoinList::newObject(CoinListObject* object) +Sigmod::CoinListItem* Sigmod::CoinList::newItem(CoinListItem* item) { - m_objects.append(object); - return object; + m_items.append(item); + return item; } -void Sigmod::CoinList::deleteObject(const int index) +void Sigmod::CoinList::deleteItem(const int index) { - if (index < objectCount()) + if (index < itemCount()) { - delete m_objects[index]; - m_objects.removeAt(index); + delete m_items[index]; + m_items.removeAt(index); } } -void Sigmod::CoinList::deleteObjectById(const int id) +void Sigmod::CoinList::deleteItemById(const int id) { - deleteObject(objectIndex(id)); + deleteItem(itemIndex(id)); } -int Sigmod::CoinList::objectId() const +int Sigmod::CoinList::itemId() const { int i = 0; - while ((i < objectCount()) && (objectIndex(i) != INT_MAX)) + while ((i < itemCount()) && (itemIndex(i) != INT_MAX)) ++i; return i; } @@ -226,12 +226,12 @@ Sigmod::CoinList& Sigmod::CoinList::operator=(const CoinList& rhs) clear(); COPY(name); COPY(script); - COPY_SUB(CoinListObject, objects); + COPY_SUB(CoinListItem, items); return *this; } void Sigmod::CoinList::clear() { - qDeleteAll(m_objects); - m_objects.clear(); + qDeleteAll(m_items); + m_items.clear(); } diff --git a/sigmod/CoinList.h b/sigmod/CoinList.h index d515defb..7807271f 100644 --- a/sigmod/CoinList.h +++ b/sigmod/CoinList.h @@ -34,12 +34,12 @@ namespace Sigmod { // Forward declarations -class CoinListObject; +class CoinListItem; class Sigmod; /** * \class Sigmod::CoinList CoinList.h sigmod/CoinList.h - * \brief A coin list contains a list of objects that can be bought using coins. + * \brief A coin list contains a list of items that can be bought using coins. * * The difference between a coin list and a \link Store store \endlink is that team members * cannot be bought at stores. Since money is typically easier to come by than coins are, @@ -57,7 +57,7 @@ class SIGMOD_EXPORT CoinList : public Object */ CoinList(const CoinList& coinList); /** - * Create a new ability belonging to \p parent and id \p id. + * Create a new coin list belonging to \p parent and id \p id. * * \param parent The parent of the coin list. * \param id The id number for the coin list. @@ -129,71 +129,71 @@ class SIGMOD_EXPORT CoinList : public Object Sigcore::Script script() const; /** - * \param index The index of the object to get. - * \return Pointer to the object or NULL if \p index is invalid. + * \param index The index of the item to get. + * \return Pointer to the item or NULL if \p index is invalid. */ - const CoinListObject* object(const int index) const; + const CoinListItem* item(const int index) const; /** - * \param index The index of the object to get. - * \return Pointer to the object or NULL if \p index is invalid. + * \param index The index of the item to get. + * \return Pointer to the item or NULL if \p index is invalid. */ - CoinListObject* object(const int index); + CoinListItem* item(const int index); /** - * \param id The id of the object to get. - * \return Pointer to the object or NULL if \p id is invalid. + * \param id The id of the item to get. + * \return Pointer to the item or NULL if \p id is invalid. */ - const CoinListObject* objectById(const int id) const; + const CoinListItem* itemById(const int id) const; /** - * \param id The id of the object to get. - * \return Pointer to the object or NULL if \p id is invalid. + * \param id The id of the item to get. + * \return Pointer to the item or NULL if \p id is invalid. */ - CoinListObject* objectById(const int id); + CoinListItem* itemById(const int id); /** - * \param id The id of the object to get. - * \return The index of the object or INT_MAX if \p id is invalid. + * \param id The id of the item to get. + * \return The index of the item or INT_MAX if \p id is invalid. */ - int objectIndex(const int id) const; + int itemIndex(const int id) const; /** - * \return The number of objects in the coin list. + * \return The number of items in the coin list. */ - int objectCount() const; + int itemCount() const; /** - * \return Pointer to a newly created object. + * \return Pointer to a newly created item. */ - CoinListObject* newObject(); + CoinListItem* newItem(); /** - * \param xml The XML of the object to add. - * \return Pointer to a newly created object from \p xml. + * \param xml The XML of the item to add. + * \return Pointer to a newly created item from \p xml. */ - CoinListObject* newObject(const QDomElement& xml); + CoinListItem* newItem(const QDomElement& xml); /** - * \param object A copy of the object to add. - * \return Pointer to a newly created object from \p object. + * \param item A copy of the item to add. + * \return Pointer to a newly created item from \p item. */ - CoinListObject* newObject(const CoinListObject& object); + CoinListItem* newItem(const CoinListItem& item); /** - * Deletes the object at index \p index. + * Deletes the item at index \p index. * - * \param index The index of the object to delete. + * \param index The index of the item to delete. */ - void deleteObject(const int index); + void deleteItem(const int index); /** - * Deletes the object with id \p id. + * Deletes the item with id \p id. * - * \param id The id of the object to delete. + * \param id The id of the item to delete. */ - void deleteObjectById(const int id); + void deleteItemById(const int id); CoinList& operator=(const CoinList& rhs); private: - int objectId() const; - CoinListObject* newObject(CoinListObject* object); + int itemId() const; + CoinListItem* newItem(CoinListItem* item); void clear(); QString m_name; Sigcore::Script m_script; - QList<CoinListObject*> m_objects; + QList<CoinListItem*> m_items; }; } diff --git a/sigmod/CoinListObject.cpp b/sigmod/CoinListItem.cpp index 2cd944ae..f531f3a1 100644 --- a/sigmod/CoinListObject.cpp +++ b/sigmod/CoinListItem.cpp @@ -16,22 +16,22 @@ */ // Header include -#include "CoinListObject.h" +#include "CoinListItem.h" // Sigmod includes #include "CoinList.h" #include "Macros.h" #include "Sigmod.h" -const QStringList Sigmod::CoinListObject::TypeStr = QStringList() << "Item" << "Team Member"; +const QStringList Sigmod::CoinListItem::TypeStr = QStringList() << "Item" << "Team Member"; -Sigmod::CoinListObject::CoinListObject(const CoinListObject& object) : - Object(object.parent(), object.id()) +Sigmod::CoinListItem::CoinListItem(const CoinListItem& item) : + Object(item.parent(), item.id()) { - *this = object; + *this = item; } -Sigmod::CoinListObject::CoinListObject(const CoinList* parent, const int id) : +Sigmod::CoinListItem::CoinListItem(const CoinList* parent, const int id) : Object(parent, id), m_type(Item), m_object(INT_MAX), @@ -39,27 +39,27 @@ Sigmod::CoinListObject::CoinListObject(const CoinList* parent, const int id) : { } -Sigmod::CoinListObject::CoinListObject(const CoinListObject& object, const CoinList* parent, const int id) : +Sigmod::CoinListItem::CoinListItem(const CoinListItem& item, const CoinList* parent, const int id) : Object(parent, id) { - *this = object; + *this = item; } -Sigmod::CoinListObject::CoinListObject(const QDomElement& xml, const CoinList* parent, const int id) : +Sigmod::CoinListItem::CoinListItem(const QDomElement& xml, const CoinList* parent, const int id) : Object(parent, id) { LOAD_ID(); load(xml); } -void Sigmod::CoinListObject::validate() +void Sigmod::CoinListItem::validate() { TEST_BEGIN(); TEST(setObject, object); TEST_END(); } -void Sigmod::CoinListObject::load(const QDomElement& xml) +void Sigmod::CoinListItem::load(const QDomElement& xml) { LOAD_BEGIN(); LOAD(type); @@ -67,7 +67,7 @@ void Sigmod::CoinListObject::load(const QDomElement& xml) LOAD(cost); } -QDomElement Sigmod::CoinListObject::save() const +QDomElement Sigmod::CoinListItem::save() const { SAVE_CREATE(); SAVE(type); @@ -76,12 +76,12 @@ QDomElement Sigmod::CoinListObject::save() const return xml; } -void Sigmod::CoinListObject::setType(const Type type) +void Sigmod::CoinListItem::setType(const Type type) { CHECK(type); } -void Sigmod::CoinListObject::setObject(const int object) +void Sigmod::CoinListItem::setObject(const int object) { if (((Item == m_type) && !sigmod()->itemById(object)) || ((Species == m_type) && !sigmod()->speciesById(object))) emit(error(bounds("object"))); @@ -89,27 +89,27 @@ void Sigmod::CoinListObject::setObject(const int object) CHECK(object); } -void Sigmod::CoinListObject::setCost(const int cost) +void Sigmod::CoinListItem::setCost(const int cost) { CHECK(cost); } -Sigmod::CoinListObject::Type Sigmod::CoinListObject::type() const +Sigmod::CoinListItem::Type Sigmod::CoinListItem::type() const { return m_type; } -int Sigmod::CoinListObject::object() const +int Sigmod::CoinListItem::object() const { return m_object; } -int Sigmod::CoinListObject::cost() const +int Sigmod::CoinListItem::cost() const { return m_cost; } -Sigmod::CoinListObject& Sigmod::CoinListObject::operator=(const CoinListObject& rhs) +Sigmod::CoinListItem& Sigmod::CoinListItem::operator=(const CoinListItem& rhs) { if (this == &rhs) return *this; diff --git a/sigmod/CoinListItem.h b/sigmod/CoinListItem.h new file mode 100644 index 00000000..d71368ec --- /dev/null +++ b/sigmod/CoinListItem.h @@ -0,0 +1,155 @@ +/* + * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * \file sigmod/CoinListItem.h + */ + +#ifndef SIGMOD_COINLISTITEM +#define SIGMOD_COINLISTITEM + +// Sigmod includes +#include "Object.h" + +namespace Sigmod +{ +// Forward declarations +class CoinList; + +/** + * \class Sigmod::CoinListItem CoinListItem.h sigmod/CoinListItem.h + * \brief An object that is sold on a coin list. + * + * + */ +class SIGMOD_EXPORT CoinListItem : public Object +{ + Q_OBJECT + Q_ENUMS(Type) + + public: + /** + * \enum Type + * \brief The type of object contained in the item. + */ + enum Type + { + Item = 0, + Species = 1 + }; + /** + * \var TypeStr + * String values for the types of an item. + */ + static const QStringList TypeStr; + + /** + * Copy constructor. + * + * \param item The item to copy. + */ + CoinListItem(const CoinListItem& item); + /** + * Create a new item belonging to \p parent and id \p id. + * + * \param parent The parent of the item. + * \param id The id number for the item. + */ + CoinListItem(const CoinList* parent, const int id); + /** + * Data copy constructor. Copies the data from \p item as a child of \p parent with id \p id. + * + * \param coinList The item to copy the data from. + * \param parent The parent of the item. + * \param id The id number for the item. + */ + CoinListItem(const CoinListItem& item, const CoinList* parent, const int id); + /** + * XML data constructor. + * + * \param xml The XML structure to extract the data from. + * \param parent The parent of the item. + * \param id The id number for the item. + */ + CoinListItem(const QDomElement& xml, const CoinList* parent, const int id = -1); + + /** + * Check to make sure the item's values are valid. + */ + void validate(); + + /** + * Load data from XML. + * + * \param xml The XML structure to extract data from. + */ + void load(const QDomElement& xml); + /** + * Get the data for the item in XML format. + * + * \return The XML structure representing the item. + */ + QDomElement save() const; + + /** + * The type of object contained in the item. + * + * \param type The type of the item. + */ + void setType(const Type type); + /** + * The \p id of the object in the item. + * + * \param object The \p id of the object contained in the item. + */ + void setObject(const int object); + /** + * How many coins the item costs. + * + * \param cost How many coins the item costs. + */ + void setCost(const int cost); + + /** + * \sa setType + * + * \return The type of object contained in the item. + */ + Type type() const; + /** + * \sa setObject + * + * \return The \p id of the object in the item. + */ + int object() const; + /** + * \sa setCost + * + * \return How many coins the item costs. + */ + int cost() const; + + CoinListItem& operator=(const CoinListItem& rhs); + private: + Type m_type; + int m_object; + int m_cost; +}; +} +Q_DECLARE_METATYPE(Sigmod::CoinListItem::Type) + +#endif diff --git a/sigmod/CoinListObject.h b/sigmod/CoinListObject.h deleted file mode 100644 index baec97cf..00000000 --- a/sigmod/CoinListObject.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef SIGMOD_COINLISTOBJECT -#define SIGMOD_COINLISTOBJECT - -// Sigmod includes -#include "Object.h" - -namespace Sigmod -{ -// Forward declarations -class CoinList; - -class SIGMOD_EXPORT CoinListObject : public Object -{ - Q_OBJECT - Q_ENUMS(Type) - - public: - enum Type - { - Item = 0, - Species = 1 - }; - static const QStringList TypeStr; - - CoinListObject(const CoinListObject& object); - CoinListObject(const CoinList* parent, const int id); - CoinListObject(const CoinListObject& object, const CoinList* parent, const int id); - CoinListObject(const QDomElement& xml, const CoinList* parent, const int id = -1); - - void validate(); - - void load(const QDomElement& xml); - QDomElement save() const; - - void setType(const Type type); - void setObject(const int object); - void setCost(const int cost); - - Type type() const; - int object() const; - int cost() const; - - CoinListObject& operator=(const CoinListObject& rhs); - private: - Type m_type; - int m_object; - int m_cost; -}; -} -Q_DECLARE_METATYPE(Sigmod::CoinListObject::Type) - -#endif diff --git a/sigmod/sigmod.pro b/sigmod/sigmod.pro index 9f4a538e..3aec7aa6 100644 --- a/sigmod/sigmod.pro +++ b/sigmod/sigmod.pro @@ -25,7 +25,7 @@ SOURCES += Ability.cpp \ Author.cpp \ Badge.cpp \ CoinList.cpp \ - CoinListObject.cpp \ + CoinListItem.cpp \ EggGroup.cpp \ GlobalScript.cpp \ Item.cpp \ @@ -61,7 +61,7 @@ HEADERS += Ability.h \ Author.h \ Badge.h \ CoinList.h \ - CoinListObject.h \ + CoinListItem.h \ EggGroup.h \ Global.h \ GlobalScript.h \ diff --git a/sigmodr/CMakeLists.txt b/sigmodr/CMakeLists.txt index 1b13baad..7c51500c 100644 --- a/sigmodr/CMakeLists.txt +++ b/sigmodr/CMakeLists.txt @@ -14,7 +14,7 @@ SET(sigmodr_FORMS gui/author.ui gui/badge.ui gui/coinlist.ui - gui/coinlistobject.ui + gui/coinlistitem.ui gui/egggroup.ui gui/fraction.ui gui/globalscript.ui @@ -54,7 +54,7 @@ SET(sigmodr_WIDGET_HEADERS AuthorUI.h BadgeUI.h CoinListUI.h - CoinListObjectUI.h + CoinListItemUI.h EggGroupUI.h GlobalScriptUI.h ItemUI.h @@ -97,7 +97,7 @@ SET(sigmodr_MODEL_HEADERS models/BaseObjectModel.h models/CoinListGroupModel.h models/CoinListModel.h - models/CoinListObjectModel.h + models/CoinListItemModel.h models/EggGroupGroupModel.h models/EggGroupModel.h models/GlobalScriptGroupModel.h @@ -184,7 +184,7 @@ SET(sigmodr_WIDGET_SRCS AuthorUI.cpp BadgeUI.cpp CoinListUI.cpp - CoinListObjectUI.cpp + CoinListItemUI.cpp EggGroupUI.cpp GlobalScriptUI.cpp ItemUI.cpp @@ -227,7 +227,7 @@ SET(sigmodr_MODEL_SRCS models/BaseObjectModel.cpp models/CoinListGroupModel.cpp models/CoinListModel.cpp - models/CoinListObjectModel.cpp + models/CoinListItemModel.cpp models/EggGroupGroupModel.cpp models/EggGroupModel.cpp models/GlobalScriptGroupModel.cpp diff --git a/sigmodr/CoinListItemUI.cpp b/sigmodr/CoinListItemUI.cpp new file mode 100644 index 00000000..02cefddb --- /dev/null +++ b/sigmodr/CoinListItemUI.cpp @@ -0,0 +1,103 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "CoinListItemUI.h" + +// Sigmod includes +#include "../sigmod/CoinListItem.h" +#include "../sigmod/Item.h" +#include "../sigmod/Sigmod.h" +#include "../sigmod/Species.h" + +Sigmodr::CoinListItemUI::CoinListItemUI(Sigmod::CoinListItem* item, QWidget* parent) : + ObjectUI(parent), + m_lastType(-1) +{ + setupUi(this); + setObjects(item, new Sigmod::CoinListItem(*item)); +} + +Sigmodr::CoinListItemUI::~CoinListItemUI() +{ +} + +void Sigmodr::CoinListItemUI::initGui() +{ + connect(varType, SIGNAL(activated(const int)), this, SLOT(setGui())); + varType->addItem(Sigmod::CoinListItem::TypeStr[Sigmod::CoinListItem::Item], QVariant::fromValue(Sigmod::CoinListItem::Item)); + varType->addItem(Sigmod::CoinListItem::TypeStr[Sigmod::CoinListItem::Species], QVariant::fromValue(Sigmod::CoinListItem::Species)); +} + +void Sigmodr::CoinListItemUI::setGui() +{ + bool resetObjects = (qobject_cast<Sigmod::CoinListItem*>(modified())->type() != m_lastType); + varType->setCurrentIndex(qobject_cast<Sigmod::CoinListItem*>(modified())->type()); + m_lastType = qobject_cast<Sigmod::CoinListItem*>(modified())->type(); + if (resetObjects) + { + const bool blocked = varObject->blockSignals(true); + varObject->clear(); + if (qobject_cast<Sigmod::CoinListItem*>(modified())->type() == Sigmod::CoinListItem::Item) + { + for (int i = 0; i < sigmod()->itemCount(); ++i) + { + const Sigmod::Item* item = sigmod()->item(i); + varObject->addItem(item->name(), item->id()); + } + } + else + { + for (int i = 0; i < sigmod()->speciesCount(); ++i) + { + const Sigmod::Species* species = sigmod()->species(i); + varObject->addItem(species->name(), species->id()); + } + } + varObject->blockSignals(blocked); + } + varObject->setCurrentIndex(varObject->findData(qobject_cast<Sigmod::CoinListItem*>(modified())->object())); + varCost->setValue(qobject_cast<Sigmod::CoinListItem*>(modified())->cost()); +} + +void Sigmodr::CoinListItemUI::apply() +{ + *qobject_cast<Sigmod::CoinListItem*>(original()) = *qobject_cast<Sigmod::CoinListItem*>(modified()); + emit(changed(false)); +} + +void Sigmodr::CoinListItemUI::discard() +{ + *qobject_cast<Sigmod::CoinListItem*>(modified()) = *qobject_cast<Sigmod::CoinListItem*>(original()); + setGui(); + emit(changed(false)); +} + +void Sigmodr::CoinListItemUI::on_varType_activated(const int type) +{ + qobject_cast<Sigmod::CoinListItem*>(modified())->setType(varType->itemData(type).value<Sigmod::CoinListItem::Type>()); +} + +void Sigmodr::CoinListItemUI::on_varObject_activated(const int obey) +{ + qobject_cast<Sigmod::CoinListItem*>(modified())->setObject(varObject->itemData(obey).toInt()); +} + +void Sigmodr::CoinListItemUI::on_varCost_valueChanged(const int cost) +{ + qobject_cast<Sigmod::CoinListItem*>(modified())->setCost(cost); +} diff --git a/sigmodr/CoinListObjectUI.h b/sigmodr/CoinListItemUI.h index 0b08150c..c8d3202b 100644 --- a/sigmodr/CoinListObjectUI.h +++ b/sigmodr/CoinListItemUI.h @@ -15,30 +15,30 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGMODR_COINLISTOBJECTUI -#define SIGMODR_COINLISTOBJECTUI +#ifndef SIGMODR_COINLISTITEMUI +#define SIGMODR_COINLISTITEMUI // Sigmodr includes #include "ObjectUI.h" // Form include -#include "ui_coinlistobject.h" +#include "ui_coinlistitem.h" // Forward declarations namespace Sigmod { -class CoinListObject; +class CoinListItem; } namespace Sigmodr { -class CoinListObjectUI : public ObjectUI, private Ui::formCoinListObject +class CoinListItemUI : public ObjectUI, private Ui::formCoinListItem { Q_OBJECT public: - CoinListObjectUI(Sigmod::CoinListObject* object, QWidget* parent); - ~CoinListObjectUI(); + CoinListItemUI(Sigmod::CoinListItem* item, QWidget* parent); + ~CoinListItemUI(); public slots: void apply(); void discard(); diff --git a/sigmodr/CoinListObjectUI.cpp b/sigmodr/CoinListObjectUI.cpp deleted file mode 100644 index 2979ba11..00000000 --- a/sigmodr/CoinListObjectUI.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "CoinListObjectUI.h" - -// Sigmod includes -#include "../sigmod/CoinListObject.h" -#include "../sigmod/Item.h" -#include "../sigmod/Sigmod.h" -#include "../sigmod/Species.h" - -Sigmodr::CoinListObjectUI::CoinListObjectUI(Sigmod::CoinListObject* object, QWidget* parent) : - ObjectUI(parent), - m_lastType(-1) -{ - setupUi(this); - setObjects(object, new Sigmod::CoinListObject(*object)); -} - -Sigmodr::CoinListObjectUI::~CoinListObjectUI() -{ -} - -void Sigmodr::CoinListObjectUI::initGui() -{ - connect(varType, SIGNAL(activated(const int)), this, SLOT(setGui())); - varType->addItem(Sigmod::CoinListObject::TypeStr[Sigmod::CoinListObject::Item], QVariant::fromValue(Sigmod::CoinListObject::Item)); - varType->addItem(Sigmod::CoinListObject::TypeStr[Sigmod::CoinListObject::Species], QVariant::fromValue(Sigmod::CoinListObject::Species)); -} - -void Sigmodr::CoinListObjectUI::setGui() -{ - bool resetObjects = (qobject_cast<Sigmod::CoinListObject*>(modified())->type() != m_lastType); - varType->setCurrentIndex(qobject_cast<Sigmod::CoinListObject*>(modified())->type()); - m_lastType = qobject_cast<Sigmod::CoinListObject*>(modified())->type(); - if (resetObjects) - { - const bool blocked = varObject->blockSignals(true); - varObject->clear(); - if (qobject_cast<Sigmod::CoinListObject*>(modified())->type() == Sigmod::CoinListObject::Item) - { - for (int i = 0; i < sigmod()->itemCount(); ++i) - { - const Sigmod::Item* item = sigmod()->item(i); - varObject->addItem(item->name(), item->id()); - } - } - else - { - for (int i = 0; i < sigmod()->speciesCount(); ++i) - { - const Sigmod::Species* species = sigmod()->species(i); - varObject->addItem(species->name(), species->id()); - } - } - varObject->blockSignals(blocked); - } - varObject->setCurrentIndex(varObject->findData(qobject_cast<Sigmod::CoinListObject*>(modified())->object())); - varCost->setValue(qobject_cast<Sigmod::CoinListObject*>(modified())->cost()); -} - -void Sigmodr::CoinListObjectUI::apply() -{ - *qobject_cast<Sigmod::CoinListObject*>(original()) = *qobject_cast<Sigmod::CoinListObject*>(modified()); - emit(changed(false)); -} - -void Sigmodr::CoinListObjectUI::discard() -{ - *qobject_cast<Sigmod::CoinListObject*>(modified()) = *qobject_cast<Sigmod::CoinListObject*>(original()); - setGui(); - emit(changed(false)); -} - -void Sigmodr::CoinListObjectUI::on_varType_activated(const int type) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setType(varType->itemData(type).value<Sigmod::CoinListObject::Type>()); -} - -void Sigmodr::CoinListObjectUI::on_varObject_activated(const int obey) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setObject(varObject->itemData(obey).toInt()); -} - -void Sigmodr::CoinListObjectUI::on_varCost_valueChanged(const int cost) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setCost(cost); -} diff --git a/sigmodr/gui/coinlistobject.ui b/sigmodr/gui/coinlistitem.ui index 13f62d78..bc4ae2bd 100644 --- a/sigmodr/gui/coinlistobject.ui +++ b/sigmodr/gui/coinlistitem.ui @@ -1,6 +1,6 @@ <ui version="4.0" > - <class>formCoinListObject</class> - <widget class="QWidget" name="formCoinListObject" > + <class>formCoinListItem</class> + <widget class="QWidget" name="formCoinListItem" > <layout class="QVBoxLayout" > <item> <widget class="QGroupBox" name="boxType" > @@ -8,13 +8,13 @@ <string>Type</string> </property> <property name="toolTip" > - <string>The type of object</string> + <string>The type of item</string> </property> <property name="statusTip" > - <string>The type of object</string> + <string>The type of item</string> </property> <property name="whatsThis" > - <string>The type of object</string> + <string>The type ofitem</string> </property> <layout class="QVBoxLayout" > <item> diff --git a/sigmodr/models/CoinListObjectModel.cpp b/sigmodr/models/CoinListItemModel.cpp index 8264e272..f46e8ee5 100644 --- a/sigmodr/models/CoinListObjectModel.cpp +++ b/sigmodr/models/CoinListItemModel.cpp @@ -16,17 +16,17 @@ */ // Header include -#include "CoinListObjectModel.h" +#include "CoinListItemModel.h" // Model includes #include "GroupObjectModel.h" // Sigmodr includes -#include "../CoinListObjectUI.h" +#include "../CoinListItemUI.h" // Sigmod includes #include "../../sigmod/CoinList.h" -#include "../../sigmod/CoinListObject.h" +#include "../../sigmod/CoinListItem.h" #include "../../sigmod/Item.h" #include "../../sigmod/Sigmod.h" #include "../../sigmod/Species.h" @@ -34,29 +34,29 @@ // KDE includes #include <KMenu> -Sigmodr::CoinListObjectModel::CoinListObjectModel(BaseModel* parent, Sigmod::CoinListObject* object) : - ObjectModel(parent, object) +Sigmodr::CoinListItemModel::CoinListItemModel(BaseModel* parent, Sigmod::CoinListItem* item) : + ObjectModel(parent, item) { } -Sigmodr::CoinListObjectModel::~CoinListObjectModel() +Sigmodr::CoinListItemModel::~CoinListItemModel() { } -QVariant Sigmodr::CoinListObjectModel::data(int role) const +QVariant Sigmodr::CoinListItemModel::data(int role) const { if (role == Qt::DisplayRole) { - Sigmod::CoinListObject* object = qobject_cast<Sigmod::CoinListObject*>(m_object); - if (object->type() == Sigmod::CoinListObject::Item) + Sigmod::CoinListItem* item = qobject_cast<Sigmod::CoinListItem*>(m_object); + if (item->type() == Sigmod::CoinListItem::Item) { - const Sigmod::Item* item = m_object->sigmod()->itemById(object->object()); - if (item) - return item->name(); + const Sigmod::Item* _item = m_object->sigmod()->itemById(item->object()); + if (_item) + return _item->name(); } - else if (object->type() == Sigmod::CoinListObject::Species) + else if (item->type() == Sigmod::CoinListItem::Species) { - const Sigmod::Species* species = m_object->sigmod()->speciesById(object->object()); + const Sigmod::Species* species = m_object->sigmod()->speciesById(item->object()); if (species) return species->name(); } @@ -70,7 +70,7 @@ QVariant Sigmodr::CoinListObjectModel::data(int role) const } else if (role == Sigmodr::BaseModel::WidgetRole) { - QWidget* widget = new CoinListObjectUI(qobject_cast<Sigmod::CoinListObject*>(m_object), NULL); + QWidget* widget = new CoinListItemUI(qobject_cast<Sigmod::CoinListItem*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == Sigmodr::BaseModel::ContextMenuRole) @@ -82,7 +82,7 @@ QVariant Sigmodr::CoinListObjectModel::data(int role) const return Sigmodr::ObjectModel::data(role); } -void Sigmodr::CoinListObjectModel::deleteSelf() +void Sigmodr::CoinListItemModel::deleteSelf() { qobject_cast<GroupObjectModel*>(m_parent)->deleteObject(this); } diff --git a/sigmodr/models/CoinListObjectModel.h b/sigmodr/models/CoinListItemModel.h index e8a83561..fd6d8b85 100644 --- a/sigmodr/models/CoinListObjectModel.h +++ b/sigmodr/models/CoinListItemModel.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGMODR_COINLISTOBJECTMODEL -#define SIGMODR_COINLISTOBJECTMODEL +#ifndef SIGMODR_COINLISTITEMMODEL +#define SIGMODR_COINLISTITEMMODEL // Model includes #include "ObjectModel.h" @@ -24,18 +24,18 @@ // Forward declarations namespace Sigmod { -class CoinListObject; +class CoinListItem; } namespace Sigmodr { -class CoinListObjectModel : public ObjectModel +class CoinListItemModel : public ObjectModel { Q_OBJECT public: - CoinListObjectModel(BaseModel* parent, Sigmod::CoinListObject* object); - ~CoinListObjectModel(); + CoinListItemModel(BaseModel* parent, Sigmod::CoinListItem* item); + ~CoinListItemModel(); QVariant data(int role = Qt::DisplayRole) const; public slots: diff --git a/sigmodr/models/CoinListModel.cpp b/sigmodr/models/CoinListModel.cpp index 0c6264f8..6a728a41 100644 --- a/sigmodr/models/CoinListModel.cpp +++ b/sigmodr/models/CoinListModel.cpp @@ -19,7 +19,7 @@ #include "CoinListModel.h" // Model includes -#include "CoinListObjectModel.h" +#include "CoinListItemModel.h" #include "GroupModel.h" // Sigmodr includes @@ -27,7 +27,7 @@ // Sigmod includes #include "../../sigmod/CoinList.h" -#include "../../sigmod/CoinListObject.h" +#include "../../sigmod/CoinListItem.h" // KDE includes #include <KMenu> @@ -86,9 +86,9 @@ bool Sigmodr::CoinListModel::setData(const QVariant& value, int role) setupData(); return true; } - else if (xml.doctype().name() == "CoinListObject") + else if (xml.doctype().name() == "CoinListItem") { - addObject(qobject_cast<Sigmod::CoinList*>(m_object)->newObject(xml.documentElement())); + addObject(qobject_cast<Sigmod::CoinList*>(m_object)->newItem(xml.documentElement())); return true; } } @@ -99,15 +99,15 @@ bool Sigmodr::CoinListModel::setData(const QVariant& value, int role) QString Sigmodr::CoinListModel::types() const { - return type().append(";CoinListObject"); + return type().append(";CoinListItem"); } void Sigmodr::CoinListModel::addObject(Sigmod::Object* object) { if (!object) - object = qobject_cast<Sigmod::CoinList*>(m_object)->newObject(); - if (object->className() == "CoinListObject") - addChild(new CoinListObjectModel(this, qobject_cast<Sigmod::CoinListObject*>(object))); + object = qobject_cast<Sigmod::CoinList*>(m_object)->newItem(); + if (object->className() == "CoinListItem") + addChild(new CoinListItemModel(this, qobject_cast<Sigmod::CoinListItem*>(object))); } void Sigmodr::CoinListModel::deleteObject(BaseModel* model) @@ -115,7 +115,7 @@ void Sigmodr::CoinListModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::CoinList*>(m_object)->deleteObject(index); + qobject_cast<Sigmod::CoinList*>(m_object)->deleteItem(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -130,6 +130,6 @@ void Sigmodr::CoinListModel::deleteSelf() void Sigmodr::CoinListModel::setupData() { Sigmod::CoinList* coinList = qobject_cast<Sigmod::CoinList*>(m_object); - for (int i = 0; i < coinList->objectCount(); ++i) - addChild(new CoinListObjectModel(this, coinList->object(i))); + for (int i = 0; i < coinList->itemCount(); ++i) + addChild(new CoinListItemModel(this, coinList->item(i))); } diff --git a/sigmodr/sigmodr.pro b/sigmodr/sigmodr.pro index 8d86cabc..d39fe6b5 100644 --- a/sigmodr/sigmodr.pro +++ b/sigmodr/sigmodr.pro @@ -39,7 +39,7 @@ SOURCES += AbilityUI.cpp \ AuthorUI.cpp \ BadgeUI.cpp \ CoinListUI.cpp \ - CoinListObjectUI.cpp \ + CoinListItemUI.cpp \ EffectItem.cpp \ EggGroupUI.cpp \ FractionWidget.cpp \ @@ -95,7 +95,7 @@ SOURCES += AbilityUI.cpp \ models/BaseObjectModel.cpp \ models/CoinListGroupModel.cpp \ models/CoinListModel.cpp \ - models/CoinListObjectModel.cpp \ + models/CoinListItemModel.cpp \ models/EggGroupGroupModel.cpp \ models/EggGroupModel.cpp \ models/GlobalScriptGroupModel.cpp \ @@ -160,7 +160,7 @@ HEADERS += AbilityUI.h \ AuthorUI.h \ BadgeUI.h \ CoinListUI.h \ - CoinListObjectUI.h \ + CoinListItemUI.h \ EffectItem.h \ EggGroupUI.h \ FractionWidget.h \ @@ -215,7 +215,7 @@ HEADERS += AbilityUI.h \ models/BaseObjectModel.h \ models/CoinListGroupModel.h \ models/CoinListModel.h \ - models/CoinListObjectModel.h \ + models/CoinListItemModel.h \ models/EggGroupGroupModel.h \ models/EggGroupModel.h \ models/GlobalScriptGroupModel.h \ @@ -280,7 +280,7 @@ FORMS += gui/ability.ui \ gui/author.ui \ gui/badge.ui \ gui/coinlist.ui \ - gui/coinlistobject.ui \ + gui/coinlistitem.ui \ gui/egggroup.ui \ gui/fraction.ui \ gui/globalscript.ui \ diff --git a/sigscript/CMakeLists.txt b/sigscript/CMakeLists.txt index 0c99a07f..9711b169 100644 --- a/sigscript/CMakeLists.txt +++ b/sigscript/CMakeLists.txt @@ -10,7 +10,7 @@ SET(sigscript_HEADERS AuthorWrapper.h BadgeWrapper.h CoinListWrapper.h - CoinListObjectWrapper.h + CoinListItemWrapper.h EggGroupWrapper.h GlobalScriptWrapper.h ItemWrapper.h @@ -49,7 +49,7 @@ SET(sigscript_SRCS AuthorWrapper.cpp BadgeWrapper.cpp CoinListWrapper.cpp - CoinListObjectWrapper.cpp + CoinListItemWrapper.cpp EggGroupWrapper.cpp GlobalScriptWrapper.cpp ItemWrapper.cpp diff --git a/sigscript/CoinListObjectWrapper.cpp b/sigscript/CoinListItemWrapper.cpp index bde11143..01bf3094 100644 --- a/sigscript/CoinListObjectWrapper.cpp +++ b/sigscript/CoinListItemWrapper.cpp @@ -16,55 +16,55 @@ */ // Header include -#include "CoinListObjectWrapper.h" +#include "CoinListItemWrapper.h" // Sigscript includes #include "CoinListWrapper.h" #include "SigmodWrapper.h" -Sigscript::CoinListObjectWrapper* Sigscript::CoinListObjectWrapper::create(const Sigmod::CoinListObject* object, CoinListWrapper* parent) +Sigscript::CoinListItemWrapper* Sigscript::CoinListItemWrapper::create(const Sigmod::CoinListItem* object, CoinListWrapper* parent) { Signature sig = Signature(parent, Subsignature(object->className(), object->id())); if (!m_instances.contains(sig)) - m_instances[sig] = new CoinListObjectWrapper(object, parent); - return qobject_cast<CoinListObjectWrapper*>(m_instances[sig]); + m_instances[sig] = new CoinListItemWrapper(object, parent); + return qobject_cast<CoinListItemWrapper*>(m_instances[sig]); } -Sigscript::CoinListObjectWrapper::CoinListObjectWrapper(const Sigmod::CoinListObject* object, CoinListWrapper* parent) : +Sigscript::CoinListItemWrapper::CoinListItemWrapper(const Sigmod::CoinListItem* object, CoinListWrapper* parent) : ObjectWrapper(object, parent), m_object(object) { } -Sigmod::CoinListObject::Type Sigscript::CoinListObjectWrapper::type(const QString& name) const +Sigmod::CoinListItem::Type Sigscript::CoinListItemWrapper::type(const QString& name) const { if (name == "Item") - return Sigmod::CoinListObject::Item; + return Sigmod::CoinListItem::Item; else if (name == "Species") - return Sigmod::CoinListObject::Species; - return QVariant(-1).value<Sigmod::CoinListObject::Type>(); + return Sigmod::CoinListItem::Species; + return QVariant(-1).value<Sigmod::CoinListItem::Type>(); } -Sigmod::CoinListObject::Type Sigscript::CoinListObjectWrapper::type() const +Sigmod::CoinListItem::Type Sigscript::CoinListItemWrapper::type() const { return m_object->type(); } -Sigscript::ItemWrapper* Sigscript::CoinListObjectWrapper::itemObject() +Sigscript::ItemWrapper* Sigscript::CoinListItemWrapper::itemObject() { - if (m_object->type() == Sigmod::CoinListObject::Item) + if (m_object->type() == Sigmod::CoinListItem::Item) return sigmod()->item(m_object->object()); return NULL; } -Sigscript::SpeciesWrapper* Sigscript::CoinListObjectWrapper::speciesObject() +Sigscript::SpeciesWrapper* Sigscript::CoinListItemWrapper::speciesObject() { - if (m_object->type() == Sigmod::CoinListObject::Species) + if (m_object->type() == Sigmod::CoinListItem::Species) return sigmod()->species(m_object->object()); return NULL; } -int Sigscript::CoinListObjectWrapper::cost() const +int Sigscript::CoinListItemWrapper::cost() const { if (sigmod()->singlePlayer() && hasValueOfType<int>("cost")) return valueOfType<int>("cost"); diff --git a/sigscript/CoinListObjectWrapper.h b/sigscript/CoinListItemWrapper.h index 0443741b..ccaeae8a 100644 --- a/sigscript/CoinListObjectWrapper.h +++ b/sigscript/CoinListItemWrapper.h @@ -15,14 +15,14 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGSCRIPT_COINLISTOBJECTWRAPPER -#define SIGSCRIPT_COINLISTOBJECTWRAPPER +#ifndef SIGSCRIPT_COINLISTITEMWRAPPER +#define SIGSCRIPT_COINLISTITEMWRAPPER // Sigscript includes #include "ObjectWrapper.h" // Sigmod includes -#include "../sigmod/CoinListObject.h" +#include "../sigmod/CoinListItem.h" namespace Sigscript { @@ -31,26 +31,26 @@ class CoinListWrapper; class ItemWrapper; class SpeciesWrapper; -class SIGSCRIPT_EXPORT CoinListObjectWrapper : public ObjectWrapper +class SIGSCRIPT_EXPORT CoinListItemWrapper : public ObjectWrapper { Q_OBJECT public: - static CoinListObjectWrapper* create(const Sigmod::CoinListObject* object, CoinListWrapper* parent); + static CoinListItemWrapper* create(const Sigmod::CoinListItem* object, CoinListWrapper* parent); - Q_SCRIPTABLE Sigmod::CoinListObject::Type type(const QString& name) const; + Q_SCRIPTABLE Sigmod::CoinListItem::Type type(const QString& name) const; - Q_SCRIPTABLE Sigmod::CoinListObject::Type type() const; + Q_SCRIPTABLE Sigmod::CoinListItem::Type type() const; Q_SCRIPTABLE ItemWrapper* itemObject(); Q_SCRIPTABLE SpeciesWrapper* speciesObject(); Q_SCRIPTABLE int cost() const; private: - CoinListObjectWrapper(const Sigmod::CoinListObject* object, CoinListWrapper* parent); - CoinListObjectWrapper& operator=(const CoinListObjectWrapper& rhs); + CoinListItemWrapper(const Sigmod::CoinListItem* object, CoinListWrapper* parent); + CoinListItemWrapper& operator=(const CoinListItemWrapper& rhs); - const Sigmod::CoinListObject* m_object; + const Sigmod::CoinListItem* m_object; }; } -Q_DECLARE_METATYPE(Sigscript::CoinListObjectWrapper*) +Q_DECLARE_METATYPE(Sigscript::CoinListItemWrapper*) #endif diff --git a/sigscript/CoinListWrapper.cpp b/sigscript/CoinListWrapper.cpp index a7186c45..bc525784 100644 --- a/sigscript/CoinListWrapper.cpp +++ b/sigscript/CoinListWrapper.cpp @@ -19,7 +19,7 @@ #include "CoinListWrapper.h" // Sigscript includes -#include "CoinListObjectWrapper.h" +#include "CoinListItemWrapper.h" #include "SigmodWrapper.h" Sigscript::CoinListWrapper* Sigscript::CoinListWrapper::create(const Sigmod::CoinList* coinList, SigmodWrapper* parent) @@ -46,12 +46,12 @@ Sigcore::Script Sigscript::CoinListWrapper::script() const return m_coinList->script(); } -Sigscript::CoinListObjectWrapper* Sigscript::CoinListWrapper::object(const int index) +Sigscript::CoinListItemWrapper* Sigscript::CoinListWrapper::item(const int index) { - return CoinListObjectWrapper::create(m_coinList->object(index), this); + return CoinListItemWrapper::create(m_coinList->item(index), this); } -int Sigscript::CoinListWrapper::objectCount() const +int Sigscript::CoinListWrapper::itemCount() const { - return m_coinList->objectCount(); + return m_coinList->itemCount(); } diff --git a/sigscript/CoinListWrapper.h b/sigscript/CoinListWrapper.h index 5274491f..f5946f37 100644 --- a/sigscript/CoinListWrapper.h +++ b/sigscript/CoinListWrapper.h @@ -27,7 +27,7 @@ namespace Sigscript { // Forward declarations -class CoinListObjectWrapper; +class CoinListItemWrapper; class SigmodWrapper; class SIGSCRIPT_EXPORT CoinListWrapper : public ObjectWrapper @@ -40,8 +40,8 @@ class SIGSCRIPT_EXPORT CoinListWrapper : public ObjectWrapper Q_SCRIPTABLE QString name() const; Q_SCRIPTABLE Sigcore::Script script() const; - Q_SCRIPTABLE CoinListObjectWrapper* object(const int index); - Q_SCRIPTABLE int objectCount() const; + Q_SCRIPTABLE CoinListItemWrapper* item(const int index); + Q_SCRIPTABLE int itemCount() const; private: CoinListWrapper(const Sigmod::CoinList* coinList, SigmodWrapper* parent); CoinListWrapper& operator=(const CoinListWrapper& rhs); diff --git a/sigscript/sigscript.pro b/sigscript/sigscript.pro index 9bc0e290..d0dd6f30 100644 --- a/sigscript/sigscript.pro +++ b/sigscript/sigscript.pro @@ -28,7 +28,7 @@ SOURCES += AbilityWrapper.cpp \ AuthorWrapper.cpp \ BadgeWrapper.cpp \ CoinListWrapper.cpp \ - CoinListObjectWrapper.cpp \ + CoinListItemWrapper.cpp \ Config.cpp \ EggGroupWrapper.cpp \ GlobalScriptWrapper.cpp \ @@ -65,7 +65,7 @@ HEADERS += AbilityWrapper.h \ AuthorWrapper.h \ BadgeWrapper.h \ CoinListWrapper.h \ - CoinListObjectWrapper.h \ + CoinListItemWrapper.h \ Config.h \ EggGroupWrapper.h \ Global.h \ |