diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-21 04:55:22 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-21 04:55:22 +0000 |
| commit | 66bb55e0feab92784209bdcf1b2ce5387a83100e (patch) | |
| tree | a974b25d02581a31b5a4119668585f4ce6a15ba5 /pokemodr/models/RootModel.cpp | |
| parent | 820bc54980b906042c0b5231147caea2059af7c9 (diff) | |
| download | sigen-66bb55e0feab92784209bdcf1b2ce5387a83100e.tar.gz sigen-66bb55e0feab92784209bdcf1b2ce5387a83100e.tar.xz sigen-66bb55e0feab92784209bdcf1b2ce5387a83100e.zip | |
[FIX] Opening files and saving now works
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@159 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/models/RootModel.cpp')
| -rw-r--r-- | pokemodr/models/RootModel.cpp | 30 |
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 } |
