diff options
Diffstat (limited to 'sigmodr/tree')
66 files changed, 372 insertions, 306 deletions
diff --git a/sigmodr/tree/AbilityGroupModel.cpp b/sigmodr/tree/AbilityGroupModel.cpp index 8f27683d..19976295 100644 --- a/sigmodr/tree/AbilityGroupModel.cpp +++ b/sigmodr/tree/AbilityGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -AbilityGroupModel::AbilityGroupModel(BaseModel* parent, Sigmod::Game* game) : +AbilityGroupModel::AbilityGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Abilities") { for (int i = 0; i < game->abilityCount(); ++i) @@ -58,7 +59,7 @@ bool AbilityGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Ability")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newAbility(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newAbility(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString AbilityGroupModel::types() const return "Ability"; } -void AbilityGroupModel::addObject(Sigmod::Object* object) +void AbilityGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newAbility(); + object = qobject_cast<Game*>(m_object)->newAbility(); if (object->className() == "Ability") - addChild(new AbilityModel(this, qobject_cast<Sigmod::Ability*>(object))); + addChild(new AbilityModel(this, qobject_cast<Ability*>(object))); } void AbilityGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void AbilityGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteAbility(index); + qobject_cast<Game*>(m_object)->deleteAbility(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/AbilityModel.cpp b/sigmodr/tree/AbilityModel.cpp index c28824c6..ff5aeafb 100644 --- a/sigmodr/tree/AbilityModel.cpp +++ b/sigmodr/tree/AbilityModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -AbilityModel::AbilityModel(BaseModel* parent, Sigmod::Ability* ability) : +AbilityModel::AbilityModel(BaseModel* parent, Ability* ability) : ObjectModel(parent, ability) { } @@ -41,7 +42,7 @@ AbilityModel::AbilityModel(BaseModel* parent, Sigmod::Ability* ability) : QVariant AbilityModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Ability*>(m_object)->name(); + return qobject_cast<Ability*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant AbilityModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new AbilityUI(qobject_cast<Sigmod::Ability*>(m_object), NULL); + QWidget* widget = new AbilityUI(qobject_cast<Ability*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/AuthorGroupModel.cpp b/sigmodr/tree/AuthorGroupModel.cpp index e2cbf172..edf44d64 100644 --- a/sigmodr/tree/AuthorGroupModel.cpp +++ b/sigmodr/tree/AuthorGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -AuthorGroupModel::AuthorGroupModel(BaseModel* parent, Sigmod::Game* game) : +AuthorGroupModel::AuthorGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Authors") { for (int i = 0; i < game->authorCount(); ++i) @@ -58,7 +59,7 @@ bool AuthorGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Author")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newAuthor(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newAuthor(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString AuthorGroupModel::types() const return "Author"; } -void AuthorGroupModel::addObject(Sigmod::Object* object) +void AuthorGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newAuthor(); + object = qobject_cast<Game*>(m_object)->newAuthor(); if (object->className() == "Author") - addChild(new AuthorModel(this, qobject_cast<Sigmod::Author*>(object))); + addChild(new AuthorModel(this, qobject_cast<Author*>(object))); } void AuthorGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void AuthorGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteAuthor(index); + qobject_cast<Game*>(m_object)->deleteAuthor(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/AuthorModel.cpp b/sigmodr/tree/AuthorModel.cpp index 14d7d9df..5d379649 100644 --- a/sigmodr/tree/AuthorModel.cpp +++ b/sigmodr/tree/AuthorModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -AuthorModel::AuthorModel(BaseModel* parent, Sigmod::Author* author) : +AuthorModel::AuthorModel(BaseModel* parent, Author* author) : ObjectModel(parent, author) { } @@ -41,7 +42,7 @@ AuthorModel::AuthorModel(BaseModel* parent, Sigmod::Author* author) : QVariant AuthorModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Author*>(m_object)->name(); + return qobject_cast<Author*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant AuthorModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new AuthorUI(qobject_cast<Sigmod::Author*>(m_object), NULL); + QWidget* widget = new AuthorUI(qobject_cast<Author*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/BadgeGroupModel.cpp b/sigmodr/tree/BadgeGroupModel.cpp index 61162f37..9d473fff 100644 --- a/sigmodr/tree/BadgeGroupModel.cpp +++ b/sigmodr/tree/BadgeGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -BadgeGroupModel::BadgeGroupModel(BaseModel* parent, Sigmod::Game* game) : +BadgeGroupModel::BadgeGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Badges") { for (int i = 0; i < game->badgeCount(); ++i) @@ -58,7 +59,7 @@ bool BadgeGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Badge")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newBadge(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newBadge(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString BadgeGroupModel::types() const return "Badge"; } -void BadgeGroupModel::addObject(Sigmod::Object* object) +void BadgeGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newBadge(); + object = qobject_cast<Game*>(m_object)->newBadge(); if (object->className() == "Badge") - addChild(new BadgeModel(this, qobject_cast<Sigmod::Badge*>(object))); + addChild(new BadgeModel(this, qobject_cast<Badge*>(object))); } void BadgeGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void BadgeGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteBadge(index); + qobject_cast<Game*>(m_object)->deleteBadge(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/BadgeModel.cpp b/sigmodr/tree/BadgeModel.cpp index 364c3c7d..7b4c6bf5 100644 --- a/sigmodr/tree/BadgeModel.cpp +++ b/sigmodr/tree/BadgeModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -BadgeModel::BadgeModel(BaseModel* parent, Sigmod::Badge* badge) : +BadgeModel::BadgeModel(BaseModel* parent, Badge* badge) : ObjectModel(parent, badge) { } @@ -41,7 +42,7 @@ BadgeModel::BadgeModel(BaseModel* parent, Sigmod::Badge* badge) : QVariant BadgeModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Badge*>(m_object)->name(); + return qobject_cast<Badge*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant BadgeModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new BadgeUI(qobject_cast<Sigmod::Badge*>(m_object), NULL); + QWidget* widget = new BadgeUI(qobject_cast<Badge*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/BaseModel.cpp b/sigmodr/tree/BaseModel.cpp index 92f530fe..18688d04 100644 --- a/sigmodr/tree/BaseModel.cpp +++ b/sigmodr/tree/BaseModel.cpp @@ -31,6 +31,7 @@ #include <QtCore/QFile> #include <QtXml/QDomDocument> +using namespace Sigmod; using namespace Sigmodr::Tree; const int BaseModel::TypeRole = Qt::UserRole; @@ -39,7 +40,7 @@ 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, Sigmod::Object* object, const QString& name) : +BaseModel::BaseModel(BaseModel* parent, Object* object, const QString& name) : m_parent(parent), m_object(object), m_name(name) @@ -76,7 +77,7 @@ QString BaseModel::type() const return ""; } -const Sigmod::Object* BaseModel::object() const +const Object* BaseModel::object() const { return m_object; } diff --git a/sigmodr/tree/BaseObjectModel.cpp b/sigmodr/tree/BaseObjectModel.cpp index 673aa2cc..792ce098 100644 --- a/sigmodr/tree/BaseObjectModel.cpp +++ b/sigmodr/tree/BaseObjectModel.cpp @@ -21,9 +21,10 @@ // Sigmod includes #include <sigmod/Object.h> +using namespace Sigmod; using namespace Sigmodr::Tree; -BaseObjectModel::BaseObjectModel(BaseModel* parent, Sigmod::Object* object) : +BaseObjectModel::BaseObjectModel(BaseModel* parent, Object* object) : BaseModel(parent, object, "") { } diff --git a/sigmodr/tree/CoinListGroupModel.cpp b/sigmodr/tree/CoinListGroupModel.cpp index ce8e86d9..f93b5c83 100644 --- a/sigmodr/tree/CoinListGroupModel.cpp +++ b/sigmodr/tree/CoinListGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -CoinListGroupModel::CoinListGroupModel(BaseModel* parent, Sigmod::Game* game) : +CoinListGroupModel::CoinListGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Coin Lists") { for (int i = 0; i < game->coinListCount(); ++i) @@ -58,7 +59,7 @@ bool CoinListGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "CoinList")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newCoinList(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newCoinList(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString CoinListGroupModel::types() const return "CoinList"; } -void CoinListGroupModel::addObject(Sigmod::Object* object) +void CoinListGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newCoinList(); + object = qobject_cast<Game*>(m_object)->newCoinList(); if (object->className() == "CoinList") - addChild(new CoinListModel(this, qobject_cast<Sigmod::CoinList*>(object))); + addChild(new CoinListModel(this, qobject_cast<CoinList*>(object))); } void CoinListGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void CoinListGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteCoinList(index); + qobject_cast<Game*>(m_object)->deleteCoinList(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/CoinListItemModel.cpp b/sigmodr/tree/CoinListItemModel.cpp index 4be11784..eb342acb 100644 --- a/sigmodr/tree/CoinListItemModel.cpp +++ b/sigmodr/tree/CoinListItemModel.cpp @@ -34,10 +34,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -CoinListItemModel::CoinListItemModel(BaseModel* parent, Sigmod::CoinListItem* item) : +CoinListItemModel::CoinListItemModel(BaseModel* parent, CoinListItem* item) : ObjectModel(parent, item) { } @@ -46,16 +47,16 @@ QVariant CoinListItemModel::data(int role) const { if (role == Qt::DisplayRole) { - Sigmod::CoinListItem* item = qobject_cast<Sigmod::CoinListItem*>(m_object); - if (item->type() == Sigmod::CoinListItem::Item) + CoinListItem* item = qobject_cast<CoinListItem*>(m_object); + if (item->type() == CoinListItem::Item) { - const Sigmod::Item* _item = m_object->game()->itemById(item->object()); + const Item* _item = m_object->game()->itemById(item->object()); if (_item) return _item->name(); } - else if (item->type() == Sigmod::CoinListItem::Species) + else if (item->type() == CoinListItem::Species) { - const Sigmod::Species* species = m_object->game()->speciesById(item->object()); + const Species* species = m_object->game()->speciesById(item->object()); if (species) return species->name(); } @@ -69,7 +70,7 @@ QVariant CoinListItemModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new CoinListItemUI(qobject_cast<Sigmod::CoinListItem*>(m_object), NULL); + QWidget* widget = new CoinListItemUI(qobject_cast<CoinListItem*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/CoinListModel.cpp b/sigmodr/tree/CoinListModel.cpp index a3062314..3b6172f2 100644 --- a/sigmodr/tree/CoinListModel.cpp +++ b/sigmodr/tree/CoinListModel.cpp @@ -32,10 +32,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -CoinListModel::CoinListModel(BaseModel* parent, Sigmod::CoinList* coinList) : +CoinListModel::CoinListModel(BaseModel* parent, CoinList* coinList) : GroupObjectModel(parent, coinList) { setupData(); @@ -49,7 +50,7 @@ CoinListModel::~CoinListModel() QVariant CoinListModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::CoinList*>(m_object)->name(); + return qobject_cast<CoinList*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -58,7 +59,7 @@ QVariant CoinListModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new CoinListUI(qobject_cast<Sigmod::CoinList*>(m_object), NULL); + QWidget* widget = new CoinListUI(qobject_cast<CoinList*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -91,7 +92,7 @@ bool CoinListModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "CoinListItem") { - addObject(qobject_cast<Sigmod::CoinList*>(m_object)->newItem(xml.documentElement())); + addObject(qobject_cast<CoinList*>(m_object)->newItem(xml.documentElement())); return true; } } @@ -105,12 +106,12 @@ QString CoinListModel::types() const return type().append(QString(";CoinListItem")); } -void CoinListModel::addObject(Sigmod::Object* object) +void CoinListModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::CoinList*>(m_object)->newItem(); + object = qobject_cast<CoinList*>(m_object)->newItem(); if (object->className() == "CoinListItem") - addChild(new CoinListItemModel(this, qobject_cast<Sigmod::CoinListItem*>(object))); + addChild(new CoinListItemModel(this, qobject_cast<CoinListItem*>(object))); } void CoinListModel::deleteObject(BaseModel* model) @@ -118,7 +119,7 @@ void CoinListModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::CoinList*>(m_object)->deleteItem(index); + qobject_cast<CoinList*>(m_object)->deleteItem(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -132,7 +133,7 @@ void CoinListModel::deleteSelf() void CoinListModel::setupData() { - Sigmod::CoinList* coinList = qobject_cast<Sigmod::CoinList*>(m_object); + 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/EggGroupGroupModel.cpp b/sigmodr/tree/EggGroupGroupModel.cpp index f6182ba6..26f694b1 100644 --- a/sigmodr/tree/EggGroupGroupModel.cpp +++ b/sigmodr/tree/EggGroupGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -EggGroupGroupModel::EggGroupGroupModel(BaseModel* parent, Sigmod::Game* game) : +EggGroupGroupModel::EggGroupGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Egg Groups") { for (int i = 0; i < game->eggGroupCount(); ++i) @@ -58,7 +59,7 @@ bool EggGroupGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "EggGroup")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newEggGroup(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newEggGroup(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString EggGroupGroupModel::types() const return "EggGroup"; } -void EggGroupGroupModel::addObject(Sigmod::Object* object) +void EggGroupGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newEggGroup(); + object = qobject_cast<Game*>(m_object)->newEggGroup(); if (object->className() == "EggGroup") - addChild(new EggGroupModel(this, qobject_cast<Sigmod::EggGroup*>(object))); + addChild(new EggGroupModel(this, qobject_cast<EggGroup*>(object))); } void EggGroupGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void EggGroupGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteEggGroup(index); + qobject_cast<Game*>(m_object)->deleteEggGroup(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/EggGroupModel.cpp b/sigmodr/tree/EggGroupModel.cpp index c673c205..2ab8f0b9 100644 --- a/sigmodr/tree/EggGroupModel.cpp +++ b/sigmodr/tree/EggGroupModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -EggGroupModel::EggGroupModel(BaseModel* parent, Sigmod::EggGroup* eggGroup) : +EggGroupModel::EggGroupModel(BaseModel* parent, EggGroup* eggGroup) : ObjectModel(parent, eggGroup) { } @@ -41,7 +42,7 @@ EggGroupModel::EggGroupModel(BaseModel* parent, Sigmod::EggGroup* eggGroup) : QVariant EggGroupModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::EggGroup*>(m_object)->name(); + return qobject_cast<EggGroup*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant EggGroupModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new EggGroupUI(qobject_cast<Sigmod::EggGroup*>(m_object), NULL); + QWidget* widget = new EggGroupUI(qobject_cast<EggGroup*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/GameModel.cpp b/sigmodr/tree/GameModel.cpp index 196ab87b..36b89d82 100644 --- a/sigmodr/tree/GameModel.cpp +++ b/sigmodr/tree/GameModel.cpp @@ -52,10 +52,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -GameModel::GameModel(BaseModel* parent, Sigmod::Game* game) : +GameModel::GameModel(BaseModel* parent, Game* game) : GroupObjectModel(parent, game) { setupData(); @@ -69,7 +70,7 @@ GameModel::~GameModel() QVariant GameModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Game*>(m_object)->title(); + return qobject_cast<Game*>(m_object)->title(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -78,7 +79,7 @@ QVariant GameModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new GameUI(qobject_cast<Sigmod::Game*>(m_object), NULL); + QWidget* widget = new GameUI(qobject_cast<Game*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -123,7 +124,7 @@ 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(Sigmod::Object* object) +void GameModel::addObject(Object* object) { Q_UNUSED(object) } @@ -139,7 +140,7 @@ void GameModel::deleteSelf() void GameModel::setupData() { - Sigmod::Game* game = qobject_cast<Sigmod::Game*>(m_object); + Game* game = qobject_cast<Game*>(m_object); addChild(new RulesModel(this, game->rules())); addChild(new AbilityGroupModel(this, game)); addChild(new AuthorGroupModel(this, game)); diff --git a/sigmodr/tree/GlobalScriptGroupModel.cpp b/sigmodr/tree/GlobalScriptGroupModel.cpp index 33640055..3f03427a 100644 --- a/sigmodr/tree/GlobalScriptGroupModel.cpp +++ b/sigmodr/tree/GlobalScriptGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -GlobalScriptGroupModel::GlobalScriptGroupModel(BaseModel* parent, Sigmod::Game* game) : +GlobalScriptGroupModel::GlobalScriptGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Global Scripts") { for (int i = 0; i < game->globalScriptCount(); ++i) @@ -58,7 +59,7 @@ bool GlobalScriptGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "GlobalScript")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newGlobalScript(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newGlobalScript(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString GlobalScriptGroupModel::types() const return "GlobalScript"; } -void GlobalScriptGroupModel::addObject(Sigmod::Object* object) +void GlobalScriptGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newGlobalScript(); + object = qobject_cast<Game*>(m_object)->newGlobalScript(); if (object->className() == "GlobalScript") - addChild(new GlobalScriptModel(this, qobject_cast<Sigmod::GlobalScript*>(object))); + addChild(new GlobalScriptModel(this, qobject_cast<GlobalScript*>(object))); } void GlobalScriptGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void GlobalScriptGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteGlobalScript(index); + qobject_cast<Game*>(m_object)->deleteGlobalScript(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/GlobalScriptModel.cpp b/sigmodr/tree/GlobalScriptModel.cpp index acf68c62..b82f25fe 100644 --- a/sigmodr/tree/GlobalScriptModel.cpp +++ b/sigmodr/tree/GlobalScriptModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -GlobalScriptModel::GlobalScriptModel(BaseModel* parent, Sigmod::GlobalScript* globalScript) : +GlobalScriptModel::GlobalScriptModel(BaseModel* parent, GlobalScript* globalScript) : ObjectModel(parent, globalScript) { } @@ -41,7 +42,7 @@ GlobalScriptModel::GlobalScriptModel(BaseModel* parent, Sigmod::GlobalScript* gl QVariant GlobalScriptModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::GlobalScript*>(m_object)->name(); + return qobject_cast<GlobalScript*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant GlobalScriptModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new GlobalScriptUI(qobject_cast<Sigmod::GlobalScript*>(m_object), NULL); + QWidget* widget = new GlobalScriptUI(qobject_cast<GlobalScript*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/GroupModel.cpp b/sigmodr/tree/GroupModel.cpp index 043336b2..c339f9c7 100644 --- a/sigmodr/tree/GroupModel.cpp +++ b/sigmodr/tree/GroupModel.cpp @@ -21,9 +21,10 @@ // Sigmodr tree includes #include "BaseObjectModel.h" +using namespace Sigmod; using namespace Sigmodr::Tree; -GroupModel::GroupModel(BaseModel* parent, Sigmod::Object* object, const QString& name) : +GroupModel::GroupModel(BaseModel* parent, Object* object, const QString& name) : BaseModel(parent, object, name), Grouping() { diff --git a/sigmodr/tree/GroupObjectModel.cpp b/sigmodr/tree/GroupObjectModel.cpp index 03ce83b7..982a4885 100644 --- a/sigmodr/tree/GroupObjectModel.cpp +++ b/sigmodr/tree/GroupObjectModel.cpp @@ -18,9 +18,10 @@ // Header include #include "GroupObjectModel.h" +using namespace Sigmod; using namespace Sigmodr::Tree; -GroupObjectModel::GroupObjectModel(BaseModel* parent, Sigmod::Object* object) : +GroupObjectModel::GroupObjectModel(BaseModel* parent, Object* object) : BaseObjectModel(parent, object), Grouping() { diff --git a/sigmodr/tree/ItemGroupModel.cpp b/sigmodr/tree/ItemGroupModel.cpp index 9b6d2bc8..3f0b5197 100644 --- a/sigmodr/tree/ItemGroupModel.cpp +++ b/sigmodr/tree/ItemGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -ItemGroupModel::ItemGroupModel(BaseModel* parent, Sigmod::Game* game) : +ItemGroupModel::ItemGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Items") { for (int i = 0; i < game->itemCount(); ++i) @@ -58,7 +59,7 @@ bool ItemGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Item")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newItem(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newItem(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString ItemGroupModel::types() const return "Item"; } -void ItemGroupModel::addObject(Sigmod::Object* object) +void ItemGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newItem(); + object = qobject_cast<Game*>(m_object)->newItem(); if (object->className() == "Item") - addChild(new ItemModel(this, qobject_cast<Sigmod::Item*>(object))); + addChild(new ItemModel(this, qobject_cast<Item*>(object))); } void ItemGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void ItemGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteItem(index); + qobject_cast<Game*>(m_object)->deleteItem(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/ItemModel.cpp b/sigmodr/tree/ItemModel.cpp index eb9402d3..11343a91 100644 --- a/sigmodr/tree/ItemModel.cpp +++ b/sigmodr/tree/ItemModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -ItemModel::ItemModel(BaseModel* parent, Sigmod::Item* item) : +ItemModel::ItemModel(BaseModel* parent, Item* item) : ObjectModel(parent, item) { } @@ -41,7 +42,7 @@ ItemModel::ItemModel(BaseModel* parent, Sigmod::Item* item) : QVariant ItemModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Item*>(m_object)->name(); + return qobject_cast<Item*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant ItemModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new ItemUI(qobject_cast<Sigmod::Item*>(m_object), NULL); + QWidget* widget = new ItemUI(qobject_cast<Item*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/ItemTypeGroupModel.cpp b/sigmodr/tree/ItemTypeGroupModel.cpp index 617cf726..3d625132 100644 --- a/sigmodr/tree/ItemTypeGroupModel.cpp +++ b/sigmodr/tree/ItemTypeGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -ItemTypeGroupModel::ItemTypeGroupModel(BaseModel* parent, Sigmod::Game* game) : +ItemTypeGroupModel::ItemTypeGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Item Types") { for (int i = 0; i < game->itemTypeCount(); ++i) @@ -58,7 +59,7 @@ bool ItemTypeGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "ItemType")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newItemType(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newItemType(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString ItemTypeGroupModel::types() const return "ItemType"; } -void ItemTypeGroupModel::addObject(Sigmod::Object* object) +void ItemTypeGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newItemType(); + object = qobject_cast<Game*>(m_object)->newItemType(); if (object->className() == "ItemType") - addChild(new ItemTypeModel(this, qobject_cast<Sigmod::ItemType*>(object))); + addChild(new ItemTypeModel(this, qobject_cast<ItemType*>(object))); } void ItemTypeGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void ItemTypeGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteItemType(index); + qobject_cast<Game*>(m_object)->deleteItemType(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/ItemTypeModel.cpp b/sigmodr/tree/ItemTypeModel.cpp index 26d6299d..d5b4abcc 100644 --- a/sigmodr/tree/ItemTypeModel.cpp +++ b/sigmodr/tree/ItemTypeModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -ItemTypeModel::ItemTypeModel(BaseModel* parent, Sigmod::ItemType* itemType) : +ItemTypeModel::ItemTypeModel(BaseModel* parent, ItemType* itemType) : ObjectModel(parent, itemType) { } @@ -41,7 +42,7 @@ ItemTypeModel::ItemTypeModel(BaseModel* parent, Sigmod::ItemType* itemType) : QVariant ItemTypeModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::ItemType*>(m_object)->name(); + return qobject_cast<ItemType*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant ItemTypeModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new ItemTypeUI(qobject_cast<Sigmod::ItemType*>(m_object), NULL); + QWidget* widget = new ItemTypeUI(qobject_cast<ItemType*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/MapEffectGroupModel.cpp b/sigmodr/tree/MapEffectGroupModel.cpp index a6f1b347..67d29e5b 100644 --- a/sigmodr/tree/MapEffectGroupModel.cpp +++ b/sigmodr/tree/MapEffectGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MapEffectGroupModel::MapEffectGroupModel(BaseModel* parent, Sigmod::Map* map) : +MapEffectGroupModel::MapEffectGroupModel(BaseModel* parent, Map* map) : GroupModel(parent, map, "Effects") { for (int i = 0; i < map->effectCount(); ++i) @@ -58,7 +59,7 @@ bool MapEffectGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "MapEffect")) { - addObject(qobject_cast<Sigmod::Map*>(m_object)->newEffect(xml.documentElement())); + addObject(qobject_cast<Map*>(m_object)->newEffect(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MapEffectGroupModel::types() const return "MapEffect"; } -void MapEffectGroupModel::addObject(Sigmod::Object* object) +void MapEffectGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Map*>(m_object)->newEffect(); + object = qobject_cast<Map*>(m_object)->newEffect(); if (object->className() == "MapEffect") - addChild(new MapEffectModel(this, qobject_cast<Sigmod::MapEffect*>(object))); + addChild(new MapEffectModel(this, qobject_cast<MapEffect*>(object))); } void MapEffectGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MapEffectGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Map*>(m_object)->deleteEffect(index); + qobject_cast<Map*>(m_object)->deleteEffect(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MapEffectModel.cpp b/sigmodr/tree/MapEffectModel.cpp index 02ca7930..61094097 100644 --- a/sigmodr/tree/MapEffectModel.cpp +++ b/sigmodr/tree/MapEffectModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapEffectModel::MapEffectModel(BaseModel* parent, Sigmod::MapEffect* effect) : +MapEffectModel::MapEffectModel(BaseModel* parent, MapEffect* effect) : ObjectModel(parent, effect) { } @@ -42,7 +43,7 @@ MapEffectModel::MapEffectModel(BaseModel* parent, Sigmod::MapEffect* effect) : QVariant MapEffectModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::MapEffect*>(m_object)->name(); + return qobject_cast<MapEffect*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant MapEffectModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapEffectUI(qobject_cast<Sigmod::MapEffect*>(m_object), NULL); + QWidget* widget = new MapEffectUI(qobject_cast<MapEffect*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/MapGroupModel.cpp b/sigmodr/tree/MapGroupModel.cpp index 059e6fb8..1308ba95 100644 --- a/sigmodr/tree/MapGroupModel.cpp +++ b/sigmodr/tree/MapGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MapGroupModel::MapGroupModel(BaseModel* parent, Sigmod::Game* game) : +MapGroupModel::MapGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Maps") { for (int i = 0; i < game->mapCount(); ++i) @@ -58,7 +59,7 @@ bool MapGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Map")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newMap(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newMap(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MapGroupModel::types() const return "Map"; } -void MapGroupModel::addObject(Sigmod::Object* object) +void MapGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newMap(); + object = qobject_cast<Game*>(m_object)->newMap(); if (object->className() == "Map") - addChild(new MapModel(this, qobject_cast<Sigmod::Map*>(object))); + addChild(new MapModel(this, qobject_cast<Map*>(object))); } void MapGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MapGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteMap(index); + qobject_cast<Game*>(m_object)->deleteMap(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MapModel.cpp b/sigmodr/tree/MapModel.cpp index 2a328007..48ef143c 100644 --- a/sigmodr/tree/MapModel.cpp +++ b/sigmodr/tree/MapModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapModel::MapModel(BaseModel* parent, Sigmod::Map* map) : +MapModel::MapModel(BaseModel* parent, Map* map) : GroupObjectModel(parent, map) { setupData(); @@ -50,7 +51,7 @@ MapModel::~MapModel() QVariant MapModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Map*>(m_object)->name(); + return qobject_cast<Map*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -59,7 +60,7 @@ QVariant MapModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapUI(qobject_cast<Sigmod::Map*>(m_object), NULL); + QWidget* widget = new MapUI(qobject_cast<Map*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -105,7 +106,7 @@ QString MapModel::types() const return type().append(QString(";MapEffect;MapTrainer;MapWarp;MapWildList")); } -void MapModel::addObject(Sigmod::Object* object) +void MapModel::addObject(Object* object) { Q_UNUSED(object) } @@ -122,7 +123,7 @@ void MapModel::deleteSelf() void MapModel::setupData() { - Sigmod::Map* map = qobject_cast<Sigmod::Map*>(m_object); + Map* map = qobject_cast<Map*>(m_object); addChild(new MapEffectGroupModel(this, map)); addChild(new MapTrainerGroupModel(this, map)); addChild(new MapWarpGroupModel(this, map)); diff --git a/sigmodr/tree/MapTrainerGroupModel.cpp b/sigmodr/tree/MapTrainerGroupModel.cpp index 2355bf79..0eb95bfe 100644 --- a/sigmodr/tree/MapTrainerGroupModel.cpp +++ b/sigmodr/tree/MapTrainerGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MapTrainerGroupModel::MapTrainerGroupModel(BaseModel* parent, Sigmod::Map* map) : +MapTrainerGroupModel::MapTrainerGroupModel(BaseModel* parent, Map* map) : GroupModel(parent, map, "Trainers") { for (int i = 0; i < map->trainerCount(); ++i) @@ -58,7 +59,7 @@ bool MapTrainerGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "MapTrainer")) { - addObject(qobject_cast<Sigmod::Map*>(m_object)->newTrainer(xml.documentElement())); + addObject(qobject_cast<Map*>(m_object)->newTrainer(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MapTrainerGroupModel::types() const return "MapTrainer"; } -void MapTrainerGroupModel::addObject(Sigmod::Object* object) +void MapTrainerGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Map*>(m_object)->newTrainer(); + object = qobject_cast<Map*>(m_object)->newTrainer(); if (object->className() == "MapTrainer") - addChild(new MapTrainerModel(this, qobject_cast<Sigmod::MapTrainer*>(object))); + addChild(new MapTrainerModel(this, qobject_cast<MapTrainer*>(object))); } void MapTrainerGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MapTrainerGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Map*>(m_object)->deleteTrainer(index); + qobject_cast<Map*>(m_object)->deleteTrainer(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MapTrainerModel.cpp b/sigmodr/tree/MapTrainerModel.cpp index 3154cfe5..d833b3af 100644 --- a/sigmodr/tree/MapTrainerModel.cpp +++ b/sigmodr/tree/MapTrainerModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapTrainerModel::MapTrainerModel(BaseModel* parent, Sigmod::MapTrainer* trainer) : +MapTrainerModel::MapTrainerModel(BaseModel* parent, MapTrainer* trainer) : GroupObjectModel(parent, trainer) { setupData(); @@ -50,7 +51,7 @@ MapTrainerModel::~MapTrainerModel() QVariant MapTrainerModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::MapTrainer*>(m_object)->name(); + return qobject_cast<MapTrainer*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -59,7 +60,7 @@ QVariant MapTrainerModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapTrainerUI(qobject_cast<Sigmod::MapTrainer*>(m_object), NULL); + QWidget* widget = new MapTrainerUI(qobject_cast<MapTrainer*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -92,7 +93,7 @@ bool MapTrainerModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "MapTrainerTeamMember") { - addObject(qobject_cast<Sigmod::MapTrainer*>(m_object)->newTeamMember(xml.documentElement())); + addObject(qobject_cast<MapTrainer*>(m_object)->newTeamMember(xml.documentElement())); return true; } } @@ -106,12 +107,12 @@ QString MapTrainerModel::types() const return type().append(QString(";MapTrainerTeamMember")); } -void MapTrainerModel::addObject(Sigmod::Object* object) +void MapTrainerModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::MapTrainer*>(m_object)->newTeamMember(); + object = qobject_cast<MapTrainer*>(m_object)->newTeamMember(); if (object->className() == "MapTrainerTeamMember") - addChild(new MapTrainerTeamMemberModel(this, qobject_cast<Sigmod::MapTrainerTeamMember*>(object))); + addChild(new MapTrainerTeamMemberModel(this, qobject_cast<MapTrainerTeamMember*>(object))); } void MapTrainerModel::deleteObject(BaseModel* model) @@ -119,7 +120,7 @@ void MapTrainerModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::MapTrainer*>(m_object)->deleteTeamMember(index); + qobject_cast<MapTrainer*>(m_object)->deleteTeamMember(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -133,7 +134,7 @@ void MapTrainerModel::deleteSelf() void MapTrainerModel::setupData() { - Sigmod::MapTrainer* trainer = qobject_cast<Sigmod::MapTrainer*>(m_object); + 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/MapTrainerTeamMemberModel.cpp b/sigmodr/tree/MapTrainerTeamMemberModel.cpp index 2e49a91c..e6c20c96 100644 --- a/sigmodr/tree/MapTrainerTeamMemberModel.cpp +++ b/sigmodr/tree/MapTrainerTeamMemberModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapTrainerTeamMemberModel::MapTrainerTeamMemberModel(BaseModel* parent, Sigmod::MapTrainerTeamMember* teamMember) : +MapTrainerTeamMemberModel::MapTrainerTeamMemberModel(BaseModel* parent, MapTrainerTeamMember* teamMember) : ObjectModel(parent, teamMember) { } @@ -45,7 +46,7 @@ QVariant MapTrainerTeamMemberModel::data(int role) const { if (role == Qt::DisplayRole) { - const Sigmod::Species* species = m_object->game()->speciesById(qobject_cast<Sigmod::MapTrainerTeamMember*>(m_object)->species()); + const Species* species = m_object->game()->speciesById(qobject_cast<MapTrainerTeamMember*>(m_object)->species()); if (species) return species->name(); return ""; @@ -58,7 +59,7 @@ QVariant MapTrainerTeamMemberModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapTrainerTeamMemberUI(qobject_cast<Sigmod::MapTrainerTeamMember*>(m_object), NULL); + QWidget* widget = new MapTrainerTeamMemberUI(qobject_cast<MapTrainerTeamMember*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/MapWarpGroupModel.cpp b/sigmodr/tree/MapWarpGroupModel.cpp index 8a42d207..4a380f15 100644 --- a/sigmodr/tree/MapWarpGroupModel.cpp +++ b/sigmodr/tree/MapWarpGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MapWarpGroupModel::MapWarpGroupModel(BaseModel* parent, Sigmod::Map* map) : +MapWarpGroupModel::MapWarpGroupModel(BaseModel* parent, Map* map) : GroupModel(parent, map, "Warps") { for (int i = 0; i < map->warpCount(); ++i) @@ -58,7 +59,7 @@ bool MapWarpGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "MapWarp")) { - addObject(qobject_cast<Sigmod::Map*>(m_object)->newWarp(xml.documentElement())); + addObject(qobject_cast<Map*>(m_object)->newWarp(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MapWarpGroupModel::types() const return "MapWarp"; } -void MapWarpGroupModel::addObject(Sigmod::Object* object) +void MapWarpGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Map*>(m_object)->newWarp(); + object = qobject_cast<Map*>(m_object)->newWarp(); if (object->className() == "MapWarp") - addChild(new MapWarpModel(this, qobject_cast<Sigmod::MapWarp*>(object))); + addChild(new MapWarpModel(this, qobject_cast<MapWarp*>(object))); } void MapWarpGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MapWarpGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Map*>(m_object)->deleteWarp(index); + qobject_cast<Map*>(m_object)->deleteWarp(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MapWarpModel.cpp b/sigmodr/tree/MapWarpModel.cpp index 6d319783..3cf8e581 100644 --- a/sigmodr/tree/MapWarpModel.cpp +++ b/sigmodr/tree/MapWarpModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapWarpModel::MapWarpModel(BaseModel* parent, Sigmod::MapWarp* warp) : +MapWarpModel::MapWarpModel(BaseModel* parent, MapWarp* warp) : ObjectModel(parent, warp) { } @@ -42,7 +43,7 @@ MapWarpModel::MapWarpModel(BaseModel* parent, Sigmod::MapWarp* warp) : QVariant MapWarpModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::MapWarp*>(m_object)->name(); + return qobject_cast<MapWarp*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant MapWarpModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapWarpUI(qobject_cast<Sigmod::MapWarp*>(m_object), NULL); + QWidget* widget = new MapWarpUI(qobject_cast<MapWarp*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/MapWildListEncounterModel.cpp b/sigmodr/tree/MapWildListEncounterModel.cpp index 90a2227c..e10a027c 100644 --- a/sigmodr/tree/MapWildListEncounterModel.cpp +++ b/sigmodr/tree/MapWildListEncounterModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapWildListEncounterModel::MapWildListEncounterModel(BaseModel* parent, Sigmod::MapWildListEncounter* encounter) : +MapWildListEncounterModel::MapWildListEncounterModel(BaseModel* parent, MapWildListEncounter* encounter) : ObjectModel(parent, encounter) { } @@ -45,7 +46,7 @@ QVariant MapWildListEncounterModel::data(int role) const { if (role == Qt::DisplayRole) { - const Sigmod::Species* species = m_object->game()->speciesById(qobject_cast<Sigmod::MapWildListEncounter*>(m_object)->species()); + const Species* species = m_object->game()->speciesById(qobject_cast<MapWildListEncounter*>(m_object)->species()); if (species) return species->name(); return ""; @@ -58,7 +59,7 @@ QVariant MapWildListEncounterModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapWildListEncounterUI(qobject_cast<Sigmod::MapWildListEncounter*>(m_object), NULL); + QWidget* widget = new MapWildListEncounterUI(qobject_cast<MapWildListEncounter*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/MapWildListGroupModel.cpp b/sigmodr/tree/MapWildListGroupModel.cpp index 05155bc1..ba0ca26a 100644 --- a/sigmodr/tree/MapWildListGroupModel.cpp +++ b/sigmodr/tree/MapWildListGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MapWildListGroupModel::MapWildListGroupModel(BaseModel* parent, Sigmod::Map* map) : +MapWildListGroupModel::MapWildListGroupModel(BaseModel* parent, Map* map) : GroupModel(parent, map, "Wild Lists") { for (int i = 0; i < map->wildListCount(); ++i) @@ -58,7 +59,7 @@ bool MapWildListGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "MapWildList")) { - addObject(qobject_cast<Sigmod::Map*>(m_object)->newWildList(xml.documentElement())); + addObject(qobject_cast<Map*>(m_object)->newWildList(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MapWildListGroupModel::types() const return "MapWildList"; } -void MapWildListGroupModel::addObject(Sigmod::Object* object) +void MapWildListGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Map*>(m_object)->newWildList(); + object = qobject_cast<Map*>(m_object)->newWildList(); if (object->className() == "MapWildList") - addChild(new MapWildListModel(this, qobject_cast<Sigmod::MapWildList*>(object))); + addChild(new MapWildListModel(this, qobject_cast<MapWildList*>(object))); } void MapWildListGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MapWildListGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Map*>(m_object)->deleteWildList(index); + qobject_cast<Map*>(m_object)->deleteWildList(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MapWildListModel.cpp b/sigmodr/tree/MapWildListModel.cpp index a795401d..adf4c23e 100644 --- a/sigmodr/tree/MapWildListModel.cpp +++ b/sigmodr/tree/MapWildListModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MapWildListModel::MapWildListModel(BaseModel* parent, Sigmod::MapWildList* wildList) : +MapWildListModel::MapWildListModel(BaseModel* parent, MapWildList* wildList) : GroupObjectModel(parent, wildList) { setupData(); @@ -51,7 +52,7 @@ QVariant MapWildListModel::data(int role) const { if (role == Qt::DisplayRole) { - return qobject_cast<Sigmod::MapWildList*>(m_object)->name(); + return qobject_cast<MapWildList*>(m_object)->name(); } else if (role == BaseModel::XmlRole) { @@ -61,7 +62,7 @@ QVariant MapWildListModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MapWildListUI(qobject_cast<Sigmod::MapWildList*>(m_object), NULL); + QWidget* widget = new MapWildListUI(qobject_cast<MapWildList*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -94,7 +95,7 @@ bool MapWildListModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "MapWildListEncounter") { - addObject(qobject_cast<Sigmod::MapWildList*>(m_object)->newEncounter(xml.documentElement())); + addObject(qobject_cast<MapWildList*>(m_object)->newEncounter(xml.documentElement())); return true; } } @@ -108,12 +109,12 @@ QString MapWildListModel::types() const return type().append(QString(";MapWildListEncounter")); } -void MapWildListModel::addObject(Sigmod::Object* object) +void MapWildListModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::MapWildList*>(m_object)->newEncounter(); + object = qobject_cast<MapWildList*>(m_object)->newEncounter(); if (object->className() == "MapWildListEncounter") - addChild(new MapWildListEncounterModel(this, qobject_cast<Sigmod::MapWildListEncounter*>(object))); + addChild(new MapWildListEncounterModel(this, qobject_cast<MapWildListEncounter*>(object))); } void MapWildListModel::deleteObject(BaseModel* model) @@ -121,7 +122,7 @@ void MapWildListModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::MapWildList*>(m_object)->deleteEncounter(index); + qobject_cast<MapWildList*>(m_object)->deleteEncounter(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -135,7 +136,7 @@ void MapWildListModel::deleteSelf() void MapWildListModel::setupData() { - Sigmod::MapWildList* wildList = qobject_cast<Sigmod::MapWildList*>(m_object); + 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/MoveGroupModel.cpp b/sigmodr/tree/MoveGroupModel.cpp index 14cc8be7..d8487df7 100644 --- a/sigmodr/tree/MoveGroupModel.cpp +++ b/sigmodr/tree/MoveGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -MoveGroupModel::MoveGroupModel(BaseModel* parent, Sigmod::Game* game) : +MoveGroupModel::MoveGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Moves") { for (int i = 0; i < game->moveCount(); ++i) @@ -58,7 +59,7 @@ bool MoveGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Move")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newMove(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newMove(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString MoveGroupModel::types() const return "Move"; } -void MoveGroupModel::addObject(Sigmod::Object* object) +void MoveGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newMove(); + object = qobject_cast<Game*>(m_object)->newMove(); if (object->className() == "Move") - addChild(new MoveModel(this, qobject_cast<Sigmod::Move*>(object))); + addChild(new MoveModel(this, qobject_cast<Move*>(object))); } void MoveGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void MoveGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteMove(index); + qobject_cast<Game*>(m_object)->deleteMove(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/MoveModel.cpp b/sigmodr/tree/MoveModel.cpp index 552e5712..09048083 100644 --- a/sigmodr/tree/MoveModel.cpp +++ b/sigmodr/tree/MoveModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -MoveModel::MoveModel(BaseModel* parent, Sigmod::Move* move) : +MoveModel::MoveModel(BaseModel* parent, Move* move) : ObjectModel(parent, move) { } @@ -41,7 +42,7 @@ MoveModel::MoveModel(BaseModel* parent, Sigmod::Move* move) : QVariant MoveModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Move*>(m_object)->name(); + return qobject_cast<Move*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant MoveModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new MoveUI(qobject_cast<Sigmod::Move*>(m_object), NULL); + QWidget* widget = new MoveUI(qobject_cast<Move*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/NatureGroupModel.cpp b/sigmodr/tree/NatureGroupModel.cpp index 37031262..7382410b 100644 --- a/sigmodr/tree/NatureGroupModel.cpp +++ b/sigmodr/tree/NatureGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -NatureGroupModel::NatureGroupModel(BaseModel* parent, Sigmod::Game* game) : +NatureGroupModel::NatureGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Natures") { for (int i = 0; i < game->natureCount(); ++i) @@ -58,7 +59,7 @@ bool NatureGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Nature")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newNature(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newNature(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString NatureGroupModel::types() const return "Nature"; } -void NatureGroupModel::addObject(Sigmod::Object* object) +void NatureGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newNature(); + object = qobject_cast<Game*>(m_object)->newNature(); if (object->className() == "Nature") - addChild(new NatureModel(this, qobject_cast<Sigmod::Nature*>(object))); + addChild(new NatureModel(this, qobject_cast<Nature*>(object))); } void NatureGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void NatureGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteNature(index); + qobject_cast<Game*>(m_object)->deleteNature(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/NatureModel.cpp b/sigmodr/tree/NatureModel.cpp index b41e06f0..592bd251 100644 --- a/sigmodr/tree/NatureModel.cpp +++ b/sigmodr/tree/NatureModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -NatureModel::NatureModel(BaseModel* parent, Sigmod::Nature* nature) : +NatureModel::NatureModel(BaseModel* parent, Nature* nature) : ObjectModel(parent, nature) { } @@ -42,7 +43,7 @@ NatureModel::NatureModel(BaseModel* parent, Sigmod::Nature* nature) : QVariant NatureModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Nature*>(m_object)->name(); + return qobject_cast<Nature*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant NatureModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new NatureUI(qobject_cast<Sigmod::Nature*>(m_object), NULL); + QWidget* widget = new NatureUI(qobject_cast<Nature*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/ObjectModel.cpp b/sigmodr/tree/ObjectModel.cpp index ceaa5898..d7906177 100644 --- a/sigmodr/tree/ObjectModel.cpp +++ b/sigmodr/tree/ObjectModel.cpp @@ -24,9 +24,10 @@ // Qt includes #include <QtXml/QDomDocument> +using namespace Sigmod; using namespace Sigmodr::Tree; -ObjectModel::ObjectModel(BaseModel* parent, Sigmod::Object* object) : +ObjectModel::ObjectModel(BaseModel* parent, Object* object) : BaseObjectModel(parent, object) { } diff --git a/sigmodr/tree/RootModel.cpp b/sigmodr/tree/RootModel.cpp index 55dc71c9..e2bddfff 100644 --- a/sigmodr/tree/RootModel.cpp +++ b/sigmodr/tree/RootModel.cpp @@ -24,6 +24,7 @@ // Sigmod includes #include <sigmod/Game.h> +using namespace Sigmod; using namespace Sigmodr::Tree; RootModel::RootModel() : @@ -38,12 +39,12 @@ bool RootModel::setData(const QVariant& value, int role) return false; } -void RootModel::addGame(Sigmod::Game* game) +void RootModel::addGame(Game* game) { addChild(new GameModel(this, game)); } -void RootModel::deleteGame(const Sigmod::Game* game) +void RootModel::deleteGame(const Game* game) { for (int i = 0; i < m_objects.size(); ++i) { @@ -61,7 +62,7 @@ QString RootModel::types() const return "Sigmod"; } -void RootModel::addObject(Sigmod::Object* object) +void RootModel::addObject(Object* object) { Q_UNUSED(object) } diff --git a/sigmodr/tree/RulesModel.cpp b/sigmodr/tree/RulesModel.cpp index 90190baf..2b23d3d2 100644 --- a/sigmodr/tree/RulesModel.cpp +++ b/sigmodr/tree/RulesModel.cpp @@ -27,10 +27,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -RulesModel::RulesModel(BaseModel* parent, Sigmod::Rules* rules) : +RulesModel::RulesModel(BaseModel* parent, Rules* rules) : ObjectModel(parent, rules) { } @@ -47,7 +48,7 @@ QVariant RulesModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new RulesUI(qobject_cast<Sigmod::Rules*>(m_object), NULL); + QWidget* widget = new RulesUI(qobject_cast<Rules*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/SigmodrTree.cpp b/sigmodr/tree/SigmodrTree.cpp index f7e9790e..49924d8b 100644 --- a/sigmodr/tree/SigmodrTree.cpp +++ b/sigmodr/tree/SigmodrTree.cpp @@ -32,13 +32,14 @@ // Qt includes #include <QtGui/QHeaderView> +using namespace Sigmod; 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))); + connect(model, SIGNAL(dirty(const Game*, bool)), this, SLOT(setDirty(const Game*, bool))); header()->hide(); setModel(model); setRootIndex(model->index(-1, 0, QModelIndex())); @@ -64,12 +65,12 @@ KMenu* SigmodrTree::contextMenu(const QModelIndex& index) return model()->data(index, BaseModel::ContextMenuRole).value<KMenu*>(); } -const Sigmod::Game* SigmodrTree::currentGame() const +const Game* SigmodrTree::currentGame() const { QModelIndex index = currentIndex(); if (index.isValid()) { - const Sigmod::Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); + const Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); if (object) return object->game(); } @@ -88,18 +89,18 @@ void SigmodrTree::paste(const QModelIndex& index, const QDomDocument& data) model()->setData(index, data.toString(), BaseModel::XmlRole); } -QList<const Sigmod::Game*> SigmodrTree::openedGames() const +QList<const Game*> SigmodrTree::openedGames() const { return m_games.keys(); } -void SigmodrTree::addGame(Sigmod::Game* game, const KUrl& url) +void SigmodrTree::addGame(Game* game, const KUrl& url) { qobject_cast<SigmodrTreeModel*>(model())->addGame(game); m_games[game] = UrlDirty(url, false); } -void SigmodrTree::deleteGame(const Sigmod::Game* game) +void SigmodrTree::deleteGame(const Game* game) { if (m_games.contains(game)) { @@ -118,7 +119,7 @@ bool SigmodrTree::isOpen(const KUrl& url) const return false; } -KUrl SigmodrTree::url(const Sigmod::Game* game) const +KUrl SigmodrTree::url(const Game* game) const { if (m_games.contains(game)) return m_games[game].first; @@ -133,13 +134,13 @@ QStringList SigmodrTree::urls() const return urls; } -void SigmodrTree::setUrl(const Sigmod::Game* game, const KUrl& url) +void SigmodrTree::setUrl(const Game* game, const KUrl& url) { if (m_games.contains(game)) m_games[game] = UrlDirty(url, false); } -bool SigmodrTree::dirty(const Sigmod::Game* game) const +bool SigmodrTree::dirty(const Game* game) const { if (m_games.contains(game)) return m_games[game].second; @@ -151,7 +152,7 @@ bool SigmodrTree::dirty() const return dirty(currentGame()); } -void SigmodrTree::setDirty(const Sigmod::Game* game, const bool dirty) +void SigmodrTree::setDirty(const Game* game, const bool dirty) { if (m_games.contains(game)) m_games[game].second = dirty; diff --git a/sigmodr/tree/SigmodrTreeModel.cpp b/sigmodr/tree/SigmodrTreeModel.cpp index 39320840..1dcba153 100644 --- a/sigmodr/tree/SigmodrTreeModel.cpp +++ b/sigmodr/tree/SigmodrTreeModel.cpp @@ -30,6 +30,7 @@ #include <QtCore/QUrl> #include <QtXml/QDomDocument> +using namespace Sigmod; using namespace Sigmodr::Tree; SigmodrTreeModel::SigmodrTreeModel(QObject* parent) : @@ -177,19 +178,19 @@ bool SigmodrTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action return success; } -void SigmodrTreeModel::addGame(Sigmod::Game* game) +void SigmodrTreeModel::addGame(Game* game) { m_root->addGame(game); reset(); } -void SigmodrTreeModel::deleteGame(const Sigmod::Game* game) +void SigmodrTreeModel::deleteGame(const Game* game) { m_root->deleteGame(game); reset(); } -const Sigmod::Game* SigmodrTreeModel::findGame(const QModelIndex& index) const +const Game* SigmodrTreeModel::findGame(const QModelIndex& index) const { QModelIndex curIndex = index; QModelIndex parIndex = parent(curIndex); @@ -198,7 +199,7 @@ const Sigmod::Game* SigmodrTreeModel::findGame(const QModelIndex& index) const curIndex = parIndex; parIndex = parent(curIndex); } - return qobject_cast<const Sigmod::Game*>(getItem(curIndex)->object()); + return qobject_cast<const Game*>(getItem(curIndex)->object()); } void SigmodrTreeModel::rowsChanged(const QList<int>& rows) diff --git a/sigmodr/tree/SkinGroupModel.cpp b/sigmodr/tree/SkinGroupModel.cpp index ca2c925e..9794a4da 100644 --- a/sigmodr/tree/SkinGroupModel.cpp +++ b/sigmodr/tree/SkinGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -SkinGroupModel::SkinGroupModel(BaseModel* parent, Sigmod::Game* game) : +SkinGroupModel::SkinGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Skins") { for (int i = 0; i < game->skinCount(); ++i) @@ -58,7 +59,7 @@ bool SkinGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Skin")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newSkin(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newSkin(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString SkinGroupModel::types() const return "Skin"; } -void SkinGroupModel::addObject(Sigmod::Object* object) +void SkinGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newSkin(); + object = qobject_cast<Game*>(m_object)->newSkin(); if (object->className() == "Skin") - addChild(new SkinModel(this, qobject_cast<Sigmod::Skin*>(object))); + addChild(new SkinModel(this, qobject_cast<Skin*>(object))); } void SkinGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void SkinGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteSkin(index); + qobject_cast<Game*>(m_object)->deleteSkin(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/SkinModel.cpp b/sigmodr/tree/SkinModel.cpp index a74c7440..4ef3e183 100644 --- a/sigmodr/tree/SkinModel.cpp +++ b/sigmodr/tree/SkinModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -SkinModel::SkinModel(BaseModel* parent, Sigmod::Skin* skin) : +SkinModel::SkinModel(BaseModel* parent, Skin* skin) : ObjectModel(parent, skin) { } @@ -41,7 +42,7 @@ SkinModel::SkinModel(BaseModel* parent, Sigmod::Skin* skin) : QVariant SkinModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Skin*>(m_object)->name(); + return qobject_cast<Skin*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant SkinModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new SkinUI(qobject_cast<Sigmod::Skin*>(m_object), NULL); + QWidget* widget = new SkinUI(qobject_cast<Skin*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/SoundGroupModel.cpp b/sigmodr/tree/SoundGroupModel.cpp index d5ef7c26..bfad7f03 100644 --- a/sigmodr/tree/SoundGroupModel.cpp +++ b/sigmodr/tree/SoundGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -SoundGroupModel::SoundGroupModel(BaseModel* parent, Sigmod::Game* game) : +SoundGroupModel::SoundGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Sounds") { for (int i = 0; i < game->soundCount(); ++i) @@ -58,7 +59,7 @@ bool SoundGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Sound")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newSound(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newSound(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString SoundGroupModel::types() const return "Sound"; } -void SoundGroupModel::addObject(Sigmod::Object* object) +void SoundGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newSound(); + object = qobject_cast<Game*>(m_object)->newSound(); if (object->className() == "Sound") - addChild(new SoundModel(this, qobject_cast<Sigmod::Sound*>(object))); + addChild(new SoundModel(this, qobject_cast<Sound*>(object))); } void SoundGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void SoundGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteSound(index); + qobject_cast<Game*>(m_object)->deleteSound(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/SoundModel.cpp b/sigmodr/tree/SoundModel.cpp index 64233bc4..a16055c9 100644 --- a/sigmodr/tree/SoundModel.cpp +++ b/sigmodr/tree/SoundModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -SoundModel::SoundModel(BaseModel* parent, Sigmod::Sound* sound) : +SoundModel::SoundModel(BaseModel* parent, Sound* sound) : ObjectModel(parent, sound) { } @@ -42,7 +43,7 @@ SoundModel::SoundModel(BaseModel* parent, Sigmod::Sound* sound) : QVariant SoundModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Sound*>(m_object)->name(); + return qobject_cast<Sound*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant SoundModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new SoundUI(qobject_cast<Sigmod::Sound*>(m_object), NULL); + QWidget* widget = new SoundUI(qobject_cast<Sound*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/SpeciesGroupModel.cpp b/sigmodr/tree/SpeciesGroupModel.cpp index 60aaaa5b..caa46ead 100644 --- a/sigmodr/tree/SpeciesGroupModel.cpp +++ b/sigmodr/tree/SpeciesGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -SpeciesGroupModel::SpeciesGroupModel(BaseModel* parent, Sigmod::Game* game) : +SpeciesGroupModel::SpeciesGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Species") { for (int i = 0; i < game->speciesCount(); ++i) @@ -58,7 +59,7 @@ bool SpeciesGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Species")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newSpecies(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newSpecies(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString SpeciesGroupModel::types() const return "Species"; } -void SpeciesGroupModel::addObject(Sigmod::Object* object) +void SpeciesGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newSpecies(); + object = qobject_cast<Game*>(m_object)->newSpecies(); if (object->className() == "Species") - addChild(new SpeciesModel(this, qobject_cast<Sigmod::Species*>(object))); + addChild(new SpeciesModel(this, qobject_cast<Species*>(object))); } void SpeciesGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void SpeciesGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteSpecies(index); + qobject_cast<Game*>(m_object)->deleteSpecies(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/SpeciesModel.cpp b/sigmodr/tree/SpeciesModel.cpp index 016fa6e3..f49126c9 100644 --- a/sigmodr/tree/SpeciesModel.cpp +++ b/sigmodr/tree/SpeciesModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -SpeciesModel::SpeciesModel(BaseModel* parent, Sigmod::Species* species) : +SpeciesModel::SpeciesModel(BaseModel* parent, Species* species) : GroupObjectModel(parent, species) { setupData(); @@ -50,7 +51,7 @@ SpeciesModel::~SpeciesModel() QVariant SpeciesModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Species*>(m_object)->name(); + return qobject_cast<Species*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -59,7 +60,7 @@ QVariant SpeciesModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new SpeciesUI(qobject_cast<Sigmod::Species*>(m_object), NULL); + QWidget* widget = new SpeciesUI(qobject_cast<Species*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -92,7 +93,7 @@ bool SpeciesModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "SpeciesMove") { - addObject(qobject_cast<Sigmod::Species*>(m_object)->newMove(xml.documentElement())); + addObject(qobject_cast<Species*>(m_object)->newMove(xml.documentElement())); return true; } } @@ -106,12 +107,12 @@ QString SpeciesModel::types() const return type().append(QString(";SpeciesMove")); } -void SpeciesModel::addObject(Sigmod::Object* object) +void SpeciesModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Species*>(m_object)->newMove(); + object = qobject_cast<Species*>(m_object)->newMove(); if (object->className() == "SpeciesMove") - addChild(new SpeciesMoveModel(this, qobject_cast<Sigmod::SpeciesMove*>(object))); + addChild(new SpeciesMoveModel(this, qobject_cast<SpeciesMove*>(object))); } void SpeciesModel::deleteObject(BaseModel* model) @@ -119,7 +120,7 @@ void SpeciesModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Species*>(m_object)->deleteMove(index); + qobject_cast<Species*>(m_object)->deleteMove(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -133,7 +134,7 @@ void SpeciesModel::deleteSelf() void SpeciesModel::setupData() { - Sigmod::Species* species = qobject_cast<Sigmod::Species*>(m_object); + 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/SpeciesMoveModel.cpp b/sigmodr/tree/SpeciesMoveModel.cpp index e3488b41..a6ff6138 100644 --- a/sigmodr/tree/SpeciesMoveModel.cpp +++ b/sigmodr/tree/SpeciesMoveModel.cpp @@ -33,10 +33,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -SpeciesMoveModel::SpeciesMoveModel(BaseModel* parent, Sigmod::SpeciesMove* move) : +SpeciesMoveModel::SpeciesMoveModel(BaseModel* parent, SpeciesMove* move) : ObjectModel(parent, move) { } @@ -45,7 +46,7 @@ QVariant SpeciesMoveModel::data(int role) const { if (role == Qt::DisplayRole) { - const Sigmod::Move* move = m_object->game()->move(qobject_cast<Sigmod::SpeciesMove*>(m_object)->move()); + const Move* move = m_object->game()->move(qobject_cast<SpeciesMove*>(m_object)->move()); if (move) return move->name(); return ""; @@ -58,7 +59,7 @@ QVariant SpeciesMoveModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new SpeciesMoveUI(qobject_cast<Sigmod::SpeciesMove*>(m_object), NULL); + QWidget* widget = new SpeciesMoveUI(qobject_cast<SpeciesMove*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/SpriteGroupModel.cpp b/sigmodr/tree/SpriteGroupModel.cpp index 91d942c0..7e2917dd 100644 --- a/sigmodr/tree/SpriteGroupModel.cpp +++ b/sigmodr/tree/SpriteGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -SpriteGroupModel::SpriteGroupModel(BaseModel* parent, Sigmod::Game* game) : +SpriteGroupModel::SpriteGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Sprites") { for (int i = 0; i < game->spriteCount(); ++i) @@ -58,7 +59,7 @@ bool SpriteGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Sprite")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newSprite(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newSprite(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString SpriteGroupModel::types() const return "Sprite"; } -void SpriteGroupModel::addObject(Sigmod::Object* object) +void SpriteGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newSprite(); + object = qobject_cast<Game*>(m_object)->newSprite(); if (object->className() == "Sprite") - addChild(new SpriteModel(this, qobject_cast<Sigmod::Sprite*>(object))); + addChild(new SpriteModel(this, qobject_cast<Sprite*>(object))); } void SpriteGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void SpriteGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteSprite(index); + qobject_cast<Game*>(m_object)->deleteSprite(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/SpriteModel.cpp b/sigmodr/tree/SpriteModel.cpp index 4b77cd5b..66509029 100644 --- a/sigmodr/tree/SpriteModel.cpp +++ b/sigmodr/tree/SpriteModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -SpriteModel::SpriteModel(BaseModel* parent, Sigmod::Sprite* sprite) : +SpriteModel::SpriteModel(BaseModel* parent, Sprite* sprite) : ObjectModel(parent, sprite) { } @@ -41,7 +42,7 @@ SpriteModel::SpriteModel(BaseModel* parent, Sigmod::Sprite* sprite) : QVariant SpriteModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Sprite*>(m_object)->name(); + return qobject_cast<Sprite*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant SpriteModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new SpriteUI(qobject_cast<Sigmod::Sprite*>(m_object), NULL); + QWidget* widget = new SpriteUI(qobject_cast<Sprite*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/StatusGroupModel.cpp b/sigmodr/tree/StatusGroupModel.cpp index c1718a9a..284ce483 100644 --- a/sigmodr/tree/StatusGroupModel.cpp +++ b/sigmodr/tree/StatusGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -StatusGroupModel::StatusGroupModel(BaseModel* parent, Sigmod::Game* game) : +StatusGroupModel::StatusGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Status Effects") { for (int i = 0; i < game->statusCount(); ++i) @@ -58,7 +59,7 @@ bool StatusGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Status")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newStatus(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newStatus(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString StatusGroupModel::types() const return "Status"; } -void StatusGroupModel::addObject(Sigmod::Object* object) +void StatusGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newStatus(); + object = qobject_cast<Game*>(m_object)->newStatus(); if (object->className() == "Status") - addChild(new StatusModel(this, qobject_cast<Sigmod::Status*>(object))); + addChild(new StatusModel(this, qobject_cast<Status*>(object))); } void StatusGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void StatusGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteStatus(index); + qobject_cast<Game*>(m_object)->deleteStatus(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/StatusModel.cpp b/sigmodr/tree/StatusModel.cpp index 34afe928..789fa835 100644 --- a/sigmodr/tree/StatusModel.cpp +++ b/sigmodr/tree/StatusModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -StatusModel::StatusModel(BaseModel* parent, Sigmod::Status* status) : +StatusModel::StatusModel(BaseModel* parent, Status* status) : ObjectModel(parent, status) { } @@ -41,7 +42,7 @@ StatusModel::StatusModel(BaseModel* parent, Sigmod::Status* status) : QVariant StatusModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Status*>(m_object)->name(); + return qobject_cast<Status*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant StatusModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new StatusUI(qobject_cast<Sigmod::Status*>(m_object), NULL); + QWidget* widget = new StatusUI(qobject_cast<Status*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/StoreGroupModel.cpp b/sigmodr/tree/StoreGroupModel.cpp index eda076b9..b7963fee 100644 --- a/sigmodr/tree/StoreGroupModel.cpp +++ b/sigmodr/tree/StoreGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -StoreGroupModel::StoreGroupModel(BaseModel* parent, Sigmod::Game* game) : +StoreGroupModel::StoreGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Stores") { for (int i = 0; i < game->storeCount(); ++i) @@ -58,7 +59,7 @@ bool StoreGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Store")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newStore(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newStore(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString StoreGroupModel::types() const return "Store"; } -void StoreGroupModel::addObject(Sigmod::Object* object) +void StoreGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newStore(); + object = qobject_cast<Game*>(m_object)->newStore(); if (object->className() == "Store") - addChild(new StoreModel(this, qobject_cast<Sigmod::Store*>(object))); + addChild(new StoreModel(this, qobject_cast<Store*>(object))); } void StoreGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void StoreGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteStore(index); + qobject_cast<Game*>(m_object)->deleteStore(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/StoreModel.cpp b/sigmodr/tree/StoreModel.cpp index 51c5ad2b..3c0fee8d 100644 --- a/sigmodr/tree/StoreModel.cpp +++ b/sigmodr/tree/StoreModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -StoreModel::StoreModel(BaseModel* parent, Sigmod::Store* store) : +StoreModel::StoreModel(BaseModel* parent, Store* store) : ObjectModel(parent, store) { } @@ -42,7 +43,7 @@ StoreModel::StoreModel(BaseModel* parent, Sigmod::Store* store) : QVariant StoreModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Store*>(m_object)->name(); + return qobject_cast<Store*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant StoreModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new StoreUI(qobject_cast<Sigmod::Store*>(m_object), NULL); + QWidget* widget = new StoreUI(qobject_cast<Store*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/TileGroupModel.cpp b/sigmodr/tree/TileGroupModel.cpp index b7c1c9ba..805f48ee 100644 --- a/sigmodr/tree/TileGroupModel.cpp +++ b/sigmodr/tree/TileGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -TileGroupModel::TileGroupModel(BaseModel* parent, Sigmod::Game* game) : +TileGroupModel::TileGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Tiles") { for (int i = 0; i < game->tileCount(); ++i) @@ -58,7 +59,7 @@ bool TileGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Tile")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newTile(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newTile(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString TileGroupModel::types() const return "Tile"; } -void TileGroupModel::addObject(Sigmod::Object* object) +void TileGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newTile(); + object = qobject_cast<Game*>(m_object)->newTile(); if (object->className() == "Tile") - addChild(new TileModel(this, qobject_cast<Sigmod::Tile*>(object))); + addChild(new TileModel(this, qobject_cast<Tile*>(object))); } void TileGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void TileGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteTile(index); + qobject_cast<Game*>(m_object)->deleteTile(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/TileModel.cpp b/sigmodr/tree/TileModel.cpp index f9817e56..591fd07e 100644 --- a/sigmodr/tree/TileModel.cpp +++ b/sigmodr/tree/TileModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -TileModel::TileModel(BaseModel* parent, Sigmod::Tile* tile) : +TileModel::TileModel(BaseModel* parent, Tile* tile) : ObjectModel(parent, tile) { } @@ -42,7 +43,7 @@ TileModel::TileModel(BaseModel* parent, Sigmod::Tile* tile) : QVariant TileModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Tile*>(m_object)->name(); + return qobject_cast<Tile*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant TileModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new TileUI(qobject_cast<Sigmod::Tile*>(m_object), NULL); + QWidget* widget = new TileUI(qobject_cast<Tile*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/TimeGroupModel.cpp b/sigmodr/tree/TimeGroupModel.cpp index d07ebf93..da8c58e5 100644 --- a/sigmodr/tree/TimeGroupModel.cpp +++ b/sigmodr/tree/TimeGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -TimeGroupModel::TimeGroupModel(BaseModel* parent, Sigmod::Game* game) : +TimeGroupModel::TimeGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Times") { for (int i = 0; i < game->timeCount(); ++i) @@ -58,7 +59,7 @@ bool TimeGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Time")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newTime(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newTime(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString TimeGroupModel::types() const return "Time"; } -void TimeGroupModel::addObject(Sigmod::Object* object) +void TimeGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newTime(); + object = qobject_cast<Game*>(m_object)->newTime(); if (object->className() == "Time") - addChild(new TimeModel(this, qobject_cast<Sigmod::Time*>(object))); + addChild(new TimeModel(this, qobject_cast<Time*>(object))); } void TimeGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void TimeGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteTime(index); + qobject_cast<Game*>(m_object)->deleteTime(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/TimeModel.cpp b/sigmodr/tree/TimeModel.cpp index b6eea640..37dc2b00 100644 --- a/sigmodr/tree/TimeModel.cpp +++ b/sigmodr/tree/TimeModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -TimeModel::TimeModel(BaseModel* parent, Sigmod::Time* time) : +TimeModel::TimeModel(BaseModel* parent, Time* time) : ObjectModel(parent, time) { } @@ -42,7 +43,7 @@ TimeModel::TimeModel(BaseModel* parent, Sigmod::Time* time) : QVariant TimeModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Time*>(m_object)->name(); + return qobject_cast<Time*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant TimeModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new TimeUI(qobject_cast<Sigmod::Time*>(m_object), NULL); + QWidget* widget = new TimeUI(qobject_cast<Time*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/TrainerGroupModel.cpp b/sigmodr/tree/TrainerGroupModel.cpp index b4f3fa0a..c8cd73e3 100644 --- a/sigmodr/tree/TrainerGroupModel.cpp +++ b/sigmodr/tree/TrainerGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -TrainerGroupModel::TrainerGroupModel(BaseModel* parent, Sigmod::Game* game) : +TrainerGroupModel::TrainerGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Trainers") { for (int i = 0; i < game->trainerCount(); ++i) @@ -58,7 +59,7 @@ bool TrainerGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Trainer")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newTrainer(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newTrainer(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString TrainerGroupModel::types() const return "Trainer"; } -void TrainerGroupModel::addObject(Sigmod::Object* object) +void TrainerGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newTrainer(); + object = qobject_cast<Game*>(m_object)->newTrainer(); if (object->className() == "Trainer") - addChild(new TrainerModel(this, qobject_cast<Sigmod::Trainer*>(object))); + addChild(new TrainerModel(this, qobject_cast<Trainer*>(object))); } void TrainerGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void TrainerGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteTrainer(index); + qobject_cast<Game*>(m_object)->deleteTrainer(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/TrainerModel.cpp b/sigmodr/tree/TrainerModel.cpp index dd5059ac..04d8948f 100644 --- a/sigmodr/tree/TrainerModel.cpp +++ b/sigmodr/tree/TrainerModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -TrainerModel::TrainerModel(BaseModel* parent, Sigmod::Trainer* trainer) : +TrainerModel::TrainerModel(BaseModel* parent, Trainer* trainer) : ObjectModel(parent, trainer) { } @@ -42,7 +43,7 @@ TrainerModel::TrainerModel(BaseModel* parent, Sigmod::Trainer* trainer) : QVariant TrainerModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Trainer*>(m_object)->name(); + return qobject_cast<Trainer*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant TrainerModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new TrainerUI(qobject_cast<Sigmod::Trainer*>(m_object), NULL); + QWidget* widget = new TrainerUI(qobject_cast<Trainer*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/TypeGroupModel.cpp b/sigmodr/tree/TypeGroupModel.cpp index 4493cca3..d3968593 100644 --- a/sigmodr/tree/TypeGroupModel.cpp +++ b/sigmodr/tree/TypeGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -TypeGroupModel::TypeGroupModel(BaseModel* parent, Sigmod::Game* game) : +TypeGroupModel::TypeGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Types") { for (int i = 0; i < game->typeCount(); ++i) @@ -58,7 +59,7 @@ bool TypeGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Type")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newType(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newType(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString TypeGroupModel::types() const return "Type"; } -void TypeGroupModel::addObject(Sigmod::Object* object) +void TypeGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newType(); + object = qobject_cast<Game*>(m_object)->newType(); if (object->className() == "Type") - addChild(new TypeModel(this, qobject_cast<Sigmod::Type*>(object))); + addChild(new TypeModel(this, qobject_cast<Type*>(object))); } void TypeGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void TypeGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteType(index); + qobject_cast<Game*>(m_object)->deleteType(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/TypeModel.cpp b/sigmodr/tree/TypeModel.cpp index 314b3444..f38b8ea2 100644 --- a/sigmodr/tree/TypeModel.cpp +++ b/sigmodr/tree/TypeModel.cpp @@ -31,10 +31,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -TypeModel::TypeModel(BaseModel* parent, Sigmod::Type* type) : +TypeModel::TypeModel(BaseModel* parent, Type* type) : ObjectModel(parent, type) { } @@ -42,7 +43,7 @@ TypeModel::TypeModel(BaseModel* parent, Sigmod::Type* type) : QVariant TypeModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Type*>(m_object)->name(); + return qobject_cast<Type*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -51,7 +52,7 @@ QVariant TypeModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new TypeUI(qobject_cast<Sigmod::Type*>(m_object), NULL); + QWidget* widget = new TypeUI(qobject_cast<Type*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) diff --git a/sigmodr/tree/WeatherGroupModel.cpp b/sigmodr/tree/WeatherGroupModel.cpp index 0cf0bc94..27d3b076 100644 --- a/sigmodr/tree/WeatherGroupModel.cpp +++ b/sigmodr/tree/WeatherGroupModel.cpp @@ -28,9 +28,10 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Tree; -WeatherGroupModel::WeatherGroupModel(BaseModel* parent, Sigmod::Game* game) : +WeatherGroupModel::WeatherGroupModel(BaseModel* parent, Game* game) : GroupModel(parent, game, "Weathers") { for (int i = 0; i < game->weatherCount(); ++i) @@ -58,7 +59,7 @@ bool WeatherGroupModel::setData(const QVariant& value, int role) QDomDocument xml; if (loadFromData(data, &xml) && (xml.doctype().name() == "Weather")) { - addObject(qobject_cast<Sigmod::Game*>(m_object)->newWeather(xml.documentElement())); + addObject(qobject_cast<Game*>(m_object)->newWeather(xml.documentElement())); return true; } } @@ -71,12 +72,12 @@ QString WeatherGroupModel::types() const return "Weather"; } -void WeatherGroupModel::addObject(Sigmod::Object* object) +void WeatherGroupModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::Game*>(m_object)->newWeather(); + object = qobject_cast<Game*>(m_object)->newWeather(); if (object->className() == "Weather") - addChild(new WeatherModel(this, qobject_cast<Sigmod::Weather*>(object))); + addChild(new WeatherModel(this, qobject_cast<Weather*>(object))); } void WeatherGroupModel::deleteObject(BaseModel* model) @@ -84,7 +85,7 @@ void WeatherGroupModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::Game*>(m_object)->deleteWeather(index); + qobject_cast<Game*>(m_object)->deleteWeather(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); diff --git a/sigmodr/tree/WeatherModel.cpp b/sigmodr/tree/WeatherModel.cpp index 383c31f6..fec5ad84 100644 --- a/sigmodr/tree/WeatherModel.cpp +++ b/sigmodr/tree/WeatherModel.cpp @@ -30,10 +30,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -WeatherModel::WeatherModel(BaseModel* parent, Sigmod::Weather* weather) : +WeatherModel::WeatherModel(BaseModel* parent, Weather* weather) : ObjectModel(parent, weather) { } @@ -41,7 +42,7 @@ WeatherModel::WeatherModel(BaseModel* parent, Sigmod::Weather* weather) : QVariant WeatherModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::Weather*>(m_object)->name(); + return qobject_cast<Weather*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -50,7 +51,7 @@ QVariant WeatherModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new WeatherUI(qobject_cast<Sigmod::Weather*>(m_object), NULL); + QWidget* widget = new WeatherUI(qobject_cast<Weather*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) |