diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-25 21:17:56 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-25 21:17:56 +0000 |
| commit | 7e3bf1853184f96eb5be47dd78ebe21fdc170a01 (patch) | |
| tree | 7c937aa87fa165fc62bb49d71983e1512f2371c2 | |
| parent | dec252e25fc63fe1bb321dd87772181fc76e998f (diff) | |
| download | sigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.tar.gz sigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.tar.xz sigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.zip | |
[ADD] More documentation
[FIX] Cleaned out some code from the models
[FIX] Matrix should now work a lot better now
[FIX] Opening/Saving/Closing PokéMods should be much cleaner now
[FIX] currentPokemod code is now in the tree class
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@173 6ecfd1a5-f3ed-3746-8530-beee90d26b22
82 files changed, 477 insertions, 975 deletions
@@ -1,4 +1,15 @@ ----------------- +Rev: 173 +Date: 25 May 2008 +User: MathStuf +----------------- +[ADD] More documentation +[FIX] Cleaned out some code from the models +[FIX] Matrix should now work a lot better now +[FIX] Opening/Saving/Closing PokéMods should be much cleaner now +[FIX] currentPokemod code is now in the tree class + +----------------- Rev: 172 Date: 24 May 2008 User: MathStuf diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp index ff2b8d80..2e0d4066 100644 --- a/pokemod/CoinListObject.cpp +++ b/pokemod/CoinListObject.cpp @@ -22,7 +22,7 @@ #include "CoinList.h" #include "Pokemod.h" -const QStringList CoinListObject::TypeStr = QStringList() << "Item" << "Pokémon"; +const QStringList CoinListObject::TypeStr = QStringList() << "Item" << QString::fromUtf8("Pokémon"); CoinListObject::CoinListObject(const CoinListObject& object) : Object("CoinListObject", object.parent(), object.id()) diff --git a/pokemod/Matrix.h b/pokemod/Matrix.h index 15b70ff0..3e007e07 100644 --- a/pokemod/Matrix.h +++ b/pokemod/Matrix.h @@ -85,7 +85,10 @@ template<class T> class Matrix return; m_matrix.remove(row); if (!(--m_height)) - m_width = 0; + { + while (m_width) + deleteColumn(0); + } } void deleteColumn(const int column) { @@ -94,7 +97,10 @@ template<class T> class Matrix foreach (QVector<T> row, m_matrix) row.remove(column); if (!(--m_width)) - m_height = 0; + { + while (m_height) + deleteRow(0); + } } void clear() { @@ -111,18 +117,35 @@ template<class T> class Matrix } void resize(const int height, const int width, const T& value = T()) { - // FIXME: destructive to data even when expanding - clear(); - m_width = width; - m_height = height; - if (!m_width ^ !m_height) + int newHeight = height; + int newWidth = width; + if (!newWidth ^ !newHeight) + { + if (newWidth) + ++newHeight; + if (newHeight) + ++newWidth; + } + if (m_height < newHeight) + { + while (m_height < newHeight) + addRow(value); + } + else + { + while (newHeight < m_height) + deleteRow(newHeight); + } + if (m_height < newHeight) + { + while (m_width < newWidth) + addColumn(value); + } + else { - if (m_width) - ++m_height; - if (m_height) - ++m_width; + while (newWidth < m_width) + deleteColumn(newWidth); } - m_matrix = QVector< QVector<T> >(m_height, QVector<T>(m_width, value)); } T at(const int row, const int column) const diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp index a673d2e8..7ea15841 100644 --- a/pokemodr/PokeModrUI.cpp +++ b/pokemodr/PokeModrUI.cpp @@ -134,8 +134,7 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren PokeModrUI::~PokeModrUI() { -// delete m_recent; -// on_actionQuit_triggered(); + closeAllPokemods(true); } void PokeModrUI::update() @@ -145,8 +144,10 @@ void PokeModrUI::update() void PokeModrUI::closeEvent(QCloseEvent* event) { - quit(); - event->accept(); + if (closeAllPokemods()) + event->accept(); + else + event->ignore(); } void PokeModrUI::setChangedTitle(const bool changed) @@ -190,9 +191,9 @@ bool PokeModrUI::openPokemod(const KUrl& url) QString temp; if (KIO::NetAccess::download(url, temp, this)) { - if (openPokemod(temp)) - return true; + const bool opened = openPokemod(temp); KIO::NetAccess::removeTempFile(temp); + return opened; } else KMessageBox::error(this, KIO::NetAccess::lastErrorString(), "KIO Error"); @@ -225,34 +226,20 @@ bool PokeModrUI::openPokemod(const QString& path) void PokeModrUI::savePokemod() { - const Pokemod* pokemod = currentPokemod(); - if (pokemod) - { - KUrl url = treePokemod->url(pokemod); - if (url.isEmpty()) - saveAsPokemod(); - else - savePokemod(url); - } + savePokemod(treePokemod->currentPokemod()); } -void PokeModrUI::saveAsPokemod() +void PokeModrUI::savePokemod(const Pokemod* pokemod) { - const Pokemod* pokemod = currentPokemod(); - if (pokemod) - { - KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog:///pokemod"), QString::fromUtf8("*.pmod|PokéMod files"), this, QString::fromUtf8("Open PokéMod")); - if (!url.isEmpty()) - { - if (savePokemod(url)) - treePokemod->setUrl(pokemod, url); - } - } + const KUrl url = treePokemod->url(pokemod); + if (url.isEmpty()) + saveAsPokemod(pokemod); + else + savePokemod(pokemod, url); } -bool PokeModrUI::savePokemod(const KUrl& url) +bool PokeModrUI::savePokemod(const Pokemod* pokemod, const KUrl& url) { - const Pokemod* pokemod = currentPokemod(); if (pokemod) { if (url.isLocalFile()) @@ -285,35 +272,68 @@ bool PokeModrUI::savePokemod(const KUrl& url) return false; } +void PokeModrUI::saveAsPokemod() +{ + saveAsPokemod(treePokemod->currentPokemod()); +} + +void PokeModrUI::saveAsPokemod(const Pokemod* pokemod) +{ + if (pokemod) + { + KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog:///pokemod"), QString::fromUtf8("*.pmod|PokéMod files"), this, QString::fromUtf8("Open PokéMod")); + if (!url.isEmpty()) + { + if (savePokemod(pokemod, url)) + treePokemod->setUrl(pokemod, url); + } + } +} + void PokeModrUI::closePokemod() { - closePokemod(currentPokemod()); + closePokemod(treePokemod->currentPokemod()); } -void PokeModrUI::closePokemod(const Pokemod* pokemod) +bool PokeModrUI::closePokemod(const Pokemod* pokemod, const bool force) { if (pokemod) { if (treePokemod->dirty(pokemod)) { - switch (KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", QString::fromUtf8("Unsaved PokéMod"))) + int result; + if (force) + result = KMessageBox::questionYesNo(this, "You have unsaved changes, would you like to save them?", QString::fromUtf8("Unsaved PokéMod")); + else + result = KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", QString::fromUtf8("Unsaved PokéMod")); + switch (result) { case KMessageBox::Yes: - savePokemod(); + savePokemod(pokemod); case KMessageBox::No: break; case KMessageBox::Cancel: - return; + return false; } } - treePokemod->deletePokemod(currentPokemod()); + treePokemod->deletePokemod(pokemod); + if (formPanel->widget()) + delete formPanel->takeWidget(); } + return true; } -void PokeModrUI::quit() +bool PokeModrUI::closeAllPokemods(const bool force) { - // TODO: close all pokemods and cancel if any are left open - close(); + QList<const Pokemod*> pokemods = treePokemod->openedPokemods(); + for (int i = 0; i < pokemods.size(); ) + { + if (closePokemod(pokemods[i], force)) + pokemods.removeAt(i); + else + ++i; + } + return !pokemods.size(); } void PokeModrUI::cutObject() @@ -365,8 +385,6 @@ void PokeModrUI::on_treePokemod_clicked(const QModelIndex& index) connect(widget, SIGNAL(changed(bool)), this, SLOT(setChangedTitle(bool))); connect(widget, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); connect(buttonApply, SIGNAL(clicked()), widget, SLOT(apply())); - // TODO: set as dirty -// connect(buttonApply, SIGNAL(clicked(bool)), this, SLOT(setDirty())); connect(buttonDiscard, SIGNAL(clicked()), widget, SLOT(discard())); setChangedTitle(false); formPanel->setWidget(widget); @@ -380,15 +398,3 @@ void PokeModrUI::on_treePokemod_customContextMenuRequested(const QPoint& positio if (menu) menu->popup(mapToGlobal(position)); } - -const Pokemod* PokeModrUI::currentPokemod() const -{ - QModelIndex index = treePokemod->currentIndex(); - if (index.isValid()) - { - const Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); - if (object) - return static_cast<const Pokemod*>(object->pokemod()); - } - return NULL; -} diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h index 5c5a346f..72100974 100644 --- a/pokemodr/PokeModrUI.h +++ b/pokemodr/PokeModrUI.h @@ -55,11 +55,13 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr bool openPokemod(const KUrl& url); bool openPokemod(const QString& path); void savePokemod(); + void savePokemod(const Pokemod* pokemod); + bool savePokemod(const Pokemod* pokemod, const KUrl& url); void saveAsPokemod(); - bool savePokemod(const KUrl& url); + void saveAsPokemod(const Pokemod* pokemod); void closePokemod(); - void closePokemod(const Pokemod* pokemod); - void quit(); + bool closePokemod(const Pokemod* pokemod, const bool force = false); + bool closeAllPokemods(const bool force = false); void cutObject(); void copyObject(); void pasteObject(); @@ -68,8 +70,6 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr void on_treePokemod_clicked(const QModelIndex& index); void on_treePokemod_customContextMenuRequested(const QPoint& position); private: - const Pokemod* currentPokemod() const; - KConfigGroup m_config; KRecentFilesAction* m_recent; QDomDocument m_clipboard; diff --git a/pokemodr/PokemodTree.cpp b/pokemodr/PokemodTree.cpp index 9c38663b..35b41017 100644 --- a/pokemodr/PokemodTree.cpp +++ b/pokemodr/PokemodTree.cpp @@ -25,6 +25,10 @@ #include "ObjectUI.h" #include "PokemodTreeModel.h" +// Pokemod includes +#include "../pokemod/Object.h" +#include "../pokemod/Pokemod.h" + // Qt includes #include <QHeaderView> @@ -43,7 +47,9 @@ QString PokemodTree::description(const QModelIndex& index) ObjectUI* PokemodTree::editorWidget(const QModelIndex& index) { - return static_cast<ObjectUI*>(model()->data(index, BaseModel::WidgetRole).value<QWidget*>()); + ObjectUI* widget = static_cast<ObjectUI*>(model()->data(index, BaseModel::WidgetRole).value<QWidget*>()); + connect(widget, SIGNAL(changed(bool)), this, SLOT(setDirty())); + return widget; } KMenu* PokemodTree::contextMenu(const QModelIndex& index) @@ -51,6 +57,18 @@ KMenu* PokemodTree::contextMenu(const QModelIndex& index) return static_cast<KMenu*>(model()->data(index, BaseModel::ContextMenuRole).value<void*>()); } +const Pokemod* PokemodTree::currentPokemod() const +{ + QModelIndex index = currentIndex(); + if (index.isValid()) + { + const Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); + if (object) + return static_cast<const Pokemod*>(object->pokemod()); + } + return NULL; +} + QDomDocument PokemodTree::cut(const QModelIndex& index) { // TODO: actually cut out the item @@ -69,6 +87,11 @@ void PokemodTree::paste(const QModelIndex& index, const QDomDocument& data) model()->setData(index, data.toString(), BaseModel::XmlRole); } +QList<const Pokemod*> PokemodTree::openedPokemods() const +{ + return m_pokemods.keys(); +} + void PokemodTree::addPokemod(Pokemod* pokemod) { static_cast<PokemodTreeModel*>(model())->addPokemod(pokemod); @@ -115,3 +138,8 @@ void PokemodTree::setDirty(const Pokemod* pokemod, const bool dirty) if (m_pokemods.contains(pokemod)) m_pokemods[pokemod].second = dirty; } + +void PokemodTree::setDirty() +{ + setDirty(currentPokemod(), true); +} diff --git a/pokemodr/PokemodTree.h b/pokemodr/PokemodTree.h index 6cf8bb4f..41b8b283 100644 --- a/pokemodr/PokemodTree.h +++ b/pokemodr/PokemodTree.h @@ -42,10 +42,13 @@ class PokemodTree : public QTreeView ObjectUI* editorWidget(const QModelIndex& index); KMenu* contextMenu(const QModelIndex& index); + const Pokemod* currentPokemod() const; + QDomDocument cut(const QModelIndex& index); QDomDocument copy(const QModelIndex& index); void paste(const QModelIndex& index, const QDomDocument& data); + QList<const Pokemod*> openedPokemods() const; void addPokemod(Pokemod* pokemod); void addPokemod(Pokemod* pokemod, const KUrl& url); void deletePokemod(const Pokemod* pokemod); @@ -56,6 +59,8 @@ class PokemodTree : public QTreeView bool dirty(const Pokemod* pokemod) const; void setDirty(const Pokemod*, const bool dirty); + private slots: + void setDirty(); private: QMap<const Pokemod*, QPair<KUrl, bool> > m_pokemods; }; diff --git a/pokemodr/PokemodTreeModel.cpp b/pokemodr/PokemodTreeModel.cpp index fb8aa4f5..8b71a422 100644 --- a/pokemodr/PokemodTreeModel.cpp +++ b/pokemodr/PokemodTreeModel.cpp @@ -62,8 +62,7 @@ QModelIndex PokemodTreeModel::parent(const QModelIndex& index) const { if (!index.isValid()) return QModelIndex(); - BaseModel* object = static_cast<BaseModel*>(index.internalPointer()); - BaseModel* parent = object->parent(); + BaseModel* parent = static_cast<BaseModel*>(index.internalPointer())->parent(); if (!parent || (parent == m_root)) return QModelIndex(); return createIndex(parent->indexNumber(), 0, parent); @@ -100,28 +99,6 @@ bool PokemodTreeModel::setData(const QModelIndex& index, const QVariant& value, return success; } -bool PokemodTreeModel::insertRows(int /*position*/, int rows, const QModelIndex& parent) -{ - BaseModel* object = getItem(parent); - if (!object->canInsertRows()) - return false; - emit(layoutAboutToBeChanged()); - bool success = object->insertRows(rows); - emit(layoutChanged()); - return success; -} - -bool PokemodTreeModel::removeRows(int position, int rows, const QModelIndex& parent) -{ - BaseModel* object = getItem(parent); - if (!object->canRemoveRows()) - return false; - emit(layoutAboutToBeChanged()); - bool success = object->removeRows(position, rows); - emit(layoutChanged()); - return success; -} - BaseModel* PokemodTreeModel::getItem(const QModelIndex& index) const { if (index.isValid()) @@ -166,14 +143,12 @@ bool PokemodTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action void PokemodTreeModel::addPokemod(Pokemod* pokemod) { - emit(layoutAboutToBeChanged()); m_root->addPokemod(pokemod); - emit(layoutChanged()); + emit(reset()); } void PokemodTreeModel::deletePokemod(const Pokemod* pokemod) { - emit(layoutAboutToBeChanged()); m_root->deletePokemod(pokemod); - emit(layoutChanged()); + emit(reset()); } diff --git a/pokemodr/PokemodTreeModel.h b/pokemodr/PokemodTreeModel.h index a05cc7e4..9f898cb6 100644 --- a/pokemodr/PokemodTreeModel.h +++ b/pokemodr/PokemodTreeModel.h @@ -48,9 +48,6 @@ class PokemodTreeModel : public QAbstractItemModel Qt::ItemFlags flags(const QModelIndex& index) const; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); - bool insertRows(int /*position*/, int rows, const QModelIndex& parent = QModelIndex()); - bool removeRows(int position, int rows, const QModelIndex& parent = QModelIndex()); - Qt::DropActions supportedDragActions(); Qt::DropActions supportedDropActions(); QStringList mimeTypes() const; diff --git a/pokemodr/models/AbilityGroupModel.cpp b/pokemodr/models/AbilityGroupModel.cpp index 26cadf56..76c06764 100644 --- a/pokemodr/models/AbilityGroupModel.cpp +++ b/pokemodr/models/AbilityGroupModel.cpp @@ -34,24 +34,6 @@ AbilityGroupModel::~AbilityGroupModel() { } -bool AbilityGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new AbilityModel(this, static_cast<Pokemod*>(m_object)->newAbility())); - return true; -} - -bool AbilityGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteAbility(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void AbilityGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/AbilityGroupModel.h b/pokemodr/models/AbilityGroupModel.h index 4b212770..29eba507 100644 --- a/pokemodr/models/AbilityGroupModel.h +++ b/pokemodr/models/AbilityGroupModel.h @@ -29,10 +29,6 @@ class AbilityGroupModel : public GroupModel public: AbilityGroupModel(BaseModel* parent, Pokemod* pokemod); ~AbilityGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/AuthorGroupModel.cpp b/pokemodr/models/AuthorGroupModel.cpp index b2709df8..270a0c0d 100644 --- a/pokemodr/models/AuthorGroupModel.cpp +++ b/pokemodr/models/AuthorGroupModel.cpp @@ -34,24 +34,6 @@ AuthorGroupModel::~AuthorGroupModel() { } -bool AuthorGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new AuthorModel(this, static_cast<Pokemod*>(m_object)->newAuthor())); - return true; -} - -bool AuthorGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteAuthor(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void AuthorGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/AuthorGroupModel.h b/pokemodr/models/AuthorGroupModel.h index 1e15f93d..7381ca8b 100644 --- a/pokemodr/models/AuthorGroupModel.h +++ b/pokemodr/models/AuthorGroupModel.h @@ -29,10 +29,6 @@ class AuthorGroupModel : public GroupModel public: AuthorGroupModel(BaseModel* parent, Pokemod* pokemod); ~AuthorGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/BadgeGroupModel.cpp b/pokemodr/models/BadgeGroupModel.cpp index fe615ed2..733abe11 100644 --- a/pokemodr/models/BadgeGroupModel.cpp +++ b/pokemodr/models/BadgeGroupModel.cpp @@ -34,24 +34,6 @@ BadgeGroupModel::~BadgeGroupModel() { } -bool BadgeGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new BadgeModel(this, static_cast<Pokemod*>(m_object)->newBadge())); - return true; -} - -bool BadgeGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteBadge(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void BadgeGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/BadgeGroupModel.h b/pokemodr/models/BadgeGroupModel.h index 5c61a5bf..e7f6aa1a 100644 --- a/pokemodr/models/BadgeGroupModel.h +++ b/pokemodr/models/BadgeGroupModel.h @@ -29,10 +29,6 @@ class BadgeGroupModel : public GroupModel public: BadgeGroupModel(BaseModel* parent, Pokemod* pokemod); ~BadgeGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/BaseModel.h b/pokemodr/models/BaseModel.h index 9de2990c..d2a5b5e6 100644 --- a/pokemodr/models/BaseModel.h +++ b/pokemodr/models/BaseModel.h @@ -42,12 +42,6 @@ class BaseModel virtual BaseModel* childItem(const int row) = 0; int indexNumber() const; - virtual bool canInsertRows() const = 0; - virtual bool insertRows(const int rows) = 0; - - virtual bool canRemoveRows() const = 0; - virtual bool removeRows(const int position, const int rows) = 0; - virtual Qt::DropActions supportedDragActions() = 0; virtual Qt::DropActions supportedDropActions() = 0; diff --git a/pokemodr/models/BaseObjectModel.h b/pokemodr/models/BaseObjectModel.h index 2c5aaa82..f18ce8a4 100644 --- a/pokemodr/models/BaseObjectModel.h +++ b/pokemodr/models/BaseObjectModel.h @@ -35,12 +35,6 @@ class BaseObjectModel : public BaseModel virtual BaseModel* childItem(const int row) = 0; - virtual bool canInsertRows() const = 0; - virtual bool insertRows(const int rows) = 0; - - virtual bool canRemoveRows() const = 0; - virtual bool removeRows(const int position, const int rows) = 0; - Qt::DropActions supportedDragActions(); Qt::DropActions supportedDropActions(); diff --git a/pokemodr/models/CoinListGroupModel.cpp b/pokemodr/models/CoinListGroupModel.cpp index 5351e616..56eeaae3 100644 --- a/pokemodr/models/CoinListGroupModel.cpp +++ b/pokemodr/models/CoinListGroupModel.cpp @@ -34,24 +34,6 @@ CoinListGroupModel::~CoinListGroupModel() { } -bool CoinListGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new CoinListModel(this, static_cast<Pokemod*>(m_object)->newCoinList())); - return true; -} - -bool CoinListGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteCoinList(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void CoinListGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/CoinListGroupModel.h b/pokemodr/models/CoinListGroupModel.h index bdbd4b48..6cde6483 100644 --- a/pokemodr/models/CoinListGroupModel.h +++ b/pokemodr/models/CoinListGroupModel.h @@ -29,10 +29,6 @@ class CoinListGroupModel : public GroupModel public: CoinListGroupModel(BaseModel* parent, Pokemod* pokemod); ~CoinListGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/CoinListModel.cpp b/pokemodr/models/CoinListModel.cpp index fa5f8a0d..e12a3908 100644 --- a/pokemodr/models/CoinListModel.cpp +++ b/pokemodr/models/CoinListModel.cpp @@ -83,24 +83,6 @@ bool CoinListModel::setData(const QVariant& value, int role) return false; } -bool CoinListModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new CoinListObjectModel(this, static_cast<CoinList*>(m_object)->newObject())); - return true; -} - -bool CoinListModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<CoinList*>(m_object)->deleteObject(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void CoinListModel::setupData() { CoinList* coinList = static_cast<CoinList*>(m_object); diff --git a/pokemodr/models/CoinListModel.h b/pokemodr/models/CoinListModel.h index e6cbe9a6..72039a66 100644 --- a/pokemodr/models/CoinListModel.h +++ b/pokemodr/models/CoinListModel.h @@ -23,7 +23,6 @@ // Forward declarations class CoinList; -class CoinListObjectModel; class CoinListModel : public GroupObjectModel { @@ -34,10 +33,6 @@ class CoinListModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/EggGroupGroupModel.cpp b/pokemodr/models/EggGroupGroupModel.cpp index 2b30fbb7..669b512e 100644 --- a/pokemodr/models/EggGroupGroupModel.cpp +++ b/pokemodr/models/EggGroupGroupModel.cpp @@ -34,24 +34,6 @@ EggGroupGroupModel::~EggGroupGroupModel() { } -bool EggGroupGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new EggGroupModel(this, static_cast<Pokemod*>(m_object)->newEggGroup())); - return true; -} - -bool EggGroupGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteEggGroup(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void EggGroupGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/EggGroupGroupModel.h b/pokemodr/models/EggGroupGroupModel.h index 5d2192c0..81a9f78f 100644 --- a/pokemodr/models/EggGroupGroupModel.h +++ b/pokemodr/models/EggGroupGroupModel.h @@ -29,10 +29,6 @@ class EggGroupGroupModel : public GroupModel public: EggGroupGroupModel(BaseModel* parent, Pokemod* pokemod); ~EggGroupGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/GlobalScriptGroupModel.cpp b/pokemodr/models/GlobalScriptGroupModel.cpp index ad2ee2b6..e951327a 100644 --- a/pokemodr/models/GlobalScriptGroupModel.cpp +++ b/pokemodr/models/GlobalScriptGroupModel.cpp @@ -34,24 +34,6 @@ GlobalScriptGroupModel::~GlobalScriptGroupModel() { } -bool GlobalScriptGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new GlobalScriptModel(this, static_cast<Pokemod*>(m_object)->newGlobalScript())); - return true; -} - -bool GlobalScriptGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteGlobalScript(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void GlobalScriptGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/GlobalScriptGroupModel.h b/pokemodr/models/GlobalScriptGroupModel.h index 40796e41..89546115 100644 --- a/pokemodr/models/GlobalScriptGroupModel.h +++ b/pokemodr/models/GlobalScriptGroupModel.h @@ -29,10 +29,6 @@ class GlobalScriptGroupModel : public GroupModel public: GlobalScriptGroupModel(BaseModel* parent, Pokemod* pokemod); ~GlobalScriptGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/GroupModel.cpp b/pokemodr/models/GroupModel.cpp index 1503dc14..c61121e7 100644 --- a/pokemodr/models/GroupModel.cpp +++ b/pokemodr/models/GroupModel.cpp @@ -60,16 +60,6 @@ BaseModel* GroupModel::childItem(const int row) return NULL; } -bool GroupModel::canInsertRows() const -{ - return true; -} - -bool GroupModel::canRemoveRows() const -{ - return true; -} - Qt::DropActions GroupModel::supportedDragActions() { return 0; diff --git a/pokemodr/models/GroupModel.h b/pokemodr/models/GroupModel.h index 46d2d850..0f27a3f0 100644 --- a/pokemodr/models/GroupModel.h +++ b/pokemodr/models/GroupModel.h @@ -41,12 +41,6 @@ class GroupModel : public BaseModel BaseModel* childItem(const int row); - bool canInsertRows() const; - virtual bool insertRows(const int rows) = 0; - - bool canRemoveRows() const; - virtual bool removeRows(const int position, const int rows) = 0; - Qt::DropActions supportedDragActions(); Qt::DropActions supportedDropActions(); protected: diff --git a/pokemodr/models/GroupObjectModel.cpp b/pokemodr/models/GroupObjectModel.cpp index 0536354d..2631bac7 100644 --- a/pokemodr/models/GroupObjectModel.cpp +++ b/pokemodr/models/GroupObjectModel.cpp @@ -44,16 +44,6 @@ BaseModel* GroupObjectModel::childItem(const int row) return NULL; } -bool GroupObjectModel::canInsertRows() const -{ - return true; -} - -bool GroupObjectModel::canRemoveRows() const -{ - return true; -} - int GroupObjectModel::findChild(const BaseModel* model) const { return m_objects.indexOf(const_cast<BaseModel*>(model)); diff --git a/pokemodr/models/GroupObjectModel.h b/pokemodr/models/GroupObjectModel.h index 6b5ed04e..1a062516 100644 --- a/pokemodr/models/GroupObjectModel.h +++ b/pokemodr/models/GroupObjectModel.h @@ -34,12 +34,6 @@ class GroupObjectModel : public BaseObjectModel virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0; BaseModel* childItem(const int row); - - virtual bool canInsertRows() const; - virtual bool insertRows(const int rows) = 0; - - virtual bool canRemoveRows() const; - virtual bool removeRows(const int position, const int rows) = 0; protected: int findChild(const BaseModel* model) const; diff --git a/pokemodr/models/ItemGroupModel.cpp b/pokemodr/models/ItemGroupModel.cpp index 635dac2d..62478e10 100644 --- a/pokemodr/models/ItemGroupModel.cpp +++ b/pokemodr/models/ItemGroupModel.cpp @@ -34,24 +34,6 @@ ItemGroupModel::~ItemGroupModel() { } -bool ItemGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new ItemModel(this, static_cast<Pokemod*>(m_object)->newItem())); - return true; -} - -bool ItemGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteItem(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void ItemGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/ItemGroupModel.h b/pokemodr/models/ItemGroupModel.h index 732f1210..98027f60 100644 --- a/pokemodr/models/ItemGroupModel.h +++ b/pokemodr/models/ItemGroupModel.h @@ -29,10 +29,6 @@ class ItemGroupModel : public GroupModel public: ItemGroupModel(BaseModel* parent, Pokemod* pokemod); ~ItemGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/ItemTypeGroupModel.cpp b/pokemodr/models/ItemTypeGroupModel.cpp index 72af42d5..0e7214c5 100644 --- a/pokemodr/models/ItemTypeGroupModel.cpp +++ b/pokemodr/models/ItemTypeGroupModel.cpp @@ -34,24 +34,6 @@ ItemTypeGroupModel::~ItemTypeGroupModel() { } -bool ItemTypeGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new ItemTypeModel(this, static_cast<Pokemod*>(m_object)->newItemType())); - return true; -} - -bool ItemTypeGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteItemType(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void ItemTypeGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/ItemTypeGroupModel.h b/pokemodr/models/ItemTypeGroupModel.h index c592c8d8..995ec70e 100644 --- a/pokemodr/models/ItemTypeGroupModel.h +++ b/pokemodr/models/ItemTypeGroupModel.h @@ -29,10 +29,6 @@ class ItemTypeGroupModel : public GroupModel public: ItemTypeGroupModel(BaseModel* parent, Pokemod* pokemod); ~ItemTypeGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapEffectGroupModel.cpp b/pokemodr/models/MapEffectGroupModel.cpp index ca0b787c..e4a02be4 100644 --- a/pokemodr/models/MapEffectGroupModel.cpp +++ b/pokemodr/models/MapEffectGroupModel.cpp @@ -34,24 +34,6 @@ MapEffectGroupModel::~MapEffectGroupModel() { } -bool MapEffectGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapEffectModel(this, static_cast<Map*>(m_object)->newEffect())); - return true; -} - -bool MapEffectGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Map*>(m_object)->deleteEffect(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapEffectGroupModel::setupData() { Map* map = static_cast<Map*>(m_object); diff --git a/pokemodr/models/MapEffectGroupModel.h b/pokemodr/models/MapEffectGroupModel.h index b972641e..bed4d2e8 100644 --- a/pokemodr/models/MapEffectGroupModel.h +++ b/pokemodr/models/MapEffectGroupModel.h @@ -29,10 +29,6 @@ class MapEffectGroupModel : public GroupModel public: MapEffectGroupModel(BaseModel* parent, Map* map); ~MapEffectGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapGroupModel.cpp b/pokemodr/models/MapGroupModel.cpp index 767a1007..ad122579 100644 --- a/pokemodr/models/MapGroupModel.cpp +++ b/pokemodr/models/MapGroupModel.cpp @@ -34,24 +34,6 @@ MapGroupModel::~MapGroupModel() { } -bool MapGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapModel(this, static_cast<Pokemod*>(m_object)->newMap())); - return true; -} - -bool MapGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteMap(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/MapGroupModel.h b/pokemodr/models/MapGroupModel.h index cad9de1e..cb1e6c6a 100644 --- a/pokemodr/models/MapGroupModel.h +++ b/pokemodr/models/MapGroupModel.h @@ -29,10 +29,6 @@ class MapGroupModel : public GroupModel public: MapGroupModel(BaseModel* parent, Pokemod* pokemod); ~MapGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapModel.cpp b/pokemodr/models/MapModel.cpp index 57d5e5ee..5a0e76a0 100644 --- a/pokemodr/models/MapModel.cpp +++ b/pokemodr/models/MapModel.cpp @@ -85,16 +85,6 @@ bool MapModel::setData(const QVariant& value, int role) return false; } -bool MapModel::insertRows(const int /*rows*/) -{ - return false; -} - -bool MapModel::removeRows(const int /*position*/, const int /*rows*/) -{ - return false; -} - void MapModel::setupData() { m_objects.append(new MapEffectGroupModel(this, static_cast<Map*>(m_object))); diff --git a/pokemodr/models/MapModel.h b/pokemodr/models/MapModel.h index d53a6edd..4d4e97d0 100644 --- a/pokemodr/models/MapModel.h +++ b/pokemodr/models/MapModel.h @@ -33,10 +33,6 @@ class MapModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int /*rows*/); - - bool removeRows(const int /*position*/, const int /*rows*/); protected: void setupData(); }; diff --git a/pokemodr/models/MapTrainerGroupModel.cpp b/pokemodr/models/MapTrainerGroupModel.cpp index 289ac6fc..71d0ab1c 100644 --- a/pokemodr/models/MapTrainerGroupModel.cpp +++ b/pokemodr/models/MapTrainerGroupModel.cpp @@ -34,24 +34,6 @@ MapTrainerGroupModel::~MapTrainerGroupModel() { } -bool MapTrainerGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapTrainerModel(this, static_cast<Map*>(m_object)->newTrainer())); - return true; -} - -bool MapTrainerGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Map*>(m_object)->deleteTrainer(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapTrainerGroupModel::setupData() { Map* map = static_cast<Map*>(m_object); diff --git a/pokemodr/models/MapTrainerGroupModel.h b/pokemodr/models/MapTrainerGroupModel.h index f5269188..99c769d5 100644 --- a/pokemodr/models/MapTrainerGroupModel.h +++ b/pokemodr/models/MapTrainerGroupModel.h @@ -29,10 +29,6 @@ class MapTrainerGroupModel : public GroupModel public: MapTrainerGroupModel(BaseModel* parent, Map* map); ~MapTrainerGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapTrainerModel.cpp b/pokemodr/models/MapTrainerModel.cpp index 1ef4b875..f5db2f24 100644 --- a/pokemodr/models/MapTrainerModel.cpp +++ b/pokemodr/models/MapTrainerModel.cpp @@ -84,24 +84,6 @@ bool MapTrainerModel::setData(const QVariant& value, int role) return false; } -bool MapTrainerModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapTrainerTeamMemberModel(this, static_cast<MapTrainer*>(m_object)->newTeamMember())); - return true; -} - -bool MapTrainerModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<MapTrainer*>(m_object)->deleteTeamMember(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapTrainerModel::setupData() { MapTrainer* trainer = static_cast<MapTrainer*>(m_object); diff --git a/pokemodr/models/MapTrainerModel.h b/pokemodr/models/MapTrainerModel.h index daf3fb5b..19f6b670 100644 --- a/pokemodr/models/MapTrainerModel.h +++ b/pokemodr/models/MapTrainerModel.h @@ -23,7 +23,6 @@ // Forward declarations class MapTrainer; -class MapTrainerTeamMemberModel; class MapTrainerModel : public GroupObjectModel { @@ -34,10 +33,6 @@ class MapTrainerModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapWarpGroupModel.cpp b/pokemodr/models/MapWarpGroupModel.cpp index 5491b423..fd8bb785 100644 --- a/pokemodr/models/MapWarpGroupModel.cpp +++ b/pokemodr/models/MapWarpGroupModel.cpp @@ -34,24 +34,6 @@ MapWarpGroupModel::~MapWarpGroupModel() { } -bool MapWarpGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapWarpModel(this, static_cast<Map*>(m_object)->newWarp())); - return true; -} - -bool MapWarpGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Map*>(m_object)->deleteWarp(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapWarpGroupModel::setupData() { Map* map = static_cast<Map*>(m_object); diff --git a/pokemodr/models/MapWarpGroupModel.h b/pokemodr/models/MapWarpGroupModel.h index c4b3dc10..97681e5b 100644 --- a/pokemodr/models/MapWarpGroupModel.h +++ b/pokemodr/models/MapWarpGroupModel.h @@ -29,10 +29,6 @@ class MapWarpGroupModel : public GroupModel public: MapWarpGroupModel(BaseModel* parent, Map* map); ~MapWarpGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapWildListGroupModel.cpp b/pokemodr/models/MapWildListGroupModel.cpp index 1e5ac344..da865777 100644 --- a/pokemodr/models/MapWildListGroupModel.cpp +++ b/pokemodr/models/MapWildListGroupModel.cpp @@ -34,24 +34,6 @@ MapWildListGroupModel::~MapWildListGroupModel() { } -bool MapWildListGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapWildListModel(this, static_cast<Map*>(m_object)->newWildList())); - return true; -} - -bool MapWildListGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Map*>(m_object)->deleteWildList(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapWildListGroupModel::setupData() { Map* map = static_cast<Map*>(m_object); diff --git a/pokemodr/models/MapWildListGroupModel.h b/pokemodr/models/MapWildListGroupModel.h index 72267444..fb1d7c74 100644 --- a/pokemodr/models/MapWildListGroupModel.h +++ b/pokemodr/models/MapWildListGroupModel.h @@ -29,10 +29,6 @@ class MapWildListGroupModel : public GroupModel public: MapWildListGroupModel(BaseModel* parent, Map* map); ~MapWildListGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MapWildListModel.cpp b/pokemodr/models/MapWildListModel.cpp index 2403efe1..181d0ccd 100644 --- a/pokemodr/models/MapWildListModel.cpp +++ b/pokemodr/models/MapWildListModel.cpp @@ -88,24 +88,6 @@ bool MapWildListModel::setData(const QVariant& value, int role) return false; } -bool MapWildListModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MapWildListEncounterModel(this, static_cast<MapWildList*>(m_object)->newEncounter())); - return true; -} - -bool MapWildListModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<MapWildList*>(m_object)->deleteEncounter(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MapWildListModel::setupData() { MapWildList* wildList = static_cast<MapWildList*>(m_object); diff --git a/pokemodr/models/MapWildListModel.h b/pokemodr/models/MapWildListModel.h index d3dc6617..f6f059f3 100644 --- a/pokemodr/models/MapWildListModel.h +++ b/pokemodr/models/MapWildListModel.h @@ -23,7 +23,6 @@ // Forward declarations class MapWildList; -class MapWildListEncounterModel; class MapWildListModel : public GroupObjectModel { @@ -34,10 +33,6 @@ class MapWildListModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/MoveGroupModel.cpp b/pokemodr/models/MoveGroupModel.cpp index cb98f9a9..ff51cbf8 100644 --- a/pokemodr/models/MoveGroupModel.cpp +++ b/pokemodr/models/MoveGroupModel.cpp @@ -34,24 +34,6 @@ MoveGroupModel::~MoveGroupModel() { } -bool MoveGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MoveModel(this, static_cast<Pokemod*>(m_object)->newMove())); - return true; -} - -bool MoveGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteMove(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void MoveGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/MoveGroupModel.h b/pokemodr/models/MoveGroupModel.h index baecd50a..72ca104b 100644 --- a/pokemodr/models/MoveGroupModel.h +++ b/pokemodr/models/MoveGroupModel.h @@ -29,10 +29,6 @@ class MoveGroupModel : public GroupModel public: MoveGroupModel(BaseModel* parent, Pokemod* pokemod); ~MoveGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/NatureGroupModel.cpp b/pokemodr/models/NatureGroupModel.cpp index 8b308878..d2160e0b 100644 --- a/pokemodr/models/NatureGroupModel.cpp +++ b/pokemodr/models/NatureGroupModel.cpp @@ -34,24 +34,6 @@ NatureGroupModel::~NatureGroupModel() { } -bool NatureGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new NatureModel(this, static_cast<Pokemod*>(m_object)->newNature())); - return true; -} - -bool NatureGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteNature(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void NatureGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/NatureGroupModel.h b/pokemodr/models/NatureGroupModel.h index 872b860e..4601bc56 100644 --- a/pokemodr/models/NatureGroupModel.h +++ b/pokemodr/models/NatureGroupModel.h @@ -29,10 +29,6 @@ class NatureGroupModel : public GroupModel public: NatureGroupModel(BaseModel* parent, Pokemod* pokemod); ~NatureGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/ObjectModel.cpp b/pokemodr/models/ObjectModel.cpp index 82a6e674..ee5556b8 100644 --- a/pokemodr/models/ObjectModel.cpp +++ b/pokemodr/models/ObjectModel.cpp @@ -41,23 +41,3 @@ BaseModel* ObjectModel::childItem(const int /*row*/) { return NULL; } - -bool ObjectModel::canInsertRows() const -{ - return false; -} - -bool ObjectModel::insertRows(const int /*rows*/) -{ - return false; -} - -bool ObjectModel::canRemoveRows() const -{ - return false; -} - -bool ObjectModel::removeRows(const int /*position*/, const int /*rows*/) -{ - return false; -} diff --git a/pokemodr/models/ObjectModel.h b/pokemodr/models/ObjectModel.h index 743c5d2e..e8477c4f 100644 --- a/pokemodr/models/ObjectModel.h +++ b/pokemodr/models/ObjectModel.h @@ -33,12 +33,6 @@ class ObjectModel : public BaseObjectModel virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0; BaseModel* childItem(const int /*row*/); - - bool canInsertRows() const; - bool insertRows(const int /*rows*/); - - bool canRemoveRows() const; - bool removeRows(const int /*position*/, const int /*rows*/); }; #endif diff --git a/pokemodr/models/PokemodModel.cpp b/pokemodr/models/PokemodModel.cpp index 01c9cf5a..6daa6c6b 100644 --- a/pokemodr/models/PokemodModel.cpp +++ b/pokemodr/models/PokemodModel.cpp @@ -101,16 +101,6 @@ bool PokemodModel::setData(const QVariant& value, int role) return false; } -bool PokemodModel::insertRows(const int /*rows*/) -{ - return false; -} - -bool PokemodModel::removeRows(const int /*position*/, const int /*rows*/) -{ - return false; -} - void PokemodModel::setupData() { m_objects.append(new RulesModel(this, static_cast<Pokemod*>(m_object)->rules())); diff --git a/pokemodr/models/PokemodModel.h b/pokemodr/models/PokemodModel.h index 3760b4f3..8592e556 100644 --- a/pokemodr/models/PokemodModel.h +++ b/pokemodr/models/PokemodModel.h @@ -33,10 +33,6 @@ class PokemodModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int /*rows*/); - - bool removeRows(const int /*position*/, const int /*rows*/); protected: void setupData(); }; diff --git a/pokemodr/models/RootModel.cpp b/pokemodr/models/RootModel.cpp index 0dcd4f3a..1c0691f7 100644 --- a/pokemodr/models/RootModel.cpp +++ b/pokemodr/models/RootModel.cpp @@ -36,23 +36,6 @@ RootModel::~RootModel() { } -bool RootModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new PokemodModel(this, new Pokemod())); - return true; -} - -bool RootModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void RootModel::addPokemod(Pokemod* pokemod) { m_objects.append(new PokemodModel(this, pokemod)); diff --git a/pokemodr/models/RootModel.h b/pokemodr/models/RootModel.h index 9d788de5..f0a7599f 100644 --- a/pokemodr/models/RootModel.h +++ b/pokemodr/models/RootModel.h @@ -30,10 +30,6 @@ class RootModel : public GroupModel RootModel(); ~RootModel(); - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); - void addPokemod(Pokemod* pokemod); void deletePokemod(const Pokemod* pokemod); protected: diff --git a/pokemodr/models/SoundGroupModel.cpp b/pokemodr/models/SoundGroupModel.cpp index 6cafc742..226e2a95 100644 --- a/pokemodr/models/SoundGroupModel.cpp +++ b/pokemodr/models/SoundGroupModel.cpp @@ -34,24 +34,6 @@ SoundGroupModel::~SoundGroupModel() { } -bool SoundGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new SoundModel(this, static_cast<Pokemod*>(m_object)->newSound())); - return true; -} - -bool SoundGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteSound(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void SoundGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/SoundGroupModel.h b/pokemodr/models/SoundGroupModel.h index 0b97c31a..000cb50d 100644 --- a/pokemodr/models/SoundGroupModel.h +++ b/pokemodr/models/SoundGroupModel.h @@ -29,10 +29,6 @@ class SoundGroupModel : public GroupModel public: SoundGroupModel(BaseModel* parent, Pokemod* pokemod); ~SoundGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/SpeciesAbilityGroupModel.cpp b/pokemodr/models/SpeciesAbilityGroupModel.cpp index d6341c52..043ca754 100644 --- a/pokemodr/models/SpeciesAbilityGroupModel.cpp +++ b/pokemodr/models/SpeciesAbilityGroupModel.cpp @@ -34,24 +34,6 @@ SpeciesAbilityGroupModel::~SpeciesAbilityGroupModel() { } -bool SpeciesAbilityGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new SpeciesAbilityModel(this, static_cast<Species*>(m_object)->newAbility())); - return true; -} - -bool SpeciesAbilityGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Species*>(m_object)->deleteAbility(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void SpeciesAbilityGroupModel::setupData() { Species* species = static_cast<Species*>(m_object); diff --git a/pokemodr/models/SpeciesAbilityGroupModel.h b/pokemodr/models/SpeciesAbilityGroupModel.h index cb3e699b..244e3e30 100644 --- a/pokemodr/models/SpeciesAbilityGroupModel.h +++ b/pokemodr/models/SpeciesAbilityGroupModel.h @@ -29,10 +29,6 @@ class SpeciesAbilityGroupModel : public GroupModel public: SpeciesAbilityGroupModel(BaseModel* parent, Species* species); ~SpeciesAbilityGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/SpeciesGroupModel.cpp b/pokemodr/models/SpeciesGroupModel.cpp index 56de02c0..5fd85bf7 100644 --- a/pokemodr/models/SpeciesGroupModel.cpp +++ b/pokemodr/models/SpeciesGroupModel.cpp @@ -34,24 +34,6 @@ SpeciesGroupModel::~SpeciesGroupModel() { } -bool SpeciesGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new SpeciesModel(this, static_cast<Pokemod*>(m_object)->newSpecies())); - return true; -} - -bool SpeciesGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteSpecies(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void SpeciesGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/SpeciesGroupModel.h b/pokemodr/models/SpeciesGroupModel.h index c2e6e01b..ddd7ccdb 100644 --- a/pokemodr/models/SpeciesGroupModel.h +++ b/pokemodr/models/SpeciesGroupModel.h @@ -29,10 +29,6 @@ class SpeciesGroupModel : public GroupModel public: SpeciesGroupModel(BaseModel* parent, Pokemod* pokemod); ~SpeciesGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/SpeciesItemGroupModel.cpp b/pokemodr/models/SpeciesItemGroupModel.cpp index c6e39da9..dc95f4d5 100644 --- a/pokemodr/models/SpeciesItemGroupModel.cpp +++ b/pokemodr/models/SpeciesItemGroupModel.cpp @@ -34,24 +34,6 @@ SpeciesItemGroupModel::~SpeciesItemGroupModel() { } -bool SpeciesItemGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new SpeciesItemModel(this, static_cast<Species*>(m_object)->newItem())); - return true; -} - -bool SpeciesItemGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Species*>(m_object)->deleteItem(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void SpeciesItemGroupModel::setupData() { Species* species = static_cast<Species*>(m_object); diff --git a/pokemodr/models/SpeciesItemGroupModel.h b/pokemodr/models/SpeciesItemGroupModel.h index 70018bc9..0c3257b4 100644 --- a/pokemodr/models/SpeciesItemGroupModel.h +++ b/pokemodr/models/SpeciesItemGroupModel.h @@ -29,10 +29,6 @@ class SpeciesItemGroupModel : public GroupModel public: SpeciesItemGroupModel(BaseModel* parent, Species* species); ~SpeciesItemGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/SpeciesModel.cpp b/pokemodr/models/SpeciesModel.cpp index 4bacbeff..c9093218 100644 --- a/pokemodr/models/SpeciesModel.cpp +++ b/pokemodr/models/SpeciesModel.cpp @@ -86,16 +86,6 @@ bool SpeciesModel::setData(const QVariant& value, int role) return false; } -bool SpeciesModel::insertRows(const int /*rows*/) -{ - return false; -} - -bool SpeciesModel::removeRows(const int /*position*/, const int /*rows*/) -{ - return false; -} - void SpeciesModel::setupData() { m_objects.append(new SpeciesAbilityGroupModel(this, static_cast<Species*>(m_object))); diff --git a/pokemodr/models/SpeciesModel.h b/pokemodr/models/SpeciesModel.h index df904cd0..dc58e581 100644 --- a/pokemodr/models/SpeciesModel.h +++ b/pokemodr/models/SpeciesModel.h @@ -33,10 +33,6 @@ class SpeciesModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int /*rows*/); - - bool removeRows(const int /*position*/, const int /*rows*/); protected: void setupData(); }; diff --git a/pokemodr/models/SpeciesMoveGroupModel.cpp b/pokemodr/models/SpeciesMoveGroupModel.cpp index 8c2c9482..bfb6f040 100644 --- a/pokemodr/models/SpeciesMoveGroupModel.cpp +++ b/pokemodr/models/SpeciesMoveGroupModel.cpp @@ -34,24 +34,6 @@ SpeciesMoveGroupModel::~SpeciesMoveGroupModel() { } -bool SpeciesMoveGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new SpeciesMoveModel(this, static_cast<Species*>(m_object)->newMove())); - return true; -} - -bool SpeciesMoveGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Species*>(m_object)->deleteMove(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void SpeciesMoveGroupModel::setupData() { Species* species = static_cast<Species*>(m_object); diff --git a/pokemodr/models/SpeciesMoveGroupModel.h b/pokemodr/models/SpeciesMoveGroupModel.h index 2b303d30..30b80d81 100644 --- a/pokemodr/models/SpeciesMoveGroupModel.h +++ b/pokemodr/models/SpeciesMoveGroupModel.h @@ -29,10 +29,6 @@ class SpeciesMoveGroupModel : public GroupModel public: SpeciesMoveGroupModel(BaseModel* parent, Species* species); ~SpeciesMoveGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/StoreGroupModel.cpp b/pokemodr/models/StoreGroupModel.cpp index 69d73d57..4d94c726 100644 --- a/pokemodr/models/StoreGroupModel.cpp +++ b/pokemodr/models/StoreGroupModel.cpp @@ -34,24 +34,6 @@ StoreGroupModel::~StoreGroupModel() { } -bool StoreGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new StoreModel(this, static_cast<Pokemod*>(m_object)->newStore())); - return true; -} - -bool StoreGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteStore(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void StoreGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/StoreGroupModel.h b/pokemodr/models/StoreGroupModel.h index 1eb16e21..7c3230cd 100644 --- a/pokemodr/models/StoreGroupModel.h +++ b/pokemodr/models/StoreGroupModel.h @@ -29,10 +29,6 @@ class StoreGroupModel : public GroupModel public: StoreGroupModel(BaseModel* parent, Pokemod* pokemod); ~StoreGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/TileGroupModel.cpp b/pokemodr/models/TileGroupModel.cpp index 4e0fc89b..f41ed080 100644 --- a/pokemodr/models/TileGroupModel.cpp +++ b/pokemodr/models/TileGroupModel.cpp @@ -34,24 +34,6 @@ TileGroupModel::~TileGroupModel() { } -bool TileGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new TileModel(this, static_cast<Pokemod*>(m_object)->newTile())); - return true; -} - -bool TileGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteTile(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void TileGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/TileGroupModel.h b/pokemodr/models/TileGroupModel.h index cbd88ddb..c19820c0 100644 --- a/pokemodr/models/TileGroupModel.h +++ b/pokemodr/models/TileGroupModel.h @@ -29,10 +29,6 @@ class TileGroupModel : public GroupModel public: TileGroupModel(BaseModel* parent, Pokemod* pokemod); ~TileGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/TimeGroupModel.cpp b/pokemodr/models/TimeGroupModel.cpp index 358d4abe..1645b1c8 100644 --- a/pokemodr/models/TimeGroupModel.cpp +++ b/pokemodr/models/TimeGroupModel.cpp @@ -34,24 +34,6 @@ TimeGroupModel::~TimeGroupModel() { } -bool TimeGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new TimeModel(this, static_cast<Pokemod*>(m_object)->newTime())); - return true; -} - -bool TimeGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteTime(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void TimeGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/TimeGroupModel.h b/pokemodr/models/TimeGroupModel.h index deb5fa2e..4323dfe5 100644 --- a/pokemodr/models/TimeGroupModel.h +++ b/pokemodr/models/TimeGroupModel.h @@ -29,10 +29,6 @@ class TimeGroupModel : public GroupModel public: TimeGroupModel(BaseModel* parent, Pokemod* pokemod); ~TimeGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/TrainerGroupModel.cpp b/pokemodr/models/TrainerGroupModel.cpp index 5749442b..60b4332a 100644 --- a/pokemodr/models/TrainerGroupModel.cpp +++ b/pokemodr/models/TrainerGroupModel.cpp @@ -35,24 +35,6 @@ TrainerGroupModel::~TrainerGroupModel() setupData(); } -bool TrainerGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new TrainerModel(this, static_cast<Pokemod*>(m_object)->newTrainer())); - return true; -} - -bool TrainerGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteTrainer(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void TrainerGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/TrainerGroupModel.h b/pokemodr/models/TrainerGroupModel.h index 0a777310..313d3152 100644 --- a/pokemodr/models/TrainerGroupModel.h +++ b/pokemodr/models/TrainerGroupModel.h @@ -29,10 +29,6 @@ class TrainerGroupModel : public GroupModel public: TrainerGroupModel(BaseModel* parent, Pokemod* pokemod); ~TrainerGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/models/TypeGroupModel.cpp b/pokemodr/models/TypeGroupModel.cpp index 513d86e7..45deb3a0 100644 --- a/pokemodr/models/TypeGroupModel.cpp +++ b/pokemodr/models/TypeGroupModel.cpp @@ -34,24 +34,6 @@ TypeGroupModel::~TypeGroupModel() { } -bool TypeGroupModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new TypeModel(this, static_cast<Pokemod*>(m_object)->newType())); - return true; -} - -bool TypeGroupModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Pokemod*>(m_object)->deleteType(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - void TypeGroupModel::setupData() { Pokemod* pokemod = static_cast<Pokemod*>(m_object); diff --git a/pokemodr/models/TypeGroupModel.h b/pokemodr/models/TypeGroupModel.h index 4f87c718..257a5ba8 100644 --- a/pokemodr/models/TypeGroupModel.h +++ b/pokemodr/models/TypeGroupModel.h @@ -29,10 +29,6 @@ class TypeGroupModel : public GroupModel public: TypeGroupModel(BaseModel* parent, Pokemod* pokemod); ~TypeGroupModel(); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); protected: void setupData(); }; diff --git a/pokemodr/pokemodr.tex b/pokemodr/pokemodr.tex index beebee15..a429ead6 100644 --- a/pokemodr/pokemodr.tex +++ b/pokemodr/pokemodr.tex @@ -1,127 +1,140 @@ -\documentclass[10pt]{article} - -\title{Pok\'eModr v0.0.1} -\author{Ben Boeckel} - -\usepackage{hyperref} -\hypersetup{colorlinks=true,linkcolor=black} -\usepackage[hmargin=1in,vmargin=1in]{geometry} +\documentclass[12pt,notitlepage]{report} + +\newcommand{\version}{0.0.1} + +\title{Pok\'eModr v\version} +\author{Ben Boeckel $<$\texttt{\href{mailto:mathStuf@gmail.com}% + {MathStuf@gmail.com}}$>$} + +\usepackage[unicode]{hyperref} +\hypersetup{% + colorlinks=true,% + citecolor=red,% + urlcolor=red,% + filecolor=red,% + linkcolor=red,% + pdfauthor={Ben Boeckel},% + pdftitle={Pok\'eModr Documentation},% +} \usepackage{listings} \usepackage{color} -\usepackage{textcomp} \usepackage{setspace} \usepackage{multicol} +\usepackage{fontenc} +\usepackage{textcomp} +\usepackage[debugshow]{xtab} -% Set up counting for listings -\newcounter{listing}[section] -\renewcommand{\thelisting}{Listing \arabic{section}.\arabic{listing}} - -\lstset{title=\thelisting} - -% This gives syntax highlighting in the python environment +% This gives syntax highlighting in the python/ruby/kjs environments % Adapted from http://ubuntuforums.org/archive/index.php/t-331602.html \renewcommand{\lstlistlistingname}{Code Listings} \renewcommand{\lstlistingname}{Code Listing} \definecolor{gray}{gray}{0.5} \definecolor{green}{rgb}{0,0.5,0} -\lstset{ - basicstyle=\ttfamily\small\setstretch{1}, - stringstyle=\color{red}, - showstringspaces=false, - alsoletter={1234567890}, - otherkeywords={\ , \}, \{}, - keywordstyle=\color{blue}, - emphstyle=\color{black}\bfseries, - emphstyle=[2]\color{green}, - emphstyle=[3]\color{blue}, - upquote=true, - commentstyle=\color{gray}\slshape, - emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, - emphstyle=[4]\color{blue}, - literate=*{:}{{\textcolor{blue}:}}{1} - {=}{{\textcolor{blue}=}}{1} - {-}{{\textcolor{blue}-}}{1} - {+}{{\textcolor{blue}+}}{1} - {*}{{\textcolor{blue}*}}{1} - {!}{{\textcolor{blue}!}}{1} - {(}{{\textcolor{blue}(}}{1} - {)}{{\textcolor{blue})}}{1} - {[}{{\textcolor{blue}[}}{1} - {]}{{\textcolor{blue}]}}{1} - {<}{{\textcolor{blue}<}}{1} - {>}{{\textcolor{blue}>}}{1}, - framexleftmargin=1mm, - framextopmargin=1mm, - frame=shadowbox, - rulesepcolor=\color{blue}, +\lstset{% + basicstyle=\ttfamily\small\setstretch{1},% + stringstyle=\color{red},% + showstringspaces=false,% + alsoletter={1234567890},% + otherkeywords={\ , \}, \{},% + keywordstyle=\color{blue},% + emphstyle=\color{black}\bfseries,% + emphstyle=[2]\color{green},% + emphstyle=[3]\color{blue},% + upquote=true,% + commentstyle=\color{gray}\slshape,% + emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0},% + emphstyle=[4]\color{blue},% + literate=*{:}{{\textcolor{blue}:}}{1}% + {=}{{\textcolor{blue}=}}{1}% + {-}{{\textcolor{blue}-}}{1}% + {+}{{\textcolor{blue}+}}{1}% + {*}{{\textcolor{blue}*}}{1}% + {!}{{\textcolor{blue}!}}{1}% + {(}{{\textcolor{blue}(}}{1}% + {)}{{\textcolor{blue})}}{1}% + {[}{{\textcolor{blue}[}}{1}% + {]}{{\textcolor{blue}]}}{1}% + {<}{{\textcolor{blue}<}}{1}% + {>}{{\textcolor{blue}>}}{1},% + framexleftmargin=1mm,% + framextopmargin=1mm,% + frame=shadowbox,% + rulesepcolor=\color{blue}% } -\lstnewenvironment{python}[1][]{ -\lstset{ - language=python, - emph={access, and, break, class, continue, def, del, elif, else, - except, exec, finally, for, from, global, if, import, in, is, - lambda, not, or, pass, print, raise, return, try, while}, - emph={[2]True, False, None, self}, - emph={[3]from, import, as}, - morecomment=[s]{"""}{"""}, - #1 +\lstnewenvironment{python}[1][]{% +\lstset{% + language=python,% + emph={access,and,break,class,continue,def,del,elif,else,except,% + exec,finally,for,from,global,if,import,in,is,lambda,not,or,% + pass,print,raise,return,try,while},% + emph={[2]True, False, None, self},% + emph={[3]from, import, as},% + morecomment=[s]{"""}{"""},% + #1% }}{} -\lstnewenvironment{ruby}[1][]{ -\lstset{ - language=ruby, - emph={alias, and, begin, break, case, class, def, defined, - do, else, elsif, end, ensure, for, if, in, module, next, - not, or, redo, rescue, retry, return, super, then, undef, - unless, until, when, while, yield}, - emph={[2]true, false, nil, self}, - emph={[3]require, include}, - #1 +\lstnewenvironment{ruby}[1][]{% +\lstset{% + language=ruby,% + emph={alias,and,begin,break,case,class,def,defined,do,else,% + elsif,end,ensure,for,if,in,module,next,not,or,redo,rescue,% + retry,return,super,then,undef,unless,until,when,while,yield},% + emph={[2]true, false, nil, self},% + emph={[3]require, include},% + #1% }}{} -\lstnewenvironment{kjs}[1][]{ -\lstset{ -% language=kjs, - emph={abstract, break, byte, case, catch, class, const, continue, - debugger, default, delete, do, else, enum, export, extends, - final, finally, for, function, goto, if, implements, in, - instanceof, interface, native, new, package, private, protected, - public, return, static, super, switch, synchronized, throw, - throws, transient, try, typeof, volatile, while, with}, - emph={[2]true, false, null, this}, - emph={[3]import}, - #1 +\lstnewenvironment{kjs}[1][]{% +\lstset{% +% language=kjs,% + emph={abstract,break,case,catch,class,const,continue,debugger,% + default,delete,do,else,enum,export,extends,final,finally,for,% + function,goto,if,implements,in,instanceof,interface,native,% + new,package,private,protected,public,return,static,super,% + switch,synchronized,throw,throws,transient,try,typeof,% + volatile,while,with},% + emph={[2]true, false, null, this},% + emph={[3]import},% + #1% }}{} \begin{document} + \maketitle \tableofcontents \newpage +\chapter{Pok\'emod Classes} +\label{pokemod-classes} + \section{Ability} -\addtocounter{listing}{1} +\label{ability} -Abilities add an extra dimension to the battle system. Abilities can help turn the tide in a battle and balance species that are typically under-powered. Abilities were introduced to the original games in the third generation of the games. +Abilities add an extra dimension to the battle system. Abilities can help turn the tide in a battle and balance species that are typically under-powered. Abilities were introduced to the original games in the third generation of the games. -Abilities are responsible for keeping track of any information they change during their execution and restoring it if necessary. Changing anything that is not local to the battle will persist after the battle is over (this allows status afflictions and moves that are permanently overwritten to persist). Take note that anything that is species-wide will not persist no matter what happens during the battle (i.e. types, base stats, effort values) since these are copied for the battle so that they can be modified for strategic purposes. +Abilities are responsible for keeping track of any information they change during their execution and restoring it if necessary. Changing anything that is not local to the battle will persist after the battle is over (this allows status afflictions and moves that are permanently overwritten to persist). Take note that anything that is species-wide will not persist no matter what happens during the battle (i.e. types, base stats, effort values) since these are copied for the battle so that they can be modified for strategic purposes. The APIs for the battle system will be under development in the near future with the beta release of Pok\'eModr. \subsection{Variables} +\label{ability-variables} \paragraph{Name} -This is the name of the ability. This is how the player will see the ability in the game. +\label{ability-name} +The name of the ability. This is how the player will see the ability in the game. \paragraph{Description} -This should be a succinct description of what the ability does. +\label{ability-description} +A succinct description of what the ability does. \paragraph{Script} -This script contains functions that will be triggered by the game when appropriate. Only functions that are written will be called, so dummy functions are not needed for those the ability does not need. The following events can be used in an ability (these are in no way final, the battle system design will provide all of these): +\label{ability-script} +The script contains functions that will be triggered by the game when appropriate. Only functions that are written will be called, so dummy functions are not needed for those the ability does not need. The following events can be used in an ability (these are in no way final, the battle system design will provide all of these): -\begin{multicols}{3} +\begin{multicols}{2} \begin{itemize} \item \texttt{userSentOut} \item \texttt{userBeginTurn} @@ -154,37 +167,47 @@ This script contains functions that will be triggered by the game when appropria \end{itemize} \end{multicols} +See chapter \ref{scripting} on page \pageref{scripting} for more infomation on scripting. \subsection{Examples} +\label{ability-examples} \paragraph{Note} These examples are not guaranteed to work until an API has been made for the game and battle system. \subsubsection{Changing the weather} -This script will force the weather to be rainy all the time. Other weather effects can be in effect from the time it works until the beginning of the next turn where this ability will kick in and make it rain again. +This script will force the weather to be rainy all the time. Other weather effects can be in effect from the time it works until the beginning of the next turn where this ability will kick in and make it rain again. -\begin{python} +\begin{python}[caption={Weather changer},label=script:weather-changer] import Kross import Battle import Game -pokemod = Kross.action("pokemod") +# Access to all of the scripts Pok\'eGen provides +collections = Kross.actionCollection() +# Scripts to interface with in-game constants +pokemod = collections.collection("pokemod") +# A set of functions for dealing with weather +weather = pokemod.action("weather") needChanging = False +rain = weather.callFunction("value", ["Rain"]) def setWeather(): # Set the weather to rain for unlimited turns - Battle.weather = ( pokemod.callFunction( "weather", ["Rain"] ), -1 ) + Battle.weather.weather = rain + Battle.weather.duration = -1 # Let the player know that it has started raining - Game.message( "The skies have opened up!" ) + Game.message("The skies have opened up!") def userSentOut(user): setWeather() def weatherChanged(weather): - # Force the weather back next turn if it the weather change wasn't to rain - if not Battle.weather.weather == pokemod.callFunction( "weather", ["Rain"] ): + # Force the weather back next turn + # if it the weather change wasn't to rain + if not Battle.weather.weather == rain: needChanging = True def roundBegin(user, allies, enemies): @@ -194,19 +217,23 @@ def roundBegin(user, allies, enemies): needChanging = False def userSwitch(user): - # If the owner of the ability is no longer in the battle, set the rain to stop + # If the owner of the ability is + # no longer in the battle, set the rain to stop Battle.weather.duration = 2 - Game.message( "The rain clouds started to dissipate!" ) + Game.message("The sky is clearing!") def userFaint(user): - userSwitch(user) + # The ownder could have been knocked out by + # something other than rain + if Battle.wather.weather == rain: + userSwitch(user) \end{python} \subsubsection{Changing types} -This script will change the user's first type depending on the type of the last move used. +This script will change the user's first type depending on the type of the last move used. Since types do not persist outside of the battle, the type only needs to be reset when the owner of the ability switches out or faints. -\begin{python} +\begin{python}[caption={Type changer},label=script:type-changer] originalType = -1 newType = -1 @@ -215,10 +242,10 @@ def userAttacks(user, targets, move): newType = move.type def roundBegin(user, enemy): - if not newType == -1: - user.types[0] = newType - else: + if newType == -1: originalType = user.types[0] + else: + user.types[0] = newType def userSwitch(user): # Restore the type when the user switches @@ -226,63 +253,245 @@ def userSwitch(user): def userFaint(user): userSwitch(user) - -def battleEnd(user): - userSwitch(user) \end{python} -\newpage \section{Author} -\addtocounter{listing}{1} +\label{author} -This is where the authors of the Pok\'eMod go. This class could be expanded to allow for something more detialed to allow the creation of credits, but it is simple for now. +This is where the authors of the Pok\'eMod go. This class could be expanded to allow for something more detialed to allow the creation of credits, but it is simple for now. \subsection{Variables} +\label{author-variables} \paragraph{Name} -This is the name of the author. +\label{author-name} +The name of the author. \paragraph{Email} +\label{author-email} The email address of the author. \paragraph{Role} -This is what the person did. +\label{author-role} +What the person did. -\newpage \section{Badge} -\addtocounter{listing}{1} +\label{badge} -Badges are given to the player after accomplishing a task. In the original games, they were used to allow the player to use moves in the main world to gain access to new parts of the world. They also boosted the stats for in-game battles and allowed the player to train to higher levels without side effects. +Badges are given to the player after accomplishing a task. In the original games, they were used to allow the player to use moves in the main world to gain access to new parts of the world. They also boosted the stats for in-game battles and allowed the player to train to higher levels without side effects. \subsection{Variables} +\label{badge-variables} \paragraph{Name} -This is the name of the badge. This is the name that the player will see in-game. +\label{badge-name} +The name of the badge. This is the name that the player will see in-game. \paragraph{Face} -This is the image that will be used in the game for the badge before it is obtained. +\label{badge-face} +The image that will be used in the game for the badge before it is obtained. \paragraph{Badge} -This is an image of the badge and will show up in the player's information window. +\label{badge-badge} +The image of the badge and will show up in the player's information window. \paragraph{Obey} -This is the level that the player can train to without any side effects. +\label{badge-obey} +The level that the player can train to without any side effects. \paragraph{Stat} -The multiplier for each stat will be applied to in-game battles to give an extra edge to the player. +\label{badge-stat} +The multiplier for each stat will be applied to in-game battles to give an extra edge to the player. It will not have any effect on battles between two games. -\newpage \section{Coin List} -\addtocounter{listing}{1} +\label{coinlist} -Coin lists are used as alternate places to aquire items and team members in exchange for coins that are won at slot machines and card flip games. These are typically much harder to afford than items in an item shop, but they are also usually more valuable. +Coin lists are used as alternate places to aquire items and team members in exchange for coins that are won at slot machines and card flip games. These are typically much harder to afford than items in an item shop, but they are also usually more valuable. \subsection{Variables} +\label{coinlist-variables} \paragraph{Name} -This is the internal name of the coin list. The player will not be told what this is. +\label{coinlist-name} +This is the internal name of the coin list. The player will not be told what this is. + +\paragraph{Script} +\label{coinlist-script} +This script should interface with the user's items to determine the following: +\begin{itemize} + \item Check to see if the player has an item that can buy the objects on the list + \item If so: + \begin{itemize} + \item Set the \texttt{coinListMoney} object in \texttt{Game} to the amount of curreny that the player has for display + \item Provide a \texttt{buy} function that takes the object to buy in the list + \item It should handle giving the object to the player and erroring if anything happens + \end{itemize} + \item else: + \begin{itemize} + \item Set the \texttt{coinListMoney} object in \texttt{Game} to 0 + \item The game will take this as a signal that the player cannot buy things from this coin list and will not display it + \item Any messages necessary must be handled in the script + \end{itemize} +\end{itemize} + +\section{Coin List Object} +\label{coinlistobject} + +Coin list objects are either items or team members that can be bought from coin lists. + +\subsection{Variables} +\label{coinlistobject-variables} + +\paragraph{Type} +\label{coinlistobject-type} +Whether the value of the object points to a species for a team member or to an item. + +\paragraph{Value} +\label{coinlistobject-value} +The ID number of the item or species. + +\paragraph{Amount} +\label{coinlistobject-amount} +The number of the object that the player gets at a time. + +\paragraph{Cost} +\label{coinlistobject-cost} +How much the object costs. + +\section{Egg Group} +\label{egggroup} + +An egg group is a group of species that can breed to create eggs. More details can be found in chapter \ref{breeding} on page \pageref{breeding}. + +\subsection{Variables} +\label{egggroup-variables} + +\paragraph{Name} +\label{egggroup-name} +The name of the egg group. Used internally only. + +\section{Global Script} +\label{globalscript} + +Global scripts are functions that are available on demand in any other script. They can do anything that the scripting API allows with the game or any common function that is used a lot in order to save space. They are loaded when the game is loaded and in the \texttt{scripts} action collection. See more on scripting in chapter \ref{scripting} on page \pageref{scripting}. + +\subsection{Variables} +\label{globalscript-variables} + +\subsubsection{Name} +\label{globalscript-name} +The name of the action in the collection. + +\subsubsection{Script} +\label{globalscript-script} +The code of the script. + +\section{Item} +\label{item} + +Items are used in the game to heal, boost stats, and other similar things. They can be used during in-game battles and on the overworld maps. + +\subsection{Variables} +\label{item-variables} + +\subsubsection{Name} +The name of the item + +\section{Item Type} +\label{itemtype} + +Item types are used to group items into sections within the player's item storage. + +\subsection{Variables} +\label{itemtype-variables} + +\subsubsection{Name} +\label{itemtype-name} +The name of the item type. Used internally only. + +\subsubsection{Computer} +\label{itemtype-computer} +How many of the item the computer can store. + +\subsubsection{Player} +\label{itemtype-player} +How many of the item the player can carry at once. + +\subsubsection{Count} +\label{itemtype-count} +Determines how the items are counted and grouped in its storage. If they can be grouped, multiples of an item will count as one towards the limit of the storage, otherwise duplicates are counted individually. + +\section{Map} +\label{map} + +Maps are view of the overworld for the game. When not battling, the player travels around the maps in search of other battles and quests. + +\section{Map Effect} +\label{mapeffect} + + + +\section{Map Trainer} +\label{maptrainer} + +\section{Map Trainer Team Member} +\label{maptrainerteammember} + +\section{Map Warp} +\label{mapwarp} + +\section{Map Wild List} +\label{mapwildlist} + +\section{Map Wild List Encounter} +\label{mapwildlistencounter} + +\section{Move} +\label{move} + +\section{Nature} +\label{nature} + +\section{Sound} +\label{sound} + +\section{Species} +\label{species} + +\section{Species Ability} +\label{speciesability} + +\section{Species Item} +\label{speciesitem} + +\section{Species Move} +\label{speciesmove} + +\section{Store} +\label{store} + +\section{Tile} +\label{tile} + +\section{Time} +\label{time} + +\section{Trainer} +\label{trainer} + +\section{Type} +\label{type} + +\chapter{Scripting} +\label{scripting} + +\section{Collections} +\label{scripting-collections} + +\chapter{Battle System} +\label{battle-system} -\paragraph{Item} -This is the item that contians the ``money'' to buy things. The item should implement an \texttt{amount} function in its script. If one does not exist, the game will not show the list. When the player is not carrying any of this item, the function \texttt{noItem} is called in this script. It should let the player know that they do not have the required item and need to get it to be able to use this +\chapter{Breeding} +\label{breeding} \end{document} |
