diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-06-09 00:50:59 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-06-09 00:50:59 +0000 |
| commit | 60a2ed8ee8aa994c83d382af2ec477e171beb950 (patch) | |
| tree | 6fea6867adee00f22b9d775a6dce15ed875d75e6 /pokemodr/models/CoinListModel.cpp | |
| parent | 0737b455ca94351c574aa1a8c83ea30c5b7bc443 (diff) | |
| download | sigen-60a2ed8ee8aa994c83d382af2ec477e171beb950.tar.gz sigen-60a2ed8ee8aa994c83d382af2ec477e171beb950.tar.xz sigen-60a2ed8ee8aa994c83d382af2ec477e171beb950.zip | |
[FIX] All modules now use their own namespace
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@201 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/models/CoinListModel.cpp')
| -rw-r--r-- | pokemodr/models/CoinListModel.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/pokemodr/models/CoinListModel.cpp b/pokemodr/models/CoinListModel.cpp index 5e75e6ed..8f82ccc1 100644 --- a/pokemodr/models/CoinListModel.cpp +++ b/pokemodr/models/CoinListModel.cpp @@ -21,7 +21,7 @@ // Model includes #include "CoinListObjectModel.h" -// PokeModr includes +// Pokemodr includes #include "../CoinListUI.h" // Pokemod includes @@ -34,33 +34,33 @@ // KDE includes #include <KMenu> -CoinListModel::CoinListModel(BaseModel* parent, CoinList* coinList) : +Pokemodr::CoinListModel::CoinListModel(BaseModel* parent, Pokemod::CoinList* coinList) : GroupObjectModel(parent, coinList) { setupData(); } -CoinListModel::~CoinListModel() +Pokemodr::CoinListModel::~CoinListModel() { clearData(); } -QVariant CoinListModel::data(int role) const +QVariant Pokemodr::CoinListModel::data(int role) const { if (role == Qt::DisplayRole) - return static_cast<CoinList*>(m_object)->name(); - else if (role == BaseModel::XmlRole) + return static_cast<Pokemod::CoinList*>(m_object)->name(); + else if (role == Pokemodr::BaseModel::XmlRole) { QDomDocument xml(m_object->className()); xml.appendChild(m_object->save()); return xml.toString(); } - else if (role == BaseModel::WidgetRole) + else if (role == Pokemodr::BaseModel::WidgetRole) { - QWidget* widget = new CoinListUI(static_cast<CoinList*>(m_object), NULL); + QWidget* widget = new CoinListUI(static_cast<Pokemod::CoinList*>(m_object), NULL); return QVariant::fromValue(widget); } - else if (role == BaseModel::ContextMenuRole) + else if (role == Pokemodr::BaseModel::ContextMenuRole) { KMenu* menu = new KMenu; menu->addAction("Add Object", this, SLOT(addObject())); @@ -68,12 +68,12 @@ QVariant CoinListModel::data(int role) const menu->addAction("Delete Coin List", this, SLOT(deleteSelf())); return QVariant::fromValue(static_cast<void*>(menu)); } - return GroupObjectModel::data(role); + return Pokemodr::GroupObjectModel::data(role); } -bool CoinListModel::setData(const QVariant& value, int role) +bool Pokemodr::CoinListModel::setData(const QVariant& value, int role) { - if (role == BaseModel::XmlRole) + if (role == Pokemodr::BaseModel::XmlRole) { if (value.canConvert<QString>()) { @@ -90,7 +90,7 @@ bool CoinListModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "CoinListObject") { - addObject(static_cast<CoinList*>(m_object)->newObject(xml.documentElement())); + addObject(static_cast<Pokemod::CoinList*>(m_object)->newObject(xml.documentElement())); return true; } file.close(); @@ -100,33 +100,33 @@ bool CoinListModel::setData(const QVariant& value, int role) return false; } -void CoinListModel::addObject(Object* object) +void Pokemodr::CoinListModel::addObject(Pokemod::Object* object) { if (!object) - object = static_cast<CoinList*>(m_object)->newObject(); + object = static_cast<Pokemod::CoinList*>(m_object)->newObject(); if (object->className() == "CoinListObject") - m_objects.append(new CoinListObjectModel(this, static_cast<CoinListObject*>(object))); + m_objects.append(new CoinListObjectModel(this, static_cast<Pokemod::CoinListObject*>(object))); } -void CoinListModel::deleteObject(BaseModel* model) +void Pokemodr::CoinListModel::deleteObject(BaseModel* model) { const int index = m_objects.indexOf(model); if (0 <= index) { - static_cast<CoinList*>(m_object)->deleteObject(index); + static_cast<Pokemod::CoinList*>(m_object)->deleteObject(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); } } -void CoinListModel::deleteSelf() +void Pokemodr::CoinListModel::deleteSelf() { // static_cast<GroupModel*>(m_parent)->deleteObject(this); } -void CoinListModel::setupData() +void Pokemodr::CoinListModel::setupData() { - CoinList* coinList = static_cast<CoinList*>(m_object); + Pokemod::CoinList* coinList = static_cast<Pokemod::CoinList*>(m_object); for (int i = 0; i < coinList->objectCount(); ++i) m_objects.append(new CoinListObjectModel(this, coinList->object(i))); } |
