summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-05-23 01:07:11 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-05-23 01:07:11 -0400
commitb81b2ae4d0c96b37e442b5c8d2a82d518c50cfff (patch)
tree4ead6e424bef729cfc1ec97f7f4d3b0496dc3643
parent2cc02d1c40fbc340951aa66a2dd1d53409952db3 (diff)
downloadsigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.tar.gz
sigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.tar.xz
sigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.zip
Delete old tree widget files
-rw-r--r--sigmodr/tree/AbilityGroupModel.cpp91
-rw-r--r--sigmodr/tree/AbilityGroupModel.h52
-rw-r--r--sigmodr/tree/AbilityModel.cpp69
-rw-r--r--sigmodr/tree/AbilityModel.h48
-rw-r--r--sigmodr/tree/AuthorGroupModel.cpp91
-rw-r--r--sigmodr/tree/AuthorGroupModel.h52
-rw-r--r--sigmodr/tree/AuthorModel.cpp69
-rw-r--r--sigmodr/tree/AuthorModel.h48
-rw-r--r--sigmodr/tree/BadgeGroupModel.cpp91
-rw-r--r--sigmodr/tree/BadgeGroupModel.h52
-rw-r--r--sigmodr/tree/BadgeModel.cpp69
-rw-r--r--sigmodr/tree/BadgeModel.h48
-rw-r--r--sigmodr/tree/BaseModel.cpp143
-rw-r--r--sigmodr/tree/BaseModel.h98
-rw-r--r--sigmodr/tree/BaseObjectModel.cpp65
-rw-r--r--sigmodr/tree/BaseObjectModel.h55
-rw-r--r--sigmodr/tree/CoinListGroupModel.cpp91
-rw-r--r--sigmodr/tree/CoinListGroupModel.h52
-rw-r--r--sigmodr/tree/CoinListItemModel.cpp88
-rw-r--r--sigmodr/tree/CoinListItemModel.h48
-rw-r--r--sigmodr/tree/CoinListModel.cpp137
-rw-r--r--sigmodr/tree/CoinListModel.h58
-rw-r--r--sigmodr/tree/EggGroupGroupModel.cpp91
-rw-r--r--sigmodr/tree/EggGroupGroupModel.h52
-rw-r--r--sigmodr/tree/EggGroupModel.cpp69
-rw-r--r--sigmodr/tree/EggGroupModel.h48
-rw-r--r--sigmodr/tree/GameModel.cpp167
-rw-r--r--sigmodr/tree/GameModel.h58
-rw-r--r--sigmodr/tree/GlobalScriptGroupModel.cpp91
-rw-r--r--sigmodr/tree/GlobalScriptGroupModel.h52
-rw-r--r--sigmodr/tree/GlobalScriptModel.cpp69
-rw-r--r--sigmodr/tree/GlobalScriptModel.h48
-rw-r--r--sigmodr/tree/GroupModel.cpp90
-rw-r--r--sigmodr/tree/GroupModel.h71
-rw-r--r--sigmodr/tree/GroupObjectModel.cpp69
-rw-r--r--sigmodr/tree/GroupObjectModel.h61
-rw-r--r--sigmodr/tree/Grouping.cpp44
-rw-r--r--sigmodr/tree/Grouping.h58
-rw-r--r--sigmodr/tree/ItemGroupModel.cpp91
-rw-r--r--sigmodr/tree/ItemGroupModel.h52
-rw-r--r--sigmodr/tree/ItemModel.cpp69
-rw-r--r--sigmodr/tree/ItemModel.h48
-rw-r--r--sigmodr/tree/ItemTypeGroupModel.cpp91
-rw-r--r--sigmodr/tree/ItemTypeGroupModel.h52
-rw-r--r--sigmodr/tree/ItemTypeModel.cpp69
-rw-r--r--sigmodr/tree/ItemTypeModel.h48
-rw-r--r--sigmodr/tree/MapEffectGroupModel.cpp91
-rw-r--r--sigmodr/tree/MapEffectGroupModel.h52
-rw-r--r--sigmodr/tree/MapEffectModel.cpp70
-rw-r--r--sigmodr/tree/MapEffectModel.h48
-rw-r--r--sigmodr/tree/MapGroupModel.cpp91
-rw-r--r--sigmodr/tree/MapGroupModel.h52
-rw-r--r--sigmodr/tree/MapModel.cpp131
-rw-r--r--sigmodr/tree/MapModel.h58
-rw-r--r--sigmodr/tree/MapTrainerGroupModel.cpp91
-rw-r--r--sigmodr/tree/MapTrainerGroupModel.h52
-rw-r--r--sigmodr/tree/MapTrainerModel.cpp138
-rw-r--r--sigmodr/tree/MapTrainerModel.h58
-rw-r--r--sigmodr/tree/MapTrainerTeamMemberModel.cpp77
-rw-r--r--sigmodr/tree/MapTrainerTeamMemberModel.h48
-rw-r--r--sigmodr/tree/MapWarpGroupModel.cpp91
-rw-r--r--sigmodr/tree/MapWarpGroupModel.h52
-rw-r--r--sigmodr/tree/MapWarpModel.cpp70
-rw-r--r--sigmodr/tree/MapWarpModel.h48
-rw-r--r--sigmodr/tree/MapWildListEncounterModel.cpp77
-rw-r--r--sigmodr/tree/MapWildListEncounterModel.h48
-rw-r--r--sigmodr/tree/MapWildListGroupModel.cpp91
-rw-r--r--sigmodr/tree/MapWildListGroupModel.h52
-rw-r--r--sigmodr/tree/MapWildListModel.cpp140
-rw-r--r--sigmodr/tree/MapWildListModel.h58
-rw-r--r--sigmodr/tree/MoveGroupModel.cpp91
-rw-r--r--sigmodr/tree/MoveGroupModel.h52
-rw-r--r--sigmodr/tree/MoveModel.cpp69
-rw-r--r--sigmodr/tree/MoveModel.h48
-rw-r--r--sigmodr/tree/NatureGroupModel.cpp91
-rw-r--r--sigmodr/tree/NatureGroupModel.h52
-rw-r--r--sigmodr/tree/NatureModel.cpp70
-rw-r--r--sigmodr/tree/NatureModel.h48
-rw-r--r--sigmodr/tree/ObjectModel.cpp76
-rw-r--r--sigmodr/tree/ObjectModel.h50
-rw-r--r--sigmodr/tree/RootModel.cpp73
-rw-r--r--sigmodr/tree/RootModel.h56
-rw-r--r--sigmodr/tree/RulesModel.cpp64
-rw-r--r--sigmodr/tree/RulesModel.h48
-rw-r--r--sigmodr/tree/SigmodrTree.cpp175
-rw-r--r--sigmodr/tree/SigmodrTree.h91
-rw-r--r--sigmodr/tree/SigmodrTreeModel.cpp212
-rw-r--r--sigmodr/tree/SigmodrTreeModel.h74
-rw-r--r--sigmodr/tree/SkinGroupModel.cpp91
-rw-r--r--sigmodr/tree/SkinGroupModel.h52
-rw-r--r--sigmodr/tree/SkinModel.cpp69
-rw-r--r--sigmodr/tree/SkinModel.h48
-rw-r--r--sigmodr/tree/SoundGroupModel.cpp91
-rw-r--r--sigmodr/tree/SoundGroupModel.h52
-rw-r--r--sigmodr/tree/SoundModel.cpp70
-rw-r--r--sigmodr/tree/SoundModel.h48
-rw-r--r--sigmodr/tree/SpeciesGroupModel.cpp91
-rw-r--r--sigmodr/tree/SpeciesGroupModel.h52
-rw-r--r--sigmodr/tree/SpeciesModel.cpp138
-rw-r--r--sigmodr/tree/SpeciesModel.h58
-rw-r--r--sigmodr/tree/SpeciesMoveModel.cpp77
-rw-r--r--sigmodr/tree/SpeciesMoveModel.h48
-rw-r--r--sigmodr/tree/SpriteGroupModel.cpp91
-rw-r--r--sigmodr/tree/SpriteGroupModel.h52
-rw-r--r--sigmodr/tree/SpriteModel.cpp69
-rw-r--r--sigmodr/tree/SpriteModel.h48
-rw-r--r--sigmodr/tree/StatusGroupModel.cpp91
-rw-r--r--sigmodr/tree/StatusGroupModel.h52
-rw-r--r--sigmodr/tree/StatusModel.cpp69
-rw-r--r--sigmodr/tree/StatusModel.h48
-rw-r--r--sigmodr/tree/StoreGroupModel.cpp91
-rw-r--r--sigmodr/tree/StoreGroupModel.h52
-rw-r--r--sigmodr/tree/StoreModel.cpp70
-rw-r--r--sigmodr/tree/StoreModel.h48
-rw-r--r--sigmodr/tree/TileGroupModel.cpp91
-rw-r--r--sigmodr/tree/TileGroupModel.h52
-rw-r--r--sigmodr/tree/TileModel.cpp70
-rw-r--r--sigmodr/tree/TileModel.h48
-rw-r--r--sigmodr/tree/TimeGroupModel.cpp91
-rw-r--r--sigmodr/tree/TimeGroupModel.h52
-rw-r--r--sigmodr/tree/TimeModel.cpp70
-rw-r--r--sigmodr/tree/TimeModel.h48
-rw-r--r--sigmodr/tree/TrainerGroupModel.cpp91
-rw-r--r--sigmodr/tree/TrainerGroupModel.h52
-rw-r--r--sigmodr/tree/TrainerModel.cpp70
-rw-r--r--sigmodr/tree/TrainerModel.h48
-rw-r--r--sigmodr/tree/TypeGroupModel.cpp91
-rw-r--r--sigmodr/tree/TypeGroupModel.h52
-rw-r--r--sigmodr/tree/TypeModel.cpp70
-rw-r--r--sigmodr/tree/TypeModel.h48
-rw-r--r--sigmodr/tree/WeatherGroupModel.cpp91
-rw-r--r--sigmodr/tree/WeatherGroupModel.h52
-rw-r--r--sigmodr/tree/WeatherModel.cpp69
-rw-r--r--sigmodr/tree/WeatherModel.h48
134 files changed, 0 insertions, 9567 deletions
diff --git a/sigmodr/tree/AbilityGroupModel.cpp b/sigmodr/tree/AbilityGroupModel.cpp
deleted file mode 100644
index fc3690e1..00000000
--- a/sigmodr/tree/AbilityGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "AbilityGroupModel.h"
-
-// Sigmodr tree includes
-#include "AbilityModel.h"
-
-// Sigmod includes
-#include <sigmod/Ability.h>
-#include <sigmod/Game.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-AbilityGroupModel::AbilityGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Abilities")
-{
- for (int i = 0; i < game->abilityCount(); ++i)
- addObject(game->ability(i));
-}
-
-QVariant AbilityGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Ability", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool AbilityGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Ability"))
- {
- addObject(qobject_cast<Game*>(m_object)->newAbility(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString AbilityGroupModel::types() const
-{
- return "Ability";
-}
-
-void AbilityGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newAbility();
- if (object->className() == "Ability")
- addChild(new AbilityModel(this, qobject_cast<Ability*>(object)));
-}
-
-void AbilityGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteAbility(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/AbilityGroupModel.h b/sigmodr/tree/AbilityGroupModel.h
deleted file mode 100644
index 51ddcb56..00000000
--- a/sigmodr/tree/AbilityGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ABILITYGROUPMODEL
-#define SIGMODRTREE_ABILITYGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT AbilityGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- AbilityGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/AbilityModel.cpp b/sigmodr/tree/AbilityModel.cpp
deleted file mode 100644
index ff5aeafb..00000000
--- a/sigmodr/tree/AbilityModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "AbilityModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/AbilityUI.h>
-
-// Sigmod includes
-#include <sigmod/Ability.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-AbilityModel::AbilityModel(BaseModel* parent, Ability* ability) :
- ObjectModel(parent, ability)
-{
-}
-
-QVariant AbilityModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Ability*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new AbilityUI(qobject_cast<Ability*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Ability", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void AbilityModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/AbilityModel.h b/sigmodr/tree/AbilityModel.h
deleted file mode 100644
index d85e9df8..00000000
--- a/sigmodr/tree/AbilityModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ABILITYMODEL
-#define SIGMODRTREE_ABILITYMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Ability;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT AbilityModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- AbilityModel(BaseModel* parent, Sigmod::Ability* ability);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/AuthorGroupModel.cpp b/sigmodr/tree/AuthorGroupModel.cpp
deleted file mode 100644
index c17b3551..00000000
--- a/sigmodr/tree/AuthorGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "AuthorGroupModel.h"
-
-// Sigmodr tree includes
-#include "AuthorModel.h"
-
-// Sigmod includes
-#include <sigmod/Author.h>
-#include <sigmod/Game.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-AuthorGroupModel::AuthorGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Authors")
-{
- for (int i = 0; i < game->authorCount(); ++i)
- addObject(game->author(i));
-}
-
-QVariant AuthorGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Author", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool AuthorGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Author"))
- {
- addObject(qobject_cast<Game*>(m_object)->newAuthor(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString AuthorGroupModel::types() const
-{
- return "Author";
-}
-
-void AuthorGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newAuthor();
- if (object->className() == "Author")
- addChild(new AuthorModel(this, qobject_cast<Author*>(object)));
-}
-
-void AuthorGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteAuthor(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/AuthorGroupModel.h b/sigmodr/tree/AuthorGroupModel.h
deleted file mode 100644
index 85132c20..00000000
--- a/sigmodr/tree/AuthorGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_AUTHORGROUPMODEL
-#define SIGMODRTREE_AUTHORGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT AuthorGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- AuthorGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/AuthorModel.cpp b/sigmodr/tree/AuthorModel.cpp
deleted file mode 100644
index 5d379649..00000000
--- a/sigmodr/tree/AuthorModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "AuthorModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/AuthorUI.h>
-
-// Sigmod includes
-#include <sigmod/Author.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-AuthorModel::AuthorModel(BaseModel* parent, Author* author) :
- ObjectModel(parent, author)
-{
-}
-
-QVariant AuthorModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Author*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new AuthorUI(qobject_cast<Author*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Author", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void AuthorModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/AuthorModel.h b/sigmodr/tree/AuthorModel.h
deleted file mode 100644
index d2ee3483..00000000
--- a/sigmodr/tree/AuthorModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_AUTHORMODEL
-#define SIGMODRTREE_AUTHORMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Author;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT AuthorModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- AuthorModel(BaseModel* parent, Sigmod::Author* author);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/BadgeGroupModel.cpp b/sigmodr/tree/BadgeGroupModel.cpp
deleted file mode 100644
index c8cfda02..00000000
--- a/sigmodr/tree/BadgeGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "BadgeGroupModel.h"
-
-// Sigmodr tree includes
-#include "BadgeModel.h"
-
-// Sigmod includes
-#include <sigmod/Badge.h>
-#include <sigmod/Game.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-BadgeGroupModel::BadgeGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Badges")
-{
- for (int i = 0; i < game->badgeCount(); ++i)
- addObject(game->badge(i));
-}
-
-QVariant BadgeGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Badge", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool BadgeGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Badge"))
- {
- addObject(qobject_cast<Game*>(m_object)->newBadge(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString BadgeGroupModel::types() const
-{
- return "Badge";
-}
-
-void BadgeGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newBadge();
- if (object->className() == "Badge")
- addChild(new BadgeModel(this, qobject_cast<Badge*>(object)));
-}
-
-void BadgeGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteBadge(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/BadgeGroupModel.h b/sigmodr/tree/BadgeGroupModel.h
deleted file mode 100644
index 0a17b7ee..00000000
--- a/sigmodr/tree/BadgeGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_BADGEGROUPMODEL
-#define SIGMODRTREE_BADGEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT BadgeGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- BadgeGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/BadgeModel.cpp b/sigmodr/tree/BadgeModel.cpp
deleted file mode 100644
index 7b4c6bf5..00000000
--- a/sigmodr/tree/BadgeModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "BadgeModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/BadgeUI.h>
-
-// Sigmod includes
-#include <sigmod/Badge.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-BadgeModel::BadgeModel(BaseModel* parent, Badge* badge) :
- ObjectModel(parent, badge)
-{
-}
-
-QVariant BadgeModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Badge*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new BadgeUI(qobject_cast<Badge*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Badge", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void BadgeModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/BadgeModel.h b/sigmodr/tree/BadgeModel.h
deleted file mode 100644
index 1a6a8ccb..00000000
--- a/sigmodr/tree/BadgeModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_BADGEMODEL
-#define SIGMODRTREE_BADGEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Badge;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT BadgeModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- BadgeModel(BaseModel* parent, Sigmod::Badge* badge);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/BaseModel.cpp b/sigmodr/tree/BaseModel.cpp
deleted file mode 100644
index 0dceeaa4..00000000
--- a/sigmodr/tree/BaseModel.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2008-2009 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 "BaseModel.h"
-
-// Sigmod includes
-#include <sigmod/Object.h>
-
-// KDE includes
-#include <KApplication>
-#include <KMessageBox>
-#include <KUrl>
-#include <KIO/NetAccess>
-
-// Qt includes
-#include <QtCore/QFile>
-#include <QtXml/QDomDocument>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-const int BaseModel::TypeRole = Qt::UserRole;
-const int BaseModel::DropAcceptRole = Qt::UserRole + 1;
-const int BaseModel::XmlRole = Qt::UserRole + 2;
-const int BaseModel::WidgetRole = Qt::UserRole + 3;
-const int BaseModel::ContextMenuRole = Qt::UserRole + 4;
-
-BaseModel::BaseModel(BaseModel* parent, Object* object, const QString& name) :
- m_parent(parent),
- m_object(object),
- m_name(name)
-{
-}
-
-BaseModel::~BaseModel()
-{
-}
-
-QVariant BaseModel::data(const int role) const
-{
- if (role == TypeRole)
- return type();
- else if (role == DropAcceptRole)
- return types();
- return QVariant();
-}
-
-BaseModel* BaseModel::parent()
-{
- return m_parent;
-}
-
-int BaseModel::indexNumber() const
-{
- if (m_parent)
- return m_parent->findChild(const_cast<BaseModel*>(this));
- return -1;
-}
-
-QString BaseModel::type() const
-{
- return "";
-}
-
-const Object* BaseModel::object() const
-{
- return m_object;
-}
-
-bool BaseModel::loadFromData(const QString& data, QDomDocument* xml) const
-{
- bool loaded = false;
- QString error;
- int line;
- int column;
- KUrl url(data);
- if (url.isValid())
- {
- QString path;
- const bool local = url.isLocalFile();
- if (local)
- path = url.path();
- else
- {
- if (!KIO::NetAccess::download(url, path, KApplication::kApplication()->activeWindow()))
- {
- KMessageBox::error(KApplication::kApplication()->activeWindow(), KIO::NetAccess::lastErrorString(), "KIO Error");
- return false;
- }
- }
- QFile file(path);
- if (file.open(QIODevice::ReadOnly))
- {
- if (!xml->setContent(&file, &error, &line, &column))
- {
- KMessageBox::error(KApplication::kApplication()->activeWindow(), QString("%1 at line %2, column %3").arg(error).arg(line).arg(column), "XML Error");
- loaded = false;
- }
- }
- else
- {
- KMessageBox::error(KApplication::kApplication()->activeWindow(), file.errorString(), "File Error");
- loaded = false;
- }
- file.close();
- if (!local)
- KIO::NetAccess::removeTempFile(path);
- }
- else if (xml->setContent(data, &error, &line, &column))
- loaded = true;
- else
- KMessageBox::error(KApplication::kApplication()->activeWindow(), QString("%1 at line %2, column %3").arg(error).arg(line).arg(column), "XML Error");
- return loaded;
-}
-
-void BaseModel::childRowChanged(const int row, const Change change)
-{
- QList<int> indexes;
- indexes << indexNumber() << row;
- emit(rowsChanged(indexes, change));
-}
-
-void BaseModel::childRowsChanged(const QList<int>& rows, const Change change)
-{
- QList<int> indexes;
- indexes << indexNumber() << rows;
- emit(rowsChanged(indexes, change));
-}
diff --git a/sigmodr/tree/BaseModel.h b/sigmodr/tree/BaseModel.h
deleted file mode 100644
index a37bddb2..00000000
--- a/sigmodr/tree/BaseModel.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_BASEMODEL
-#define SIGMODRTREE_BASEMODEL
-
-// Sigmodr tree includes
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QString>
-#include <QtCore/QVariant>
-
-// Forward declarations
-class KMenu;
-class KUrl;
-class QDomDocument;
-namespace Sigmod
-{
-class Object;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT BaseModel : public QObject
-{
- Q_OBJECT
-
- public:
- enum Change
- {
- Addition = 0,
- Removal = 1
- };
-
- BaseModel(BaseModel* parent, Sigmod::Object* object, const QString& name = "");
- virtual ~BaseModel();
-
- BaseModel* parent();
-
- virtual QVariant data(const int role = Qt::DisplayRole) const;
- virtual int rowCount() const = 0;
-
- virtual Qt::ItemFlags flags() const = 0;
- virtual bool setData(const QVariant& value, const int role = Qt::EditRole) = 0;
-
- virtual BaseModel* childItem(const int row) = 0;
- int indexNumber() const;
-
- virtual Qt::DropActions supportedDragActions() const = 0;
- virtual Qt::DropActions supportedDropActions() const = 0;
-
- virtual QString type() const;
- virtual QString types() const = 0;
-
- const Sigmod::Object* object() const;
-
- bool loadFromData(const QString& data, QDomDocument* xml) const;
-
- static const int TypeRole;
- static const int DropAcceptRole;
- static const int XmlRole;
- static const int WidgetRole;
- static const int ContextMenuRole;
- signals:
- void rowChanged(const int row, const Sigmodr::Tree::BaseModel::Change change);
- void rowsChanged(const QList<int>& rows, const Sigmodr::Tree::BaseModel::Change change);
- protected:
- virtual int findChild(BaseModel* model) const = 0;
-
- BaseModel* m_parent;
- Sigmod::Object* m_object;
- QString m_name;
- protected slots:
- void childRowChanged(const int row, const Sigmodr::Tree::BaseModel::Change change);
- void childRowsChanged(const QList<int>& rows, const Sigmodr::Tree::BaseModel::Change change);
-};
-}
-}
-Q_DECLARE_METATYPE(KMenu*)
-
-#endif
diff --git a/sigmodr/tree/BaseObjectModel.cpp b/sigmodr/tree/BaseObjectModel.cpp
deleted file mode 100644
index 792ce098..00000000
--- a/sigmodr/tree/BaseObjectModel.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2008-2009 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 "BaseObjectModel.h"
-
-// Sigmod includes
-#include <sigmod/Object.h>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-BaseObjectModel::BaseObjectModel(BaseModel* parent, Object* object) :
- BaseModel(parent, object, "")
-{
-}
-
-BaseObjectModel::~BaseObjectModel()
-{
-}
-
-QVariant BaseObjectModel::data(int role) const
-{
- return BaseModel::data(role);
-}
-
-Qt::ItemFlags BaseObjectModel::flags() const
-{
- return Qt::ItemIsDragEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled;
-}
-
-Qt::DropActions BaseObjectModel::supportedDragActions() const
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-
-Qt::DropActions BaseObjectModel::supportedDropActions() const
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-
-QString BaseObjectModel::type() const
-{
- return m_object->className();
-}
-
-int BaseObjectModel::findChild(BaseModel* model) const
-{
- Q_UNUSED(model)
- return -1;
-}
diff --git a/sigmodr/tree/BaseObjectModel.h b/sigmodr/tree/BaseObjectModel.h
deleted file mode 100644
index 749773b3..00000000
--- a/sigmodr/tree/BaseObjectModel.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_BASEOBJECTMODEL
-#define SIGMODRTREE_BASEOBJECTMODEL
-
-// Sigmodr tree includes
-#include "BaseModel.h"
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT BaseObjectModel : public BaseModel
-{
- Q_OBJECT
-
- public:
- BaseObjectModel(BaseModel* parent, Sigmod::Object* object);
- virtual ~BaseObjectModel();
-
- virtual QVariant data(int role = Qt::DisplayRole) const;
- virtual int rowCount() const = 0;
-
- Qt::ItemFlags flags() const;
- virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0;
-
- virtual BaseModel* childItem(const int row) = 0;
-
- Qt::DropActions supportedDragActions() const;
- Qt::DropActions supportedDropActions() const;
-
- QString type() const;
- virtual QString types() const = 0;
- protected:
- virtual int findChild(BaseModel* model) const;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/CoinListGroupModel.cpp b/sigmodr/tree/CoinListGroupModel.cpp
deleted file mode 100644
index 4ee1483c..00000000
--- a/sigmodr/tree/CoinListGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "CoinListGroupModel.h"
-
-// Sigmodr tree includes
-#include "CoinListModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/CoinList.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-CoinListGroupModel::CoinListGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Coin Lists")
-{
- for (int i = 0; i < game->coinListCount(); ++i)
- addObject(game->coinList(i));
-}
-
-QVariant CoinListGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Coin List", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool CoinListGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "CoinList"))
- {
- addObject(qobject_cast<Game*>(m_object)->newCoinList(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString CoinListGroupModel::types() const
-{
- return "CoinList";
-}
-
-void CoinListGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newCoinList();
- if (object->className() == "CoinList")
- addChild(new CoinListModel(this, qobject_cast<CoinList*>(object)));
-}
-
-void CoinListGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteCoinList(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/CoinListGroupModel.h b/sigmodr/tree/CoinListGroupModel.h
deleted file mode 100644
index 62271aba..00000000
--- a/sigmodr/tree/CoinListGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_COINLISTGROUPMODEL
-#define SIGMODRTREE_COINLISTGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT CoinListGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- CoinListGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/CoinListItemModel.cpp b/sigmodr/tree/CoinListItemModel.cpp
deleted file mode 100644
index eb342acb..00000000
--- a/sigmodr/tree/CoinListItemModel.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2008-2009 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 "CoinListItemModel.h"
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/CoinListItemUI.h>
-
-// Sigmod includes
-#include <sigmod/CoinList.h>
-#include <sigmod/CoinListItem.h>
-#include <sigmod/Item.h>
-#include <sigmod/Game.h>
-#include <sigmod/Species.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-CoinListItemModel::CoinListItemModel(BaseModel* parent, CoinListItem* item) :
- ObjectModel(parent, item)
-{
-}
-
-QVariant CoinListItemModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- {
- CoinListItem* item = qobject_cast<CoinListItem*>(m_object);
- if (item->type() == CoinListItem::Item)
- {
- const Item* _item = m_object->game()->itemById(item->object());
- if (_item)
- return _item->name();
- }
- else if (item->type() == CoinListItem::Species)
- {
- const Species* species = m_object->game()->speciesById(item->object());
- if (species)
- return species->name();
- }
- return "";
- }
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new CoinListItemUI(qobject_cast<CoinListItem*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Object", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void CoinListItemModel::deleteSelf()
-{
- qobject_cast<GroupObjectModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/CoinListItemModel.h b/sigmodr/tree/CoinListItemModel.h
deleted file mode 100644
index a5f3b939..00000000
--- a/sigmodr/tree/CoinListItemModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_COINLISTITEMMODEL
-#define SIGMODRTREE_COINLISTITEMMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class CoinListItem;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT CoinListItemModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- CoinListItemModel(BaseModel* parent, Sigmod::CoinListItem* item);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/CoinListModel.cpp b/sigmodr/tree/CoinListModel.cpp
deleted file mode 100644
index d976ec7f..00000000
--- a/sigmodr/tree/CoinListModel.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2008-2009 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 "CoinListModel.h"
-
-// Sigmodr tree includes
-#include "CoinListItemModel.h"
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/CoinListUI.h>
-
-// Sigmod includes
-#include <sigmod/CoinList.h>
-#include <sigmod/CoinListItem.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-CoinListModel::CoinListModel(BaseModel* parent, CoinList* coinList) :
- GroupObjectModel(parent, coinList)
-{
- setupData();
-}
-
-CoinListModel::~CoinListModel()
-{
- clearData();
-}
-
-QVariant CoinListModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<CoinList*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new CoinListUI(qobject_cast<CoinList*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Object", this, SLOT(addObject()));
- menu->addSeparator();
- menu->addAction("&Delete Coin List", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool CoinListModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- else if (xml.doctype().name() == "CoinListItem")
- {
- addObject(qobject_cast<CoinList*>(m_object)->newItem(xml.documentElement()));
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString CoinListModel::types() const
-{
- return type().append(QString(";CoinListItem"));
-}
-
-void CoinListModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<CoinList*>(m_object)->newItem();
- if (object->className() == "CoinListItem")
- addChild(new CoinListItemModel(this, qobject_cast<CoinListItem*>(object)));
-}
-
-void CoinListModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<CoinList*>(m_object)->deleteItem(index);
- removeChild(index);
- }
-}
-
-void CoinListModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
-
-void CoinListModel::setupData()
-{
- CoinList* coinList = qobject_cast<CoinList*>(m_object);
- for (int i = 0; i < coinList->itemCount(); ++i)
- addChild(new CoinListItemModel(this, coinList->item(i)));
-}
diff --git a/sigmodr/tree/CoinListModel.h b/sigmodr/tree/CoinListModel.h
deleted file mode 100644
index 182c45bb..00000000
--- a/sigmodr/tree/CoinListModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_COINLISTMODEL
-#define SIGMODRTREE_COINLISTMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class CoinList;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT CoinListModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- CoinListModel(BaseModel* parent, Sigmod::CoinList* coinList);
- ~CoinListModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/EggGroupGroupModel.cpp b/sigmodr/tree/EggGroupGroupModel.cpp
deleted file mode 100644
index 7e10f71e..00000000
--- a/sigmodr/tree/EggGroupGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "EggGroupGroupModel.h"
-
-// Sigmodr tree includes
-#include "EggGroupModel.h"
-
-// Sigmod includes
-#include <sigmod/EggGroup.h>
-#include <sigmod/Game.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-EggGroupGroupModel::EggGroupGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Egg Groups")
-{
- for (int i = 0; i < game->eggGroupCount(); ++i)
- addObject(game->eggGroup(i));
-}
-
-QVariant EggGroupGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Egg Group", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool EggGroupGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "EggGroup"))
- {
- addObject(qobject_cast<Game*>(m_object)->newEggGroup(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString EggGroupGroupModel::types() const
-{
- return "EggGroup";
-}
-
-void EggGroupGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newEggGroup();
- if (object->className() == "EggGroup")
- addChild(new EggGroupModel(this, qobject_cast<EggGroup*>(object)));
-}
-
-void EggGroupGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteEggGroup(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/EggGroupGroupModel.h b/sigmodr/tree/EggGroupGroupModel.h
deleted file mode 100644
index 787e27b0..00000000
--- a/sigmodr/tree/EggGroupGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_EGGGROUPGROUPMODEL
-#define SIGMODRTREE_EGGGROUPGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT EggGroupGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- EggGroupGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/EggGroupModel.cpp b/sigmodr/tree/EggGroupModel.cpp
deleted file mode 100644
index 2ab8f0b9..00000000
--- a/sigmodr/tree/EggGroupModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "EggGroupModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/EggGroupUI.h>
-
-// Sigmod includes
-#include <sigmod/EggGroup.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-EggGroupModel::EggGroupModel(BaseModel* parent, EggGroup* eggGroup) :
- ObjectModel(parent, eggGroup)
-{
-}
-
-QVariant EggGroupModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<EggGroup*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new EggGroupUI(qobject_cast<EggGroup*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Egg Group", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void EggGroupModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/EggGroupModel.h b/sigmodr/tree/EggGroupModel.h
deleted file mode 100644
index 56a8fdfa..00000000
--- a/sigmodr/tree/EggGroupModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_EGGGROUPMODEL
-#define SIGMODRTREE_EGGGROUPMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class EggGroup;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT EggGroupModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- EggGroupModel(BaseModel* parent, Sigmod::EggGroup* eggGroup);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/GameModel.cpp b/sigmodr/tree/GameModel.cpp
deleted file mode 100644
index 36b89d82..00000000
--- a/sigmodr/tree/GameModel.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright 2008-2009 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 "GameModel.h"
-
-// Sigmodr tree includes
-#include "AbilityGroupModel.h"
-#include "AuthorGroupModel.h"
-#include "BadgeGroupModel.h"
-#include "CoinListGroupModel.h"
-#include "EggGroupGroupModel.h"
-#include "GlobalScriptGroupModel.h"
-#include "ItemGroupModel.h"
-#include "ItemTypeGroupModel.h"
-#include "MapGroupModel.h"
-#include "MoveGroupModel.h"
-#include "NatureGroupModel.h"
-#include "RulesModel.h"
-#include "SkinGroupModel.h"
-#include "SoundGroupModel.h"
-#include "SpeciesGroupModel.h"
-#include "SpriteGroupModel.h"
-#include "StatusGroupModel.h"
-#include "StoreGroupModel.h"
-#include "TileGroupModel.h"
-#include "TimeGroupModel.h"
-#include "TrainerGroupModel.h"
-#include "TypeGroupModel.h"
-#include "WeatherGroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/GameUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-GameModel::GameModel(BaseModel* parent, Game* game) :
- GroupObjectModel(parent, game)
-{
- setupData();
-}
-
-GameModel::~GameModel()
-{
- clearData();
-}
-
-QVariant GameModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Game*>(m_object)->title();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new GameUI(qobject_cast<Game*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool GameModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- foreach (BaseModel* model, m_objects)
- {
- GroupModel* group = qobject_cast<GroupModel*>(model);
- if (group && group->setData(value, role))
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString GameModel::types() const
-{
- return type().append(QString(";Rules;Ability;Author;Badge;CoinList;EggGroup;GlobalScript;Item;ItemType;Map;Move;Nature;Skin;Sound;Species;Sprite;Status;Store;Tile;Time;Trainer;Type;Weather"));
-}
-
-void GameModel::addObject(Object* object)
-{
- Q_UNUSED(object)
-}
-
-void GameModel::deleteObject(BaseModel* model)
-{
- Q_UNUSED(model)
-}
-
-void GameModel::deleteSelf()
-{
-}
-
-void GameModel::setupData()
-{
- Game* game = qobject_cast<Game*>(m_object);
- addChild(new RulesModel(this, game->rules()));
- addChild(new AbilityGroupModel(this, game));
- addChild(new AuthorGroupModel(this, game));
- addChild(new BadgeGroupModel(this, game));
- addChild(new CoinListGroupModel(this, game));
- addChild(new EggGroupGroupModel(this, game));
- addChild(new GlobalScriptGroupModel(this, game));
- addChild(new ItemGroupModel(this, game));
- addChild(new ItemTypeGroupModel(this, game));
- addChild(new MapGroupModel(this, game));
- addChild(new MoveGroupModel(this, game));
- addChild(new NatureGroupModel(this, game));
- addChild(new SkinGroupModel(this, game));
- addChild(new SoundGroupModel(this, game));
- addChild(new SpeciesGroupModel(this, game));
- addChild(new SpriteGroupModel(this, game));
- addChild(new StatusGroupModel(this, game));
- addChild(new StoreGroupModel(this, game));
- addChild(new TileGroupModel(this, game));
- addChild(new TimeGroupModel(this, game));
- addChild(new TrainerGroupModel(this, game));
- addChild(new TypeGroupModel(this, game));
- addChild(new WeatherGroupModel(this, game));
-}
diff --git a/sigmodr/tree/GameModel.h b/sigmodr/tree/GameModel.h
deleted file mode 100644
index c1cc11f7..00000000
--- a/sigmodr/tree/GameModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GAMEMODEL
-#define SIGMODRTREE_GAMEMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT GameModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- GameModel(BaseModel* parent, Sigmod::Game* game);
- ~GameModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/GlobalScriptGroupModel.cpp b/sigmodr/tree/GlobalScriptGroupModel.cpp
deleted file mode 100644
index 00068d1f..00000000
--- a/sigmodr/tree/GlobalScriptGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "GlobalScriptGroupModel.h"
-
-// Sigmodr tree includes
-#include "GlobalScriptModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/GlobalScript.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-GlobalScriptGroupModel::GlobalScriptGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Global Scripts")
-{
- for (int i = 0; i < game->globalScriptCount(); ++i)
- addObject(game->globalScript(i));
-}
-
-QVariant GlobalScriptGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Global Script", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool GlobalScriptGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "GlobalScript"))
- {
- addObject(qobject_cast<Game*>(m_object)->newGlobalScript(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString GlobalScriptGroupModel::types() const
-{
- return "GlobalScript";
-}
-
-void GlobalScriptGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newGlobalScript();
- if (object->className() == "GlobalScript")
- addChild(new GlobalScriptModel(this, qobject_cast<GlobalScript*>(object)));
-}
-
-void GlobalScriptGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteGlobalScript(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/GlobalScriptGroupModel.h b/sigmodr/tree/GlobalScriptGroupModel.h
deleted file mode 100644
index 3668b4bf..00000000
--- a/sigmodr/tree/GlobalScriptGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GLOBALSCRIPTGROUPMODEL
-#define SIGMODRTREE_GLOBALSCRIPTGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT GlobalScriptGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- GlobalScriptGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/GlobalScriptModel.cpp b/sigmodr/tree/GlobalScriptModel.cpp
deleted file mode 100644
index b82f25fe..00000000
--- a/sigmodr/tree/GlobalScriptModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "GlobalScriptModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/GlobalScriptUI.h>
-
-// Sigmod includes
-#include <sigmod/GlobalScript.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-GlobalScriptModel::GlobalScriptModel(BaseModel* parent, GlobalScript* globalScript) :
- ObjectModel(parent, globalScript)
-{
-}
-
-QVariant GlobalScriptModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<GlobalScript*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new GlobalScriptUI(qobject_cast<GlobalScript*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Global Script", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void GlobalScriptModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/GlobalScriptModel.h b/sigmodr/tree/GlobalScriptModel.h
deleted file mode 100644
index 87d8bde0..00000000
--- a/sigmodr/tree/GlobalScriptModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GLOBALSCRIPTMODEL
-#define SIGMODRTREE_GLOBALSCRIPTMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class GlobalScript;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT GlobalScriptModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- GlobalScriptModel(BaseModel* parent, Sigmod::GlobalScript* globalScript);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/GroupModel.cpp b/sigmodr/tree/GroupModel.cpp
deleted file mode 100644
index f64f5f9b..00000000
--- a/sigmodr/tree/GroupModel.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2008-2009 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 "GroupModel.h"
-
-// Sigmodr tree includes
-#include "BaseObjectModel.h"
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-GroupModel::GroupModel(BaseModel* parent, Object* object, const QString& name) :
- BaseModel(parent, object, name),
- Grouping()
-{
-}
-
-GroupModel::~GroupModel()
-{
- clearData();
-}
-
-QVariant GroupModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return m_name;
- return BaseModel::data(role);
-}
-
-int GroupModel::rowCount() const
-{
- return m_objects.size();
-}
-
-Qt::ItemFlags GroupModel::flags() const
-{
- return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled;
-}
-
-BaseModel* GroupModel::childItem(const int row)
-{
- if (row < m_objects.size())
- return m_objects[row];
- return NULL;
-}
-
-Qt::DropActions GroupModel::supportedDragActions() const
-{
- return 0;
-}
-
-Qt::DropActions GroupModel::supportedDropActions() const
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-
-void GroupModel::addChild(BaseModel* model)
-{
- connect(model, SIGNAL(rowChanged(int, Sigmodr::Tree::BaseModel::Change)), this, SLOT(childRowChanged(int, Sigmodr::Tree::BaseModel::Change)));
- connect(model, SIGNAL(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)), this, SLOT(childRowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)));
- m_objects.append(model);
- emit(rowChanged(m_objects.size() - 1, Addition));
-}
-
-void GroupModel::removeChild(const int row)
-{
- m_objects[row]->deleteLater();
- m_objects.removeAt(row);
- childRowChanged(row, Removal);
-}
-
-int GroupModel::findChild(BaseModel* model) const
-{
- return find(model);
-}
diff --git a/sigmodr/tree/GroupModel.h b/sigmodr/tree/GroupModel.h
deleted file mode 100644
index 1abefc80..00000000
--- a/sigmodr/tree/GroupModel.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GROUPMODEL
-#define SIGMODRTREE_GROUPMODEL
-
-// Sigmodr tree includes
-#include "BaseModel.h"
-#include "Grouping.h"
-
-// Qt includes
-#include <QtCore/QList>
-
-// Forward declarations
-namespace Sigmod
-{
-class Object;
-}
-namespace Sigmodr
-{
-namespace Tree
-{
-class BaseModel;
-
-class SIGMODRTREE_NO_EXPORT GroupModel : public BaseModel, public Grouping
-{
- Q_OBJECT
-
- public:
- GroupModel(BaseModel* parent, Sigmod::Object* object, const QString& name = "");
- virtual ~GroupModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
- int rowCount() const;
-
- Qt::ItemFlags flags() const;
- virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0;
-
- BaseModel* childItem(const int row);
-
- Qt::DropActions supportedDragActions() const;
- Qt::DropActions supportedDropActions() const;
-
- virtual QString types() const = 0;
- public slots:
- void addChild(BaseModel* model);
- void removeChild(const int row);
-
- virtual void addObject(Sigmod::Object* object = NULL) = 0;
- virtual void deleteObject(BaseModel* model) = 0;
- protected:
- int findChild(BaseModel* model) const;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/GroupObjectModel.cpp b/sigmodr/tree/GroupObjectModel.cpp
deleted file mode 100644
index 8f71dde9..00000000
--- a/sigmodr/tree/GroupObjectModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "GroupObjectModel.h"
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-GroupObjectModel::GroupObjectModel(BaseModel* parent, Object* object) :
- BaseObjectModel(parent, object),
- Grouping()
-{
-}
-
-GroupObjectModel::~GroupObjectModel()
-{
-}
-
-QVariant GroupObjectModel::data(int role) const
-{
- return BaseObjectModel::data(role);
-}
-
-int GroupObjectModel::rowCount() const
-{
- return m_objects.size();
-}
-
-BaseModel* GroupObjectModel::childItem(const int row)
-{
- if (row < m_objects.size())
- return m_objects[row];
- return NULL;
-}
-
-void GroupObjectModel::addChild(BaseModel* model)
-{
- connect(model, SIGNAL(rowChanged(int, Sigmodr::Tree::BaseModel::Change)), this, SLOT(childRowChanged(int, Sigmodr::Tree::BaseModel::Change)));
- connect(model, SIGNAL(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)), this, SLOT(childRowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)));
- m_objects.append(model);
- emit(rowChanged(m_objects.size() - 1, Addition));
-}
-
-void GroupObjectModel::removeChild(const int row)
-{
- m_objects[row]->deleteLater();
- m_objects.removeAt(row);
- childRowChanged(row, Removal);
-}
-
-int GroupObjectModel::findChild(BaseModel* model) const
-{
- return find(model);
-}
diff --git a/sigmodr/tree/GroupObjectModel.h b/sigmodr/tree/GroupObjectModel.h
deleted file mode 100644
index 397eb25d..00000000
--- a/sigmodr/tree/GroupObjectModel.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GROUPOBJECTMODEL
-#define SIGMODRTREE_GROUPOBJECTMODEL
-
-// Sigmodr tree includes
-#include "BaseObjectModel.h"
-#include "Grouping.h"
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT GroupObjectModel : public BaseObjectModel, public Grouping
-{
- Q_OBJECT
-
- public:
- GroupObjectModel(BaseModel* parent, Sigmod::Object* object);
- virtual ~GroupObjectModel();
-
- virtual QVariant data(int role = Qt::DisplayRole) const;
- int rowCount() const;
-
- virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0;
-
- BaseModel* childItem(const int row);
-
- virtual QString types() const = 0;
- public slots:
- void addChild(BaseModel* model);
- void removeChild(const int row);
-
- virtual void addObject(Sigmod::Object* object = NULL) = 0;
- virtual void deleteObject(BaseModel* model) = 0;
-
- virtual void deleteSelf() = 0;
- protected:
- int findChild(BaseModel* model) const;
-
- virtual void setupData() = 0;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/Grouping.cpp b/sigmodr/tree/Grouping.cpp
deleted file mode 100644
index 2f9d6015..00000000
--- a/sigmodr/tree/Grouping.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2008-2009 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 "Grouping.h"
-
-// Sigmodr tree includes
-#include "BaseModel.h"
-
-using namespace Sigmodr::Tree;
-
-Grouping::Grouping()
-{
-}
-
-Grouping::~Grouping()
-{
- clearData();
-}
-
-int Grouping::find(BaseModel* model) const
-{
- return m_objects.indexOf(model);
-}
-
-void Grouping::clearData()
-{
- qDeleteAll(m_objects);
- m_objects.clear();
-}
diff --git a/sigmodr/tree/Grouping.h b/sigmodr/tree/Grouping.h
deleted file mode 100644
index 9749aa7c..00000000
--- a/sigmodr/tree/Grouping.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_GROUPING
-#define SIGMODRTREE_GROUPING
-
-// Sigmodr tree includes
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QList>
-
-// Forward declarations
-namespace Sigmod
-{
-class Object;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class BaseModel;
-
-class SIGMODRTREE_NO_EXPORT Grouping
-{
- public:
- Grouping();
- virtual ~Grouping();
-
- virtual void addChild(BaseModel* model) = 0;
-
- virtual void addObject(Sigmod::Object* object = NULL) = 0;
- virtual void deleteObject(BaseModel* model) = 0;
- protected:
- int find(BaseModel* model) const;
- void clearData();
-
- QList<BaseModel*> m_objects;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/ItemGroupModel.cpp b/sigmodr/tree/ItemGroupModel.cpp
deleted file mode 100644
index 777718f2..00000000
--- a/sigmodr/tree/ItemGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "ItemGroupModel.h"
-
-// Sigmodr tree includes
-#include "ItemModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Item.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-ItemGroupModel::ItemGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Items")
-{
- for (int i = 0; i < game->itemCount(); ++i)
- addObject(game->item(i));
-}
-
-QVariant ItemGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Item", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool ItemGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Item"))
- {
- addObject(qobject_cast<Game*>(m_object)->newItem(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString ItemGroupModel::types() const
-{
- return "Item";
-}
-
-void ItemGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newItem();
- if (object->className() == "Item")
- addChild(new ItemModel(this, qobject_cast<Item*>(object)));
-}
-
-void ItemGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteItem(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/ItemGroupModel.h b/sigmodr/tree/ItemGroupModel.h
deleted file mode 100644
index 05cb05c9..00000000
--- a/sigmodr/tree/ItemGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ITEMGROUPMODEL
-#define SIGMODRTREE_ITEMGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT ItemGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- ItemGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/ItemModel.cpp b/sigmodr/tree/ItemModel.cpp
deleted file mode 100644
index 11343a91..00000000
--- a/sigmodr/tree/ItemModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "ItemModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/ItemUI.h>
-
-// Sigmod includes
-#include <sigmod/Item.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-ItemModel::ItemModel(BaseModel* parent, Item* item) :
- ObjectModel(parent, item)
-{
-}
-
-QVariant ItemModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Item*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new ItemUI(qobject_cast<Item*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Item", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void ItemModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/ItemModel.h b/sigmodr/tree/ItemModel.h
deleted file mode 100644
index 52d15f8c..00000000
--- a/sigmodr/tree/ItemModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ITEMMODEL
-#define SIGMODRTREE_ITEMMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Item;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT ItemModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- ItemModel(BaseModel* parent, Sigmod::Item* item);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/ItemTypeGroupModel.cpp b/sigmodr/tree/ItemTypeGroupModel.cpp
deleted file mode 100644
index f5c9480e..00000000
--- a/sigmodr/tree/ItemTypeGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "ItemTypeGroupModel.h"
-
-// Sigmodr tree includes
-#include "ItemTypeModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/ItemType.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-ItemTypeGroupModel::ItemTypeGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Item Types")
-{
- for (int i = 0; i < game->itemTypeCount(); ++i)
- addObject(game->itemType(i));
-}
-
-QVariant ItemTypeGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Item Type", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool ItemTypeGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "ItemType"))
- {
- addObject(qobject_cast<Game*>(m_object)->newItemType(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString ItemTypeGroupModel::types() const
-{
- return "ItemType";
-}
-
-void ItemTypeGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newItemType();
- if (object->className() == "ItemType")
- addChild(new ItemTypeModel(this, qobject_cast<ItemType*>(object)));
-}
-
-void ItemTypeGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteItemType(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/ItemTypeGroupModel.h b/sigmodr/tree/ItemTypeGroupModel.h
deleted file mode 100644
index 86b57f28..00000000
--- a/sigmodr/tree/ItemTypeGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ITEMTYPEGROUPMODEL
-#define SIGMODRTREE_ITEMTYPEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT ItemTypeGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- ItemTypeGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/ItemTypeModel.cpp b/sigmodr/tree/ItemTypeModel.cpp
deleted file mode 100644
index d5b4abcc..00000000
--- a/sigmodr/tree/ItemTypeModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "ItemTypeModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/ItemTypeUI.h>
-
-// Sigmod includes
-#include <sigmod/ItemType.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-ItemTypeModel::ItemTypeModel(BaseModel* parent, ItemType* itemType) :
- ObjectModel(parent, itemType)
-{
-}
-
-QVariant ItemTypeModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<ItemType*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new ItemTypeUI(qobject_cast<ItemType*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Item Type", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void ItemTypeModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/ItemTypeModel.h b/sigmodr/tree/ItemTypeModel.h
deleted file mode 100644
index 42680542..00000000
--- a/sigmodr/tree/ItemTypeModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ITEMTYPEMODEL
-#define SIGMODRTREE_ITEMTYPEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class ItemType;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT ItemTypeModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- ItemTypeModel(BaseModel* parent, Sigmod::ItemType* itemType);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapEffectGroupModel.cpp b/sigmodr/tree/MapEffectGroupModel.cpp
deleted file mode 100644
index 25afd0ce..00000000
--- a/sigmodr/tree/MapEffectGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapEffectGroupModel.h"
-
-// Sigmodr tree includes
-#include "MapEffectModel.h"
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapEffect.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MapEffectGroupModel::MapEffectGroupModel(BaseModel* parent, Map* map) :
- GroupModel(parent, map, "Effects")
-{
- for (int i = 0; i < map->effectCount(); ++i)
- addObject(map->effect(i));
-}
-
-QVariant MapEffectGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Effect", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MapEffectGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "MapEffect"))
- {
- addObject(qobject_cast<Map*>(m_object)->newEffect(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MapEffectGroupModel::types() const
-{
- return "MapEffect";
-}
-
-void MapEffectGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Map*>(m_object)->newEffect();
- if (object->className() == "MapEffect")
- addChild(new MapEffectModel(this, qobject_cast<MapEffect*>(object)));
-}
-
-void MapEffectGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Map*>(m_object)->deleteEffect(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MapEffectGroupModel.h b/sigmodr/tree/MapEffectGroupModel.h
deleted file mode 100644
index 8d7194dc..00000000
--- a/sigmodr/tree/MapEffectGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPEFFECTGROUPMODEL
-#define SIGMODRTREE_MAPEFFECTGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Map;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapEffectGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MapEffectGroupModel(BaseModel* parent, Sigmod::Map* map);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapEffectModel.cpp b/sigmodr/tree/MapEffectModel.cpp
deleted file mode 100644
index 61094097..00000000
--- a/sigmodr/tree/MapEffectModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapEffectModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapEffectUI.h>
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapEffect.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapEffectModel::MapEffectModel(BaseModel* parent, MapEffect* effect) :
- ObjectModel(parent, effect)
-{
-}
-
-QVariant MapEffectModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<MapEffect*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapEffectUI(qobject_cast<MapEffect*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Effect", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void MapEffectModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/MapEffectModel.h b/sigmodr/tree/MapEffectModel.h
deleted file mode 100644
index 0e1eaa65..00000000
--- a/sigmodr/tree/MapEffectModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPEFFECTMODEL
-#define SIGMODRTREE_MAPEFFECTMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapEffect;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapEffectModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- MapEffectModel(BaseModel* parent, Sigmod::MapEffect* effect);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapGroupModel.cpp b/sigmodr/tree/MapGroupModel.cpp
deleted file mode 100644
index f38ff76c..00000000
--- a/sigmodr/tree/MapGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapGroupModel.h"
-
-// Sigmodr tree includes
-#include "MapModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Map.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MapGroupModel::MapGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Maps")
-{
- for (int i = 0; i < game->mapCount(); ++i)
- addObject(game->map(i));
-}
-
-QVariant MapGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Map", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MapGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Map"))
- {
- addObject(qobject_cast<Game*>(m_object)->newMap(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MapGroupModel::types() const
-{
- return "Map";
-}
-
-void MapGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newMap();
- if (object->className() == "Map")
- addChild(new MapModel(this, qobject_cast<Map*>(object)));
-}
-
-void MapGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteMap(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MapGroupModel.h b/sigmodr/tree/MapGroupModel.h
deleted file mode 100644
index 18b02698..00000000
--- a/sigmodr/tree/MapGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPGROUPMODEL
-#define SIGMODRTREE_MAPGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MapGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapModel.cpp b/sigmodr/tree/MapModel.cpp
deleted file mode 100644
index 48ef143c..00000000
--- a/sigmodr/tree/MapModel.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapModel.h"
-
-// Sigmodr tree includes
-#include "MapEffectGroupModel.h"
-#include "MapTrainerGroupModel.h"
-#include "MapWarpGroupModel.h"
-#include "MapWildListGroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapUI.h>
-
-// Sigmod includes
-#include <sigmod/Map.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapModel::MapModel(BaseModel* parent, Map* map) :
- GroupObjectModel(parent, map)
-{
- setupData();
-}
-
-MapModel::~MapModel()
-{
- clearData();
-}
-
-QVariant MapModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Map*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapUI(qobject_cast<Map*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Map", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool MapModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- foreach (BaseModel* model, m_objects)
- {
- GroupModel* group = qobject_cast<GroupModel*>(model);
- if (group && group->setData(value, role))
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString MapModel::types() const
-{
- return type().append(QString(";MapEffect;MapTrainer;MapWarp;MapWildList"));
-}
-
-void MapModel::addObject(Object* object)
-{
- Q_UNUSED(object)
-}
-
-void MapModel::deleteObject(BaseModel* model)
-{
- Q_UNUSED(model)
-}
-
-void MapModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
-
-void MapModel::setupData()
-{
- Map* map = qobject_cast<Map*>(m_object);
- addChild(new MapEffectGroupModel(this, map));
- addChild(new MapTrainerGroupModel(this, map));
- addChild(new MapWarpGroupModel(this, map));
- addChild(new MapWildListGroupModel(this, map));
-}
diff --git a/sigmodr/tree/MapModel.h b/sigmodr/tree/MapModel.h
deleted file mode 100644
index 32bc8e8e..00000000
--- a/sigmodr/tree/MapModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPMODEL
-#define SIGMODRTREE_MAPMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Map;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- MapModel(BaseModel* parent, Sigmod::Map* map);
- ~MapModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapTrainerGroupModel.cpp b/sigmodr/tree/MapTrainerGroupModel.cpp
deleted file mode 100644
index 0028c26a..00000000
--- a/sigmodr/tree/MapTrainerGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapTrainerGroupModel.h"
-
-// Sigmodr tree includes
-#include "MapTrainerModel.h"
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapTrainer.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MapTrainerGroupModel::MapTrainerGroupModel(BaseModel* parent, Map* map) :
- GroupModel(parent, map, "Trainers")
-{
- for (int i = 0; i < map->trainerCount(); ++i)
- addObject(map->trainer(i));
-}
-
-QVariant MapTrainerGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Trainer", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MapTrainerGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "MapTrainer"))
- {
- addObject(qobject_cast<Map*>(m_object)->newTrainer(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MapTrainerGroupModel::types() const
-{
- return "MapTrainer";
-}
-
-void MapTrainerGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Map*>(m_object)->newTrainer();
- if (object->className() == "MapTrainer")
- addChild(new MapTrainerModel(this, qobject_cast<MapTrainer*>(object)));
-}
-
-void MapTrainerGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Map*>(m_object)->deleteTrainer(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MapTrainerGroupModel.h b/sigmodr/tree/MapTrainerGroupModel.h
deleted file mode 100644
index 35804b9c..00000000
--- a/sigmodr/tree/MapTrainerGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPTRAINERGROUPMODEL
-#define SIGMODRTREE_MAPTRAINERGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Map;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapTrainerGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MapTrainerGroupModel(BaseModel* parent, Sigmod::Map* map);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapTrainerModel.cpp b/sigmodr/tree/MapTrainerModel.cpp
deleted file mode 100644
index ce1f4622..00000000
--- a/sigmodr/tree/MapTrainerModel.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapTrainerModel.h"
-
-// Sigmodr tree includes
-#include "MapTrainerTeamMemberModel.h"
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapTrainerUI.h>
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapTrainer.h>
-#include <sigmod/MapTrainerTeamMember.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapTrainerModel::MapTrainerModel(BaseModel* parent, MapTrainer* trainer) :
- GroupObjectModel(parent, trainer)
-{
- setupData();
-}
-
-MapTrainerModel::~MapTrainerModel()
-{
- clearData();
-}
-
-QVariant MapTrainerModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<MapTrainer*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapTrainerUI(qobject_cast<MapTrainer*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Team Member", this, SLOT(addObject()));
- menu->addSeparator();
- menu->addAction("&Delete Trainer", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool MapTrainerModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- else if (xml.doctype().name() == "MapTrainerTeamMember")
- {
- addObject(qobject_cast<MapTrainer*>(m_object)->newTeamMember(xml.documentElement()));
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString MapTrainerModel::types() const
-{
- return type().append(QString(";MapTrainerTeamMember"));
-}
-
-void MapTrainerModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<MapTrainer*>(m_object)->newTeamMember();
- if (object->className() == "MapTrainerTeamMember")
- addChild(new MapTrainerTeamMemberModel(this, qobject_cast<MapTrainerTeamMember*>(object)));
-}
-
-void MapTrainerModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<MapTrainer*>(m_object)->deleteTeamMember(index);
- removeChild(index);
- }
-}
-
-void MapTrainerModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
-
-void MapTrainerModel::setupData()
-{
- MapTrainer* trainer = qobject_cast<MapTrainer*>(m_object);
- for (int i = 0; i < trainer->teamMemberCount(); ++i)
- addChild(new MapTrainerTeamMemberModel(this, trainer->teamMember(i)));
-}
diff --git a/sigmodr/tree/MapTrainerModel.h b/sigmodr/tree/MapTrainerModel.h
deleted file mode 100644
index 840c8a2b..00000000
--- a/sigmodr/tree/MapTrainerModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPTRAINERMODEL
-#define SIGMODRTREE_MAPTRAINERMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapTrainer;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapTrainerModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- MapTrainerModel(BaseModel* parent, Sigmod::MapTrainer* trainer);
- ~MapTrainerModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapTrainerTeamMemberModel.cpp b/sigmodr/tree/MapTrainerTeamMemberModel.cpp
deleted file mode 100644
index e6c20c96..00000000
--- a/sigmodr/tree/MapTrainerTeamMemberModel.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapTrainerTeamMemberModel.h"
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapTrainerTeamMemberUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/MapTrainer.h>
-#include <sigmod/MapTrainerTeamMember.h>
-#include <sigmod/Species.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapTrainerTeamMemberModel::MapTrainerTeamMemberModel(BaseModel* parent, MapTrainerTeamMember* teamMember) :
- ObjectModel(parent, teamMember)
-{
-}
-
-QVariant MapTrainerTeamMemberModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- {
- const Species* species = m_object->game()->speciesById(qobject_cast<MapTrainerTeamMember*>(m_object)->species());
- if (species)
- return species->name();
- return "";
- }
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapTrainerTeamMemberUI(qobject_cast<MapTrainerTeamMember*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Team Member", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void MapTrainerTeamMemberModel::deleteSelf()
-{
- qobject_cast<GroupObjectModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/MapTrainerTeamMemberModel.h b/sigmodr/tree/MapTrainerTeamMemberModel.h
deleted file mode 100644
index 1eb99a83..00000000
--- a/sigmodr/tree/MapTrainerTeamMemberModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPTRAINERTEAMMEMBERMODEL
-#define SIGMODRTREE_MAPTRAINERTEAMMEMBERMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapTrainerTeamMember;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapTrainerTeamMemberModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- MapTrainerTeamMemberModel(BaseModel* parent, Sigmod::MapTrainerTeamMember* teamMember);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapWarpGroupModel.cpp b/sigmodr/tree/MapWarpGroupModel.cpp
deleted file mode 100644
index 7189702c..00000000
--- a/sigmodr/tree/MapWarpGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapWarpGroupModel.h"
-
-// Sigmodr tree includes
-#include "MapWarpModel.h"
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapWarp.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MapWarpGroupModel::MapWarpGroupModel(BaseModel* parent, Map* map) :
- GroupModel(parent, map, "Warps")
-{
- for (int i = 0; i < map->warpCount(); ++i)
- addObject(map->warp(i));
-}
-
-QVariant MapWarpGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Warp", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MapWarpGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "MapWarp"))
- {
- addObject(qobject_cast<Map*>(m_object)->newWarp(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MapWarpGroupModel::types() const
-{
- return "MapWarp";
-}
-
-void MapWarpGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Map*>(m_object)->newWarp();
- if (object->className() == "MapWarp")
- addChild(new MapWarpModel(this, qobject_cast<MapWarp*>(object)));
-}
-
-void MapWarpGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Map*>(m_object)->deleteWarp(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MapWarpGroupModel.h b/sigmodr/tree/MapWarpGroupModel.h
deleted file mode 100644
index 086d8712..00000000
--- a/sigmodr/tree/MapWarpGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPWARPGROUPMODEL
-#define SIGMODRTREE_MAPWARPGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Map;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapWarpGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MapWarpGroupModel(BaseModel* parent, Sigmod::Map* map);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapWarpModel.cpp b/sigmodr/tree/MapWarpModel.cpp
deleted file mode 100644
index 3cf8e581..00000000
--- a/sigmodr/tree/MapWarpModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapWarpModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapWarpUI.h>
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapWarp.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapWarpModel::MapWarpModel(BaseModel* parent, MapWarp* warp) :
- ObjectModel(parent, warp)
-{
-}
-
-QVariant MapWarpModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<MapWarp*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapWarpUI(qobject_cast<MapWarp*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Warp", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void MapWarpModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/MapWarpModel.h b/sigmodr/tree/MapWarpModel.h
deleted file mode 100644
index 4fac46c5..00000000
--- a/sigmodr/tree/MapWarpModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPWARPMODEL
-#define SIGMODRTREE_MAPWARPMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapWarp;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapWarpModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- MapWarpModel(BaseModel* parent, Sigmod::MapWarp* warp);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapWildListEncounterModel.cpp b/sigmodr/tree/MapWildListEncounterModel.cpp
deleted file mode 100644
index e10a027c..00000000
--- a/sigmodr/tree/MapWildListEncounterModel.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapWildListEncounterModel.h"
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapWildListEncounterUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/MapWildList.h>
-#include <sigmod/MapWildListEncounter.h>
-#include <sigmod/Species.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapWildListEncounterModel::MapWildListEncounterModel(BaseModel* parent, MapWildListEncounter* encounter) :
- ObjectModel(parent, encounter)
-{
-}
-
-QVariant MapWildListEncounterModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- {
- const Species* species = m_object->game()->speciesById(qobject_cast<MapWildListEncounter*>(m_object)->species());
- if (species)
- return species->name();
- return "";
- }
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapWildListEncounterUI(qobject_cast<MapWildListEncounter*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Encounter", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void MapWildListEncounterModel::deleteSelf()
-{
- qobject_cast<GroupObjectModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/MapWildListEncounterModel.h b/sigmodr/tree/MapWildListEncounterModel.h
deleted file mode 100644
index 15df0f30..00000000
--- a/sigmodr/tree/MapWildListEncounterModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPWILDLISTENCOUNTERMODEL
-#define SIGMODRTREE_MAPWILDLISTENCOUNTERMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapWildListEncounter;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapWildListEncounterModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- MapWildListEncounterModel(BaseModel* parent, Sigmod::MapWildListEncounter* encounter);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapWildListGroupModel.cpp b/sigmodr/tree/MapWildListGroupModel.cpp
deleted file mode 100644
index 7d8389c7..00000000
--- a/sigmodr/tree/MapWildListGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapWildListGroupModel.h"
-
-// Sigmodr tree includes
-#include "MapWildListModel.h"
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapWildList.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MapWildListGroupModel::MapWildListGroupModel(BaseModel* parent, Map* map) :
- GroupModel(parent, map, "Wild Lists")
-{
- for (int i = 0; i < map->wildListCount(); ++i)
- addObject(map->wildList(i));
-}
-
-QVariant MapWildListGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Wild List", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MapWildListGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "MapWildList"))
- {
- addObject(qobject_cast<Map*>(m_object)->newWildList(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MapWildListGroupModel::types() const
-{
- return "MapWildList";
-}
-
-void MapWildListGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Map*>(m_object)->newWildList();
- if (object->className() == "MapWildList")
- addChild(new MapWildListModel(this, qobject_cast<MapWildList*>(object)));
-}
-
-void MapWildListGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Map*>(m_object)->deleteWildList(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MapWildListGroupModel.h b/sigmodr/tree/MapWildListGroupModel.h
deleted file mode 100644
index 424cc628..00000000
--- a/sigmodr/tree/MapWildListGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPWILDLISTGROUPMODEL
-#define SIGMODRTREE_MAPWILDLISTGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Map;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapWildListGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MapWildListGroupModel(BaseModel* parent, Sigmod::Map* map);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MapWildListModel.cpp b/sigmodr/tree/MapWildListModel.cpp
deleted file mode 100644
index cfc1fa0c..00000000
--- a/sigmodr/tree/MapWildListModel.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MapWildListModel.h"
-
-// Sigmodr tree includes
-#include "MapWildListEncounterModel.h"
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MapWildListUI.h>
-
-// Sigmod includes
-#include <sigmod/Map.h>
-#include <sigmod/MapWildList.h>
-#include <sigmod/MapWildListEncounter.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MapWildListModel::MapWildListModel(BaseModel* parent, MapWildList* wildList) :
- GroupObjectModel(parent, wildList)
-{
- setupData();
-}
-
-MapWildListModel::~MapWildListModel()
-{
- clearData();
-}
-
-QVariant MapWildListModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- {
- return qobject_cast<MapWildList*>(m_object)->name();
- }
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MapWildListUI(qobject_cast<MapWildList*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Encounter", this, SLOT(addObject()));
- menu->addSeparator();
- menu->addAction("&Delete Wild List", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool MapWildListModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- else if (xml.doctype().name() == "MapWildListEncounter")
- {
- addObject(qobject_cast<MapWildList*>(m_object)->newEncounter(xml.documentElement()));
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString MapWildListModel::types() const
-{
- return type().append(QString(";MapWildListEncounter"));
-}
-
-void MapWildListModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<MapWildList*>(m_object)->newEncounter();
- if (object->className() == "MapWildListEncounter")
- addChild(new MapWildListEncounterModel(this, qobject_cast<MapWildListEncounter*>(object)));
-}
-
-void MapWildListModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<MapWildList*>(m_object)->deleteEncounter(index);
- removeChild(index);
- }
-}
-
-void MapWildListModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
-
-void MapWildListModel::setupData()
-{
- MapWildList* wildList = qobject_cast<MapWildList*>(m_object);
- for (int i = 0; i < wildList->encounterCount(); ++i)
- addChild(new MapWildListEncounterModel(this, wildList->encounter(i)));
-}
diff --git a/sigmodr/tree/MapWildListModel.h b/sigmodr/tree/MapWildListModel.h
deleted file mode 100644
index 001e6b88..00000000
--- a/sigmodr/tree/MapWildListModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MAPWILDLISTMODEL
-#define SIGMODRTREE_MAPWILDLISTMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class MapWildList;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MapWildListModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- MapWildListModel(BaseModel* parent, Sigmod::MapWildList* wildList);
- ~MapWildListModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MoveGroupModel.cpp b/sigmodr/tree/MoveGroupModel.cpp
deleted file mode 100644
index 4da83981..00000000
--- a/sigmodr/tree/MoveGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MoveGroupModel.h"
-
-// Sigmodr tree includes
-#include "MoveModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Move.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-MoveGroupModel::MoveGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Moves")
-{
- for (int i = 0; i < game->moveCount(); ++i)
- addObject(game->move(i));
-}
-
-QVariant MoveGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Move", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool MoveGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Move"))
- {
- addObject(qobject_cast<Game*>(m_object)->newMove(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString MoveGroupModel::types() const
-{
- return "Move";
-}
-
-void MoveGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newMove();
- if (object->className() == "Move")
- addChild(new MoveModel(this, qobject_cast<Move*>(object)));
-}
-
-void MoveGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteMove(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/MoveGroupModel.h b/sigmodr/tree/MoveGroupModel.h
deleted file mode 100644
index 600ac6b9..00000000
--- a/sigmodr/tree/MoveGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MOVEGROUPMODEL
-#define SIGMODRTREE_MOVEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MoveGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- MoveGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/MoveModel.cpp b/sigmodr/tree/MoveModel.cpp
deleted file mode 100644
index 09048083..00000000
--- a/sigmodr/tree/MoveModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "MoveModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/MoveUI.h>
-
-// Sigmod includes
-#include <sigmod/Move.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-MoveModel::MoveModel(BaseModel* parent, Move* move) :
- ObjectModel(parent, move)
-{
-}
-
-QVariant MoveModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Move*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new MoveUI(qobject_cast<Move*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Move", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void MoveModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/MoveModel.h b/sigmodr/tree/MoveModel.h
deleted file mode 100644
index 9dddcae7..00000000
--- a/sigmodr/tree/MoveModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_MOVEMODEL
-#define SIGMODRTREE_MOVEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Move;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT MoveModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- MoveModel(BaseModel* parent, Sigmod::Move* move);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/NatureGroupModel.cpp b/sigmodr/tree/NatureGroupModel.cpp
deleted file mode 100644
index 6eba5fea..00000000
--- a/sigmodr/tree/NatureGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "NatureGroupModel.h"
-
-// Sigmodr tree includes
-#include "NatureModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Nature.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-NatureGroupModel::NatureGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Natures")
-{
- for (int i = 0; i < game->natureCount(); ++i)
- addObject(game->nature(i));
-}
-
-QVariant NatureGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Nature", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool NatureGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Nature"))
- {
- addObject(qobject_cast<Game*>(m_object)->newNature(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString NatureGroupModel::types() const
-{
- return "Nature";
-}
-
-void NatureGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newNature();
- if (object->className() == "Nature")
- addChild(new NatureModel(this, qobject_cast<Nature*>(object)));
-}
-
-void NatureGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteNature(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/NatureGroupModel.h b/sigmodr/tree/NatureGroupModel.h
deleted file mode 100644
index 0f7576a9..00000000
--- a/sigmodr/tree/NatureGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_NATUREGROUPMODEL
-#define SIGMODRTREE_NATUREGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT NatureGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- NatureGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/NatureModel.cpp b/sigmodr/tree/NatureModel.cpp
deleted file mode 100644
index 592bd251..00000000
--- a/sigmodr/tree/NatureModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "NatureModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/NatureUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Nature.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-NatureModel::NatureModel(BaseModel* parent, Nature* nature) :
- ObjectModel(parent, nature)
-{
-}
-
-QVariant NatureModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Nature*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new NatureUI(qobject_cast<Nature*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Nature", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void NatureModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/NatureModel.h b/sigmodr/tree/NatureModel.h
deleted file mode 100644
index a3787fa3..00000000
--- a/sigmodr/tree/NatureModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_NATUREMODEL
-#define SIGMODRTREE_NATUREMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Nature;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT NatureModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- NatureModel(BaseModel* parent, Sigmod::Nature* nature);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/ObjectModel.cpp b/sigmodr/tree/ObjectModel.cpp
deleted file mode 100644
index d7906177..00000000
--- a/sigmodr/tree/ObjectModel.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2008-2009 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 "ObjectModel.h"
-
-// Sigmod includes
-#include <sigmod/Object.h>
-
-// Qt includes
-#include <QtXml/QDomDocument>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-ObjectModel::ObjectModel(BaseModel* parent, Object* object) :
- BaseObjectModel(parent, object)
-{
-}
-
-ObjectModel::~ObjectModel()
-{
-}
-
-int ObjectModel::rowCount() const
-{
- return 0;
-}
-
-QVariant ObjectModel::data(int role) const
-{
- return BaseObjectModel::data(role);
-}
-
-bool ObjectModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == m_object->className()))
- {
- m_object->load(xml.documentElement());
- return true;
- }
- }
- }
- return false;
-}
-
-BaseModel* ObjectModel::childItem(const int row)
-{
- Q_UNUSED(row)
- return NULL;
-}
-
-QString ObjectModel::types() const
-{
- return type();
-}
diff --git a/sigmodr/tree/ObjectModel.h b/sigmodr/tree/ObjectModel.h
deleted file mode 100644
index f4a15447..00000000
--- a/sigmodr/tree/ObjectModel.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_OBJECTMODEL
-#define SIGMODRTREE_OBJECTMODEL
-
-// Sigmodr tree includes
-#include "BaseObjectModel.h"
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT ObjectModel : public BaseObjectModel
-{
- Q_OBJECT
-
- public:
- ObjectModel(BaseModel* parent, Sigmod::Object* object);
- virtual ~ObjectModel();
-
- virtual QVariant data(int role = Qt::DisplayRole) const = 0;
- int rowCount() const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- BaseModel* childItem(const int row);
-
- QString types() const;
- public slots:
- virtual void deleteSelf() = 0;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/RootModel.cpp b/sigmodr/tree/RootModel.cpp
deleted file mode 100644
index e2bddfff..00000000
--- a/sigmodr/tree/RootModel.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2008-2009 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 "RootModel.h"
-
-// Sigmodr tree includes
-#include "GameModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-RootModel::RootModel() :
- GroupModel(NULL, NULL)
-{
-}
-
-bool RootModel::setData(const QVariant& value, int role)
-{
- Q_UNUSED(value)
- Q_UNUSED(role)
- return false;
-}
-
-void RootModel::addGame(Game* game)
-{
- addChild(new GameModel(this, game));
-}
-
-void RootModel::deleteGame(const Game* game)
-{
- for (int i = 0; i < m_objects.size(); ++i)
- {
- if (m_objects[i]->object() == game)
- {
- delete m_objects[i];
- m_objects.removeAt(i);
- break;
- }
- }
-}
-
-QString RootModel::types() const
-{
- return "Sigmod";
-}
-
-void RootModel::addObject(Object* object)
-{
- Q_UNUSED(object)
-}
-
-void RootModel::deleteObject(BaseModel* model)
-{
- Q_UNUSED(model)
-}
diff --git a/sigmodr/tree/RootModel.h b/sigmodr/tree/RootModel.h
deleted file mode 100644
index 96273984..00000000
--- a/sigmodr/tree/RootModel.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_ROOTMODEL
-#define SIGMODRTREE_ROOTMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class GameModel;
-
-class SIGMODRTREE_NO_EXPORT RootModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- RootModel();
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- void addGame(Sigmod::Game* game);
- void deleteGame(const Sigmod::Game* game);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/RulesModel.cpp b/sigmodr/tree/RulesModel.cpp
deleted file mode 100644
index 2b23d3d2..00000000
--- a/sigmodr/tree/RulesModel.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2008-2009 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 "RulesModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/RulesUI.h>
-
-// Sigmod includes
-#include <sigmod/Rules.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-RulesModel::RulesModel(BaseModel* parent, Rules* rules) :
- ObjectModel(parent, rules)
-{
-}
-
-QVariant RulesModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return m_object->className();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new RulesUI(qobject_cast<Rules*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void RulesModel::deleteSelf()
-{
-}
diff --git a/sigmodr/tree/RulesModel.h b/sigmodr/tree/RulesModel.h
deleted file mode 100644
index 9987fff3..00000000
--- a/sigmodr/tree/RulesModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_RULESMODEL
-#define SIGMODRTREE_RULESMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Rules;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT RulesModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- RulesModel(BaseModel* parent, Sigmod::Rules* rules);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SigmodrTree.cpp b/sigmodr/tree/SigmodrTree.cpp
deleted file mode 100644
index 2caca70a..00000000
--- a/sigmodr/tree/SigmodrTree.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SigmodrTree.h"
-
-// Sigmodr tree includes
-#include "BaseModel.h"
-#include "SigmodrTreeModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/ObjectUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Object.h>
-
-// Qt includes
-#include <QtGui/QHeaderView>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SigmodrTree::SigmodrTree(QWidget* parent) :
- QTreeView(parent)
-{
- SigmodrTreeModel* model = new SigmodrTreeModel(this);
- connect(model, SIGNAL(dirty(const Sigmod::Game*, bool)), this, SLOT(setDirty(const Sigmod::Game*, bool)));
- header()->hide();
- setModel(model);
- setRootIndex(model->index(-1, 0, QModelIndex()));
-}
-
-QString SigmodrTree::description(const QModelIndex& index) const
-{
- QString type = typeOf(index);
- QString name = model()->data(index, Qt::DisplayRole).toString();
- if (type.isEmpty() && name.isEmpty())
- return "";
- return QString("%1: %2").arg(type).arg(name);
-}
-
-QString SigmodrTree::typeOf(const QModelIndex& index) const
-{
- return model()->data(index, BaseModel::TypeRole).toString();
-}
-
-QStringList SigmodrTree::dropTypes(const QModelIndex& index) const
-{
- return model()->data(index, BaseModel::DropAcceptRole).toString().split(';');
-}
-
-ObjectUI* SigmodrTree::editorWidget(const QModelIndex& index)
-{
- ObjectUI* widget = qobject_cast<ObjectUI*>(model()->data(index, BaseModel::WidgetRole).value<QWidget*>());
- return widget;
-}
-
-KMenu* SigmodrTree::contextMenu(const QModelIndex& index)
-{
- return model()->data(index, BaseModel::ContextMenuRole).value<KMenu*>();
-}
-
-const Game* SigmodrTree::currentGame() const
-{
- QModelIndex index = currentIndex();
- if (index.isValid())
- {
- const Object* object = static_cast<BaseModel*>(index.internalPointer())->object();
- if (object)
- return object->game();
- }
- return NULL;
-}
-
-QDomDocument SigmodrTree::copy(const QModelIndex& index)
-{
- QDomDocument xml;
- xml.setContent(model()->data(index, BaseModel::XmlRole).toString());
- return xml;
-}
-
-void SigmodrTree::paste(const QModelIndex& index, const QDomDocument& data)
-{
- model()->setData(index, data.toString(), BaseModel::XmlRole);
-}
-
-QList<const Game*> SigmodrTree::openedGames() const
-{
- return m_games.keys();
-}
-
-void SigmodrTree::addGame(Game* game, const KUrl& url)
-{
- qobject_cast<SigmodrTreeModel*>(model())->addGame(game);
- m_games[game] = UrlDirty(url, false);
-}
-
-void SigmodrTree::deleteGame(const Game* game)
-{
- if (m_games.contains(game))
- {
- qobject_cast<SigmodrTreeModel*>(model())->deleteGame(game);
- m_games.remove(game);
- }
-}
-
-bool SigmodrTree::isOpen(const KUrl& url) const
-{
- foreach (const UrlDirty& pair, m_games.values())
- {
- if (url == pair.first)
- return true;
- }
- return false;
-}
-
-KUrl SigmodrTree::url(const Game* game) const
-{
- if (m_games.contains(game))
- return m_games[game].first;
- return KUrl();
-}
-
-QStringList SigmodrTree::urls() const
-{
- QStringList urls;
- foreach (const UrlDirty& pair, m_games.values())
- urls << pair.first.prettyUrl();
- return urls;
-}
-
-void SigmodrTree::setUrl(const Game* game, const KUrl& url)
-{
- if (m_games.contains(game))
- m_games[game] = UrlDirty(url, false);
-}
-
-bool SigmodrTree::dirty(const Game* game) const
-{
- if (m_games.contains(game))
- return m_games[game].second;
- return false;
-}
-
-bool SigmodrTree::dirty() const
-{
- return dirty(currentGame());
-}
-
-void SigmodrTree::setDirty(const Game* game, const bool dirty)
-{
- if (m_games.contains(game))
- m_games[game].second = dirty;
-}
-
-void SigmodrTree::setDirty()
-{
- setDirty(currentGame(), true);
-}
diff --git a/sigmodr/tree/SigmodrTree.h b/sigmodr/tree/SigmodrTree.h
deleted file mode 100644
index df808b15..00000000
--- a/sigmodr/tree/SigmodrTree.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SIGMODRTREE
-#define SIGMODRTREE_SIGMODRTREE
-
-// Sigmodr tree includes
-#include "Global.h"
-
-// KDE includes
-#include <KUrl>
-
-// Qt includes
-#include <QtCore/QMap>
-#include <QtGui/QTreeView>
-#include <QtXml/QDomDocument>
-
-// Forward declarations
-class KMenu;
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Widgets
-{
-class ObjectUI;
-}
-
-namespace Tree
-{
-class SIGMODRTREE_EXPORT SigmodrTree : public QTreeView
-{
- Q_OBJECT
-
- public:
- SigmodrTree(QWidget* parent = 0);
-
- QString description(const QModelIndex& index) const;
- QString typeOf(const QModelIndex& index) const;
- QStringList dropTypes(const QModelIndex& index) const;
- Widgets::ObjectUI* editorWidget(const QModelIndex& index);
- KMenu* contextMenu(const QModelIndex& index);
-
- const Sigmod::Game* currentGame() const;
-
- QDomDocument copy(const QModelIndex& index);
- void paste(const QModelIndex& index, const QDomDocument& data);
-
- QList<const Sigmod::Game*> openedGames() const;
- void addGame(Sigmod::Game* game, const KUrl& url = KUrl());
- void deleteGame(const Sigmod::Game* game);
- void deleteAllGames();
-
- bool isOpen(const KUrl& url) const;
-
- KUrl url(const Sigmod::Game* game) const;
- QStringList urls() const;
- void setUrl(const Sigmod::Game* game, const KUrl& url);
-
- bool dirty(const Sigmod::Game* game) const;
- bool dirty() const;
- public slots:
- void setDirty(const Sigmod::Game* game, const bool dirty);
- private slots:
- void setDirty();
- private:
- typedef QPair<KUrl, bool> UrlDirty;
-
- QMap<const Sigmod::Game*, UrlDirty> m_games;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SigmodrTreeModel.cpp b/sigmodr/tree/SigmodrTreeModel.cpp
deleted file mode 100644
index 509605d7..00000000
--- a/sigmodr/tree/SigmodrTreeModel.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SigmodrTreeModel.h"
-
-// Sigmodr tree includes
-#include "RootModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-
-// Qt includes
-#include <QtCore/QMimeData>
-#include <QtCore/QStringList>
-#include <QtCore/QUrl>
-#include <QtXml/QDomDocument>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SigmodrTreeModel::SigmodrTreeModel(QObject* parent) :
- QAbstractItemModel(parent),
- m_root(new RootModel)
-{
- connect(m_root, SIGNAL(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)), this, SLOT(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)));
-}
-
-SigmodrTreeModel::~SigmodrTreeModel()
-{
- delete m_root;
-}
-
-QVariant SigmodrTreeModel::data(const QModelIndex& index, int role) const
-{
- if (!index.isValid())
- return QVariant();
- return static_cast<BaseModel*>(index.internalPointer())->data(role);
-}
-
-QModelIndex SigmodrTreeModel::index(int row, int column, const QModelIndex& parent) const
-{
- if ((row < -1) || (column < -1))
- return QModelIndex();
- if (row == -1)
- return createIndex(row, 0, m_root);
- BaseModel* model = getItem(parent);
- if ((model->rowCount() <= row) || (1 <= column))
- return QModelIndex();
- return createIndex(row, 0, model->childItem(row));
-}
-
-QModelIndex SigmodrTreeModel::parent(const QModelIndex& index) const
-{
- if (!index.isValid())
- return QModelIndex();
- BaseModel* parent = static_cast<BaseModel*>(index.internalPointer())->parent();
- if (!parent || (parent == m_root))
- return QModelIndex();
- return createIndex(parent->indexNumber(), 0, parent);
-}
-
-int SigmodrTreeModel::rowCount(const QModelIndex& parent) const
-{
- return getItem(parent)->rowCount();
-}
-
-int SigmodrTreeModel::columnCount(const QModelIndex& parent) const
-{
- Q_UNUSED(parent)
- return 1;
-}
-
-Qt::ItemFlags SigmodrTreeModel::flags(const QModelIndex& index) const
-{
- Qt::ItemFlags flags = QAbstractItemModel::flags(index);
- if (index.isValid())
- flags |= static_cast<BaseModel*>(index.internalPointer())->flags();
- return flags;
-}
-
-bool SigmodrTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
-{
- if (!index.isValid())
- return false;
- emit(layoutAboutToBeChanged());
- bool success = static_cast<BaseModel*>(index.internalPointer())->setData(value, role);
- emit(layoutChanged());
- if (success)
- {
- emit(dataChanged(index, index));
- emit(dirty(findGame(index), true));
- }
- return success;
-}
-
-BaseModel* SigmodrTreeModel::getItem(const QModelIndex& index) const
-{
- if (index.isValid())
- return static_cast<BaseModel*>(index.internalPointer());
- return m_root;
-}
-
-QStringList SigmodrTreeModel::mimeTypes() const
-{
- return QStringList() << "application/x-sigmod+xml" << "text/uri-list";
-}
-
-QMimeData* SigmodrTreeModel::mimeData(const QModelIndexList& indexes) const
-{
- QMimeData *mimeData = new QMimeData;
- if ((indexes.size() == 1) && indexes[0].isValid())
- {
- QDomDocument xml;
- xml.setContent(data(indexes[0], BaseModel::XmlRole).toString());
- mimeData->setData("application/x-sigmod+xml", xml.toByteArray());
- }
- return mimeData;
-}
-
-bool SigmodrTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
-{
- Q_UNUSED(row)
- Q_UNUSED(column)
- if (action == Qt::IgnoreAction)
- return true;
- QString format;
- bool success = false;
- if (data->hasFormat("application/x-sigmod+xml"))
- {
- QByteArray mimeData = data->data("application/x-sigmod+xml");
- emit(layoutAboutToBeChanged());
- success = parent.isValid() ? setData(parent, mimeData, BaseModel::XmlRole) : m_root->setData(mimeData, BaseModel::XmlRole);
- emit(layoutChanged());
- }
- else if (data->hasFormat("text/uri-list"))
- {
- QList<QUrl> urls = data->urls();
- foreach (const QUrl& url, urls)
- {
- emit(layoutAboutToBeChanged());
- success = parent.isValid() ? setData(parent, url.toEncoded(), BaseModel::XmlRole) : m_root->setData(url.toEncoded(), BaseModel::XmlRole);
- emit(layoutChanged());
- }
- }
- if (success)
- emit(dirty(findGame(parent), true));
- return success;
-}
-
-void SigmodrTreeModel::addGame(Game* game)
-{
- m_root->addGame(game);
- reset();
-}
-
-void SigmodrTreeModel::deleteGame(const Game* game)
-{
- m_root->deleteGame(game);
- reset();
-}
-
-const Game* SigmodrTreeModel::findGame(const QModelIndex& index) const
-{
- QModelIndex curIndex = index;
- QModelIndex parIndex = parent(curIndex);
- while (parIndex.isValid())
- {
- curIndex = parIndex;
- parIndex = parent(curIndex);
- }
- return qobject_cast<const Game*>(getItem(curIndex)->object());
-}
-
-void SigmodrTreeModel::rowsChanged(const QList<int>& rows, const BaseModel::Change change)
-{
- QModelIndex curIndex;
- foreach (int row, rows)
- curIndex = index(row, 0, curIndex);
- if (curIndex.isValid())
- {
- switch (change)
- {
- case BaseModel::Addition:
- insertRow(rows.back(), parent(curIndex));
- break;
- case BaseModel::Removal:
- removeRow(rows.back(), parent(curIndex));
- break;
- }
- emit(layoutAboutToBeChanged());
- emit(layoutChanged());
- emit(dataChanged(curIndex, curIndex));
- emit(dirty(findGame(curIndex), true));
- }
- else
- reset();
-}
diff --git a/sigmodr/tree/SigmodrTreeModel.h b/sigmodr/tree/SigmodrTreeModel.h
deleted file mode 100644
index f97fe1fd..00000000
--- a/sigmodr/tree/SigmodrTreeModel.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SIGMODRTREEMODEL
-#define SIGMODRTREE_SIGMODRTREEMODEL
-
-// Sigmodr tree includes
-#include "RootModel.h"
-
-// Qt includes
-#include <QtCore/QAbstractItemModel>
-#include <QtCore/QModelIndex>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
-#include <QtCore/QVariant>
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SigmodrTreeModel : public QAbstractItemModel
-{
- Q_OBJECT
-
- public:
- SigmodrTreeModel(QObject* parent = 0);
- ~SigmodrTreeModel();
-
- QVariant data(const QModelIndex& index, int role) const;
-
- QModelIndex index(int row, int column, const QModelIndex& parent) const;
- QModelIndex parent(const QModelIndex& index) const;
-
- int rowCount(const QModelIndex& parent = QModelIndex()) const;
- int columnCount(const QModelIndex& parent = QModelIndex()) const;
-
- Qt::ItemFlags flags(const QModelIndex& index) const;
-
- bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
-
- QStringList mimeTypes() const;
- QMimeData* mimeData(const QModelIndexList& indexes) const;
- bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
-
- void addGame(Sigmod::Game* game);
- void deleteGame(const Sigmod::Game* game);
- const Sigmod::Game* findGame(const QModelIndex& index) const;
- signals:
- void dirty(const Sigmod::Game* game, const bool dirty);
- protected slots:
- void rowsChanged(const QList<int>& rows, const Sigmodr::Tree::BaseModel::Change change);
- private:
- BaseModel* getItem(const QModelIndex& index) const;
-
- RootModel* m_root;
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SkinGroupModel.cpp b/sigmodr/tree/SkinGroupModel.cpp
deleted file mode 100644
index 48330a92..00000000
--- a/sigmodr/tree/SkinGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SkinGroupModel.h"
-
-// Sigmodr tree includes
-#include "SkinModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Skin.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SkinGroupModel::SkinGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Skins")
-{
- for (int i = 0; i < game->skinCount(); ++i)
- addObject(game->skin(i));
-}
-
-QVariant SkinGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Skin", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool SkinGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Skin"))
- {
- addObject(qobject_cast<Game*>(m_object)->newSkin(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString SkinGroupModel::types() const
-{
- return "Skin";
-}
-
-void SkinGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newSkin();
- if (object->className() == "Skin")
- addChild(new SkinModel(this, qobject_cast<Skin*>(object)));
-}
-
-void SkinGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteSkin(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/SkinGroupModel.h b/sigmodr/tree/SkinGroupModel.h
deleted file mode 100644
index 31f67567..00000000
--- a/sigmodr/tree/SkinGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SKINGROUPMODEL
-#define SIGMODRTREE_SKINGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SkinGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- SkinGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SkinModel.cpp b/sigmodr/tree/SkinModel.cpp
deleted file mode 100644
index 4ef3e183..00000000
--- a/sigmodr/tree/SkinModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SkinModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/SkinUI.h>
-
-// Sigmod includes
-#include <sigmod/Skin.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SkinModel::SkinModel(BaseModel* parent, Skin* skin) :
- ObjectModel(parent, skin)
-{
-}
-
-QVariant SkinModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Skin*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new SkinUI(qobject_cast<Skin*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Skin", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void SkinModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/SkinModel.h b/sigmodr/tree/SkinModel.h
deleted file mode 100644
index 0c2eeb7b..00000000
--- a/sigmodr/tree/SkinModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SKINMODEL
-#define SIGMODRTREE_SKINMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Skin;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SkinModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- SkinModel(BaseModel* parent, Sigmod::Skin* skin);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SoundGroupModel.cpp b/sigmodr/tree/SoundGroupModel.cpp
deleted file mode 100644
index 96e8bba6..00000000
--- a/sigmodr/tree/SoundGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SoundGroupModel.h"
-
-// Sigmodr tree includes
-#include "SoundModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Sound.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SoundGroupModel::SoundGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Sounds")
-{
- for (int i = 0; i < game->soundCount(); ++i)
- addObject(game->sound(i));
-}
-
-QVariant SoundGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Sound", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool SoundGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Sound"))
- {
- addObject(qobject_cast<Game*>(m_object)->newSound(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString SoundGroupModel::types() const
-{
- return "Sound";
-}
-
-void SoundGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newSound();
- if (object->className() == "Sound")
- addChild(new SoundModel(this, qobject_cast<Sound*>(object)));
-}
-
-void SoundGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteSound(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/SoundGroupModel.h b/sigmodr/tree/SoundGroupModel.h
deleted file mode 100644
index b79adfd0..00000000
--- a/sigmodr/tree/SoundGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SOUNDGROUPMODEL
-#define SIGMODRTREE_SOUNDGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SoundGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- SoundGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SoundModel.cpp b/sigmodr/tree/SoundModel.cpp
deleted file mode 100644
index a16055c9..00000000
--- a/sigmodr/tree/SoundModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SoundModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/SoundUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Sound.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SoundModel::SoundModel(BaseModel* parent, Sound* sound) :
- ObjectModel(parent, sound)
-{
-}
-
-QVariant SoundModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Sound*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new SoundUI(qobject_cast<Sound*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Sound", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void SoundModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/SoundModel.h b/sigmodr/tree/SoundModel.h
deleted file mode 100644
index 467a57c7..00000000
--- a/sigmodr/tree/SoundModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SOUNDMODEL
-#define SIGMODRTREE_SOUNDMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Sound;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SoundModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- SoundModel(BaseModel* parent, Sigmod::Sound* nature);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SpeciesGroupModel.cpp b/sigmodr/tree/SpeciesGroupModel.cpp
deleted file mode 100644
index 98201822..00000000
--- a/sigmodr/tree/SpeciesGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SpeciesGroupModel.h"
-
-// Sigmodr tree includes
-#include "SpeciesModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Species.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SpeciesGroupModel::SpeciesGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Species")
-{
- for (int i = 0; i < game->speciesCount(); ++i)
- addObject(game->species(i));
-}
-
-QVariant SpeciesGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Species", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool SpeciesGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Species"))
- {
- addObject(qobject_cast<Game*>(m_object)->newSpecies(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString SpeciesGroupModel::types() const
-{
- return "Species";
-}
-
-void SpeciesGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newSpecies();
- if (object->className() == "Species")
- addChild(new SpeciesModel(this, qobject_cast<Species*>(object)));
-}
-
-void SpeciesGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteSpecies(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/SpeciesGroupModel.h b/sigmodr/tree/SpeciesGroupModel.h
deleted file mode 100644
index 4d1372f1..00000000
--- a/sigmodr/tree/SpeciesGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SPECIESGROUPMODEL
-#define SIGMODRTREE_SPECIESGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SpeciesGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- SpeciesGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SpeciesModel.cpp b/sigmodr/tree/SpeciesModel.cpp
deleted file mode 100644
index 0a45e9a0..00000000
--- a/sigmodr/tree/SpeciesModel.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SpeciesModel.h"
-
-// Sigmodr tree includes
-#include "SpeciesMoveModel.h"
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/SpeciesUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Species.h>
-#include <sigmod/SpeciesMove.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SpeciesModel::SpeciesModel(BaseModel* parent, Species* species) :
- GroupObjectModel(parent, species)
-{
- setupData();
-}
-
-SpeciesModel::~SpeciesModel()
-{
- clearData();
-}
-
-QVariant SpeciesModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Species*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new SpeciesUI(qobject_cast<Species*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Move", this, SLOT(addObject()));
- menu->addSeparator();
- menu->addAction("&Delete Species", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return GroupObjectModel::data(role);
-}
-
-bool SpeciesModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml))
- {
- if (xml.doctype().name() == m_object->className())
- {
- clearData();
- m_object->load(xml.documentElement());
- setupData();
- return true;
- }
- else if (xml.doctype().name() == "SpeciesMove")
- {
- addObject(qobject_cast<Species*>(m_object)->newMove(xml.documentElement()));
- return true;
- }
- }
- }
- }
- return false;
-}
-
-QString SpeciesModel::types() const
-{
- return type().append(QString(";SpeciesMove"));
-}
-
-void SpeciesModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Species*>(m_object)->newMove();
- if (object->className() == "SpeciesMove")
- addChild(new SpeciesMoveModel(this, qobject_cast<SpeciesMove*>(object)));
-}
-
-void SpeciesModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Species*>(m_object)->deleteMove(index);
- removeChild(index);
- }
-}
-
-void SpeciesModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
-
-void SpeciesModel::setupData()
-{
- Species* species = qobject_cast<Species*>(m_object);
- for (int i = 0; i < species->moveCount(); ++i)
- addChild(new SpeciesMoveModel(this, species->move(i)));
-}
diff --git a/sigmodr/tree/SpeciesModel.h b/sigmodr/tree/SpeciesModel.h
deleted file mode 100644
index c2cee120..00000000
--- a/sigmodr/tree/SpeciesModel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SPECIESMODEL
-#define SIGMODRTREE_SPECIESMODEL
-
-// Sigmodr tree includes
-#include "GroupObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Species;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SpeciesModel : public GroupObjectModel
-{
- Q_OBJECT
-
- public:
- SpeciesModel(BaseModel* parent, Sigmod::Species* species);
- ~SpeciesModel();
-
- QVariant data(int role = Qt::DisplayRole) const;
-
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-
- void deleteSelf();
- protected:
- void setupData();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SpeciesMoveModel.cpp b/sigmodr/tree/SpeciesMoveModel.cpp
deleted file mode 100644
index a6ff6138..00000000
--- a/sigmodr/tree/SpeciesMoveModel.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SpeciesMoveModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/SpeciesMoveUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Move.h>
-#include <sigmod/Species.h>
-#include <sigmod/SpeciesMove.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SpeciesMoveModel::SpeciesMoveModel(BaseModel* parent, SpeciesMove* move) :
- ObjectModel(parent, move)
-{
-}
-
-QVariant SpeciesMoveModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- {
- const Move* move = m_object->game()->move(qobject_cast<SpeciesMove*>(m_object)->move());
- if (move)
- return move->name();
- return "";
- }
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new SpeciesMoveUI(qobject_cast<SpeciesMove*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Move", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void SpeciesMoveModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/SpeciesMoveModel.h b/sigmodr/tree/SpeciesMoveModel.h
deleted file mode 100644
index 7b9a898c..00000000
--- a/sigmodr/tree/SpeciesMoveModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SPECIESMOVEMODEL
-#define SIGMODRTREE_SPECIESMOVEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class SpeciesMove;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SpeciesMoveModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- SpeciesMoveModel(BaseModel* parent, Sigmod::SpeciesMove* move);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SpriteGroupModel.cpp b/sigmodr/tree/SpriteGroupModel.cpp
deleted file mode 100644
index 7226acb7..00000000
--- a/sigmodr/tree/SpriteGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SpriteGroupModel.h"
-
-// Sigmodr tree includes
-#include "SpriteModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Sprite.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SpriteGroupModel::SpriteGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Sprites")
-{
- for (int i = 0; i < game->spriteCount(); ++i)
- addObject(game->sprite(i));
-}
-
-QVariant SpriteGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Sprite", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool SpriteGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Sprite"))
- {
- addObject(qobject_cast<Game*>(m_object)->newSprite(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString SpriteGroupModel::types() const
-{
- return "Sprite";
-}
-
-void SpriteGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newSprite();
- if (object->className() == "Sprite")
- addChild(new SpriteModel(this, qobject_cast<Sprite*>(object)));
-}
-
-void SpriteGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteSprite(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/SpriteGroupModel.h b/sigmodr/tree/SpriteGroupModel.h
deleted file mode 100644
index 26f7c7a4..00000000
--- a/sigmodr/tree/SpriteGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SPRITEGROUPMODEL
-#define SIGMODRTREE_SPRITEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SpriteGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- SpriteGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/SpriteModel.cpp b/sigmodr/tree/SpriteModel.cpp
deleted file mode 100644
index 66509029..00000000
--- a/sigmodr/tree/SpriteModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SpriteModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/SpriteUI.h>
-
-// Sigmod includes
-#include <sigmod/Sprite.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-SpriteModel::SpriteModel(BaseModel* parent, Sprite* sprite) :
- ObjectModel(parent, sprite)
-{
-}
-
-QVariant SpriteModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Sprite*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new SpriteUI(qobject_cast<Sprite*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Sprite", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void SpriteModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/SpriteModel.h b/sigmodr/tree/SpriteModel.h
deleted file mode 100644
index 3afa164a..00000000
--- a/sigmodr/tree/SpriteModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_SPRITEMODEL
-#define SIGMODRTREE_SPRITEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Sprite;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT SpriteModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- SpriteModel(BaseModel* parent, Sigmod::Sprite* sprite);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/StatusGroupModel.cpp b/sigmodr/tree/StatusGroupModel.cpp
deleted file mode 100644
index 712f3db3..00000000
--- a/sigmodr/tree/StatusGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "StatusGroupModel.h"
-
-// Sigmodr tree includes
-#include "StatusModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Status.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-StatusGroupModel::StatusGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Status Effects")
-{
- for (int i = 0; i < game->statusCount(); ++i)
- addObject(game->status(i));
-}
-
-QVariant StatusGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Status", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool StatusGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Status"))
- {
- addObject(qobject_cast<Game*>(m_object)->newStatus(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString StatusGroupModel::types() const
-{
- return "Status";
-}
-
-void StatusGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newStatus();
- if (object->className() == "Status")
- addChild(new StatusModel(this, qobject_cast<Status*>(object)));
-}
-
-void StatusGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteStatus(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/StatusGroupModel.h b/sigmodr/tree/StatusGroupModel.h
deleted file mode 100644
index ffbaffca..00000000
--- a/sigmodr/tree/StatusGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_STATUSGROUPMODEL
-#define SIGMODRTREE_STATUSGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT StatusGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- StatusGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/StatusModel.cpp b/sigmodr/tree/StatusModel.cpp
deleted file mode 100644
index 789fa835..00000000
--- a/sigmodr/tree/StatusModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "StatusModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/StatusUI.h>
-
-// Sigmod includes
-#include <sigmod/Status.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-StatusModel::StatusModel(BaseModel* parent, Status* status) :
- ObjectModel(parent, status)
-{
-}
-
-QVariant StatusModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Status*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new StatusUI(qobject_cast<Status*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Status", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void StatusModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/StatusModel.h b/sigmodr/tree/StatusModel.h
deleted file mode 100644
index b50f2ac7..00000000
--- a/sigmodr/tree/StatusModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_STATUSMODEL
-#define SIGMODRTREE_STATUSMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Status;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT StatusModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- StatusModel(BaseModel* parent, Sigmod::Status* status);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/StoreGroupModel.cpp b/sigmodr/tree/StoreGroupModel.cpp
deleted file mode 100644
index 7a262142..00000000
--- a/sigmodr/tree/StoreGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "StoreGroupModel.h"
-
-// Sigmodr tree includes
-#include "StoreModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Store.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-StoreGroupModel::StoreGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Stores")
-{
- for (int i = 0; i < game->storeCount(); ++i)
- addObject(game->store(i));
-}
-
-QVariant StoreGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Store", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool StoreGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Store"))
- {
- addObject(qobject_cast<Game*>(m_object)->newStore(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString StoreGroupModel::types() const
-{
- return "Store";
-}
-
-void StoreGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newStore();
- if (object->className() == "Store")
- addChild(new StoreModel(this, qobject_cast<Store*>(object)));
-}
-
-void StoreGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteStore(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/StoreGroupModel.h b/sigmodr/tree/StoreGroupModel.h
deleted file mode 100644
index 3759bec7..00000000
--- a/sigmodr/tree/StoreGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_STOREGROUPMODEL
-#define SIGMODRTREE_STOREGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT StoreGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- StoreGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/StoreModel.cpp b/sigmodr/tree/StoreModel.cpp
deleted file mode 100644
index 3c0fee8d..00000000
--- a/sigmodr/tree/StoreModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "StoreModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/StoreUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Store.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-StoreModel::StoreModel(BaseModel* parent, Store* store) :
- ObjectModel(parent, store)
-{
-}
-
-QVariant StoreModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Store*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new StoreUI(qobject_cast<Store*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Store", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void StoreModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/StoreModel.h b/sigmodr/tree/StoreModel.h
deleted file mode 100644
index 5f91cfdb..00000000
--- a/sigmodr/tree/StoreModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_STOREMODEL
-#define SIGMODRTREE_STOREMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Store;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT StoreModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- StoreModel(BaseModel* parent, Sigmod::Store* store);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TileGroupModel.cpp b/sigmodr/tree/TileGroupModel.cpp
deleted file mode 100644
index 2d5cc192..00000000
--- a/sigmodr/tree/TileGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TileGroupModel.h"
-
-// Sigmodr tree includes
-#include "TileModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Tile.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-TileGroupModel::TileGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Tiles")
-{
- for (int i = 0; i < game->tileCount(); ++i)
- addObject(game->tile(i));
-}
-
-QVariant TileGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Tile", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool TileGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Tile"))
- {
- addObject(qobject_cast<Game*>(m_object)->newTile(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString TileGroupModel::types() const
-{
- return "Tile";
-}
-
-void TileGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newTile();
- if (object->className() == "Tile")
- addChild(new TileModel(this, qobject_cast<Tile*>(object)));
-}
-
-void TileGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteTile(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/TileGroupModel.h b/sigmodr/tree/TileGroupModel.h
deleted file mode 100644
index a58c9753..00000000
--- a/sigmodr/tree/TileGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TILEGROUPMODEL
-#define SIGMODRTREE_TILEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TileGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- TileGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TileModel.cpp b/sigmodr/tree/TileModel.cpp
deleted file mode 100644
index 591fd07e..00000000
--- a/sigmodr/tree/TileModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TileModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/TileUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Tile.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-TileModel::TileModel(BaseModel* parent, Tile* tile) :
- ObjectModel(parent, tile)
-{
-}
-
-QVariant TileModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Tile*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new TileUI(qobject_cast<Tile*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Tile", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void TileModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/TileModel.h b/sigmodr/tree/TileModel.h
deleted file mode 100644
index 516759c2..00000000
--- a/sigmodr/tree/TileModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TILEMODEL
-#define SIGMODRTREE_TILEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Tile;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TileModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- TileModel(BaseModel* parent, Sigmod::Tile* tile);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TimeGroupModel.cpp b/sigmodr/tree/TimeGroupModel.cpp
deleted file mode 100644
index 6e26b086..00000000
--- a/sigmodr/tree/TimeGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TimeGroupModel.h"
-
-// Sigmodr tree includes
-#include "TimeModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Time.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-TimeGroupModel::TimeGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Times")
-{
- for (int i = 0; i < game->timeCount(); ++i)
- addObject(game->time(i));
-}
-
-QVariant TimeGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Time", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool TimeGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Time"))
- {
- addObject(qobject_cast<Game*>(m_object)->newTime(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString TimeGroupModel::types() const
-{
- return "Time";
-}
-
-void TimeGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newTime();
- if (object->className() == "Time")
- addChild(new TimeModel(this, qobject_cast<Time*>(object)));
-}
-
-void TimeGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteTime(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/TimeGroupModel.h b/sigmodr/tree/TimeGroupModel.h
deleted file mode 100644
index 6832d45c..00000000
--- a/sigmodr/tree/TimeGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TIMEGROUPMODEL
-#define SIGMODRTREE_TIMEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TimeGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- TimeGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TimeModel.cpp b/sigmodr/tree/TimeModel.cpp
deleted file mode 100644
index 37dc2b00..00000000
--- a/sigmodr/tree/TimeModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TimeModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/TimeUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Time.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-TimeModel::TimeModel(BaseModel* parent, Time* time) :
- ObjectModel(parent, time)
-{
-}
-
-QVariant TimeModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Time*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new TimeUI(qobject_cast<Time*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Time", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void TimeModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/TimeModel.h b/sigmodr/tree/TimeModel.h
deleted file mode 100644
index f78f9e15..00000000
--- a/sigmodr/tree/TimeModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TIMEMODEL
-#define SIGMODRTREE_TIMEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Time;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TimeModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- TimeModel(BaseModel* parent, Sigmod::Time* time);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TrainerGroupModel.cpp b/sigmodr/tree/TrainerGroupModel.cpp
deleted file mode 100644
index 5171480c..00000000
--- a/sigmodr/tree/TrainerGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TrainerGroupModel.h"
-
-// Sigmodr tree includes
-#include "TrainerModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Trainer.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-TrainerGroupModel::TrainerGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Trainers")
-{
- for (int i = 0; i < game->trainerCount(); ++i)
- addObject(game->trainer(i));
-}
-
-QVariant TrainerGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Trainer", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool TrainerGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Trainer"))
- {
- addObject(qobject_cast<Game*>(m_object)->newTrainer(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString TrainerGroupModel::types() const
-{
- return "Trainer";
-}
-
-void TrainerGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newTrainer();
- if (object->className() == "Trainer")
- addChild(new TrainerModel(this, qobject_cast<Trainer*>(object)));
-}
-
-void TrainerGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteTrainer(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/TrainerGroupModel.h b/sigmodr/tree/TrainerGroupModel.h
deleted file mode 100644
index fa3bae6d..00000000
--- a/sigmodr/tree/TrainerGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TRAINERGROUPMODEL
-#define SIGMODRTREE_TRAINERGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TrainerGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- TrainerGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TrainerModel.cpp b/sigmodr/tree/TrainerModel.cpp
deleted file mode 100644
index 04d8948f..00000000
--- a/sigmodr/tree/TrainerModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TrainerModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/TrainerUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Trainer.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-TrainerModel::TrainerModel(BaseModel* parent, Trainer* trainer) :
- ObjectModel(parent, trainer)
-{
-}
-
-QVariant TrainerModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Trainer*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new TrainerUI(qobject_cast<Trainer*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Trainer", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void TrainerModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/TrainerModel.h b/sigmodr/tree/TrainerModel.h
deleted file mode 100644
index a8359fee..00000000
--- a/sigmodr/tree/TrainerModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TRAINERMODEL
-#define SIGMODRTREE_TRAINERMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Trainer;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TrainerModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- TrainerModel(BaseModel* parent, Sigmod::Trainer* trainer);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TypeGroupModel.cpp b/sigmodr/tree/TypeGroupModel.cpp
deleted file mode 100644
index d248ff62..00000000
--- a/sigmodr/tree/TypeGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TypeGroupModel.h"
-
-// Sigmodr tree includes
-#include "TypeModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Type.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-TypeGroupModel::TypeGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Types")
-{
- for (int i = 0; i < game->typeCount(); ++i)
- addObject(game->type(i));
-}
-
-QVariant TypeGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Type", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool TypeGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Type"))
- {
- addObject(qobject_cast<Game*>(m_object)->newType(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString TypeGroupModel::types() const
-{
- return "Type";
-}
-
-void TypeGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newType();
- if (object->className() == "Type")
- addChild(new TypeModel(this, qobject_cast<Type*>(object)));
-}
-
-void TypeGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteType(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/TypeGroupModel.h b/sigmodr/tree/TypeGroupModel.h
deleted file mode 100644
index 17f4cffe..00000000
--- a/sigmodr/tree/TypeGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TYPEGROUPMODEL
-#define SIGMODRTREE_TYPEGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TypeGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- TypeGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/TypeModel.cpp b/sigmodr/tree/TypeModel.cpp
deleted file mode 100644
index f38b8ea2..00000000
--- a/sigmodr/tree/TypeModel.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 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 "TypeModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/TypeUI.h>
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Type.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-TypeModel::TypeModel(BaseModel* parent, Type* type) :
- ObjectModel(parent, type)
-{
-}
-
-QVariant TypeModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Type*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new TypeUI(qobject_cast<Type*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Type", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void TypeModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/TypeModel.h b/sigmodr/tree/TypeModel.h
deleted file mode 100644
index f977691e..00000000
--- a/sigmodr/tree/TypeModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_TYPEMODEL
-#define SIGMODRTREE_TYPEMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Type;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT TypeModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- TypeModel(BaseModel* parent, Sigmod::Type* type);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/WeatherGroupModel.cpp b/sigmodr/tree/WeatherGroupModel.cpp
deleted file mode 100644
index eaa021a8..00000000
--- a/sigmodr/tree/WeatherGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "WeatherGroupModel.h"
-
-// Sigmodr tree includes
-#include "WeatherModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Weather.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-WeatherGroupModel::WeatherGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Weathers")
-{
- for (int i = 0; i < game->weatherCount(); ++i)
- addObject(game->weather(i));
-}
-
-QVariant WeatherGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Weather", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool WeatherGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Weather"))
- {
- addObject(qobject_cast<Game*>(m_object)->newWeather(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString WeatherGroupModel::types() const
-{
- return "Weather";
-}
-
-void WeatherGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newWeather();
- if (object->className() == "Weather")
- addChild(new WeatherModel(this, qobject_cast<Weather*>(object)));
-}
-
-void WeatherGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteWeather(index);
- removeChild(index);
- }
-}
diff --git a/sigmodr/tree/WeatherGroupModel.h b/sigmodr/tree/WeatherGroupModel.h
deleted file mode 100644
index 7ce2f808..00000000
--- a/sigmodr/tree/WeatherGroupModel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_WEATHERGROUPMODEL
-#define SIGMODRTREE_WEATHERGROUPMODEL
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Game;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT WeatherGroupModel : public GroupModel
-{
- Q_OBJECT
-
- public:
- WeatherGroupModel(BaseModel* parent, Sigmod::Game* game);
-
- QVariant data(const int role = Qt::DisplayRole) const;
- bool setData(const QVariant& value, int role = Qt::EditRole);
-
- QString types() const;
- public slots:
- void addObject(Sigmod::Object* object = NULL);
- void deleteObject(BaseModel* model);
-};
-}
-}
-
-#endif
diff --git a/sigmodr/tree/WeatherModel.cpp b/sigmodr/tree/WeatherModel.cpp
deleted file mode 100644
index fec5ad84..00000000
--- a/sigmodr/tree/WeatherModel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2009 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 "WeatherModel.h"
-
-// Sigmodr tree includes
-#include "GroupModel.h"
-
-// Sigmodr widget includes
-#include <sigmodr/widgets/WeatherUI.h>
-
-// Sigmod includes
-#include <sigmod/Weather.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Widgets;
-using namespace Sigmodr::Tree;
-
-WeatherModel::WeatherModel(BaseModel* parent, Weather* weather) :
- ObjectModel(parent, weather)
-{
-}
-
-QVariant WeatherModel::data(int role) const
-{
- if (role == Qt::DisplayRole)
- return qobject_cast<Weather*>(m_object)->name();
- else if (role == BaseModel::XmlRole)
- {
- QDomDocument xml(m_object->className());
- xml.appendChild(m_object->save());
- return xml.toString();
- }
- else if (role == BaseModel::WidgetRole)
- {
- QWidget* widget = new WeatherUI(qobject_cast<Weather*>(m_object), NULL);
- return QVariant::fromValue(widget);
- }
- else if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Delete Weather", this, SLOT(deleteSelf()));
- return QVariant::fromValue(menu);
- }
- return ObjectModel::data(role);
-}
-
-void WeatherModel::deleteSelf()
-{
- qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
-}
diff --git a/sigmodr/tree/WeatherModel.h b/sigmodr/tree/WeatherModel.h
deleted file mode 100644
index fca446af..00000000
--- a/sigmodr/tree/WeatherModel.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2009 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 SIGMODRTREE_WEATHERMODEL
-#define SIGMODRTREE_WEATHERMODEL
-
-// Sigmodr tree includes
-#include "ObjectModel.h"
-
-// Forward declarations
-namespace Sigmod
-{
-class Weather;
-}
-
-namespace Sigmodr
-{
-namespace Tree
-{
-class SIGMODRTREE_NO_EXPORT WeatherModel : public ObjectModel
-{
- Q_OBJECT
-
- public:
- WeatherModel(BaseModel* parent, Sigmod::Weather* weather);
-
- QVariant data(int role = Qt::DisplayRole) const;
- public slots:
- void deleteSelf();
-};
-}
-}
-
-#endif