summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/RootModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/models/RootModel.cpp')
-rw-r--r--pokemodr/models/RootModel.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/pokemodr/models/RootModel.cpp b/pokemodr/models/RootModel.cpp
index 7f9616e7..0dcd4f3a 100644
--- a/pokemodr/models/RootModel.cpp
+++ b/pokemodr/models/RootModel.cpp
@@ -27,10 +27,9 @@
// Test code includes
#include <QFile>
-RootModel::RootModel(const QList<QVariant>& pokemods) :
+RootModel::RootModel() :
GroupModel(NULL, NULL)
{
- setupData();
}
RootModel::~RootModel()
@@ -54,19 +53,24 @@ bool RootModel::removeRows(const int position, const int rows)
return true;
}
-void RootModel::setupData()
+void RootModel::addPokemod(Pokemod* pokemod)
{
- setupData(QList<QVariant>());
+ m_objects.append(new PokemodModel(this, pokemod));
}
-void RootModel::setupData(const QList<QVariant>& pokemods)
+void RootModel::deletePokemod(const Pokemod* pokemod)
+{
+ for (int i = 0; i < m_objects.size(); ++i)
+ {
+ if (m_objects[i]->object() == pokemod)
+ {
+ delete m_objects[i];
+ m_objects.removeAt(i);
+ break;
+ }
+ }
+}
+
+void RootModel::setupData()
{
- QFile fin("full.pmod");
- fin.open(QIODevice::ReadOnly);
- QDomDocument xml;
- xml.setContent(&fin);
- fin.close();
- Pokemod* full = new Pokemod(xml.documentElement());
- m_objects.append(new PokemodModel(this, full));
- // TODO: make sub models from data
}