summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/PokemodModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/models/PokemodModel.cpp')
-rw-r--r--pokemodr/models/PokemodModel.cpp95
1 files changed, 8 insertions, 87 deletions
diff --git a/pokemodr/models/PokemodModel.cpp b/pokemodr/models/PokemodModel.cpp
index 4ea6e7a1..73ecf36e 100644
--- a/pokemodr/models/PokemodModel.cpp
+++ b/pokemodr/models/PokemodModel.cpp
@@ -96,11 +96,6 @@ bool AbilityGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool AbilityGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
BadgeGroupModel::BadgeGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Badges")
{
@@ -141,11 +136,6 @@ bool BadgeGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool BadgeGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
CoinListGroupModel::CoinListGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Coin Lists")
{
@@ -186,11 +176,6 @@ bool CoinListGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool CoinListGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
DialogGroupModel::DialogGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Dialogs")
{
@@ -231,11 +216,6 @@ bool DialogGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool DialogGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
EggGroupGroupModel::EggGroupGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Egg Groups")
{
@@ -276,11 +256,6 @@ bool EggGroupGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool EggGroupGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
ItemGroupModel::ItemGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Items")
{
@@ -323,11 +298,6 @@ bool ItemGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool ItemGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
ItemTypeGroupModel::ItemTypeGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Item Types")
{
@@ -368,11 +338,6 @@ bool ItemTypeGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool ItemTypeGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
MapGroupModel::MapGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Maps")
{
@@ -415,11 +380,6 @@ bool MapGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool MapGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
MoveGroupModel::MoveGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Moves")
{
@@ -462,11 +422,6 @@ bool MoveGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool MoveGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
NatureGroupModel::NatureGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Natures")
{
@@ -507,11 +462,6 @@ bool NatureGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool NatureGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
SpeciesGroupModel::SpeciesGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Species")
{
@@ -554,11 +504,6 @@ bool SpeciesGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool SpeciesGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
StoreGroupModel::StoreGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Stores")
{
@@ -599,11 +544,6 @@ bool StoreGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool StoreGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
TileGroupModel::TileGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Tiles")
{
@@ -644,11 +584,6 @@ bool TileGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool TileGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
TimeGroupModel::TimeGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Times")
{
@@ -689,11 +624,6 @@ bool TimeGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool TimeGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
TrainerGroupModel::TrainerGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Trainers")
{
@@ -734,11 +664,6 @@ bool TrainerGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool TrainerGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
TypeGroupModel::TypeGroupModel(BaseModel* parent, Object* object) :
GroupModel(parent, object, "Types")
{
@@ -779,11 +704,6 @@ bool TypeGroupModel::removeRows(const int position, const int rows)
return true;
}
-// bool TypeGroupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
PokemodModel::PokemodModel(BaseModel* parent, Object* object) :
GroupObjectModel(parent, object)
{
@@ -799,7 +719,13 @@ QVariant PokemodModel::data(int role) const
{
if (role == Qt::DisplayRole)
return static_cast<Pokemod*>(m_object)->title();
- else if (role == Qt::UserRole)
+ else if (role == BaseModel::XmlRole)
+ {
+ QDomDocument xml(m_object->className());
+ xml.appendChild(m_object->save());
+ return xml.toString();
+ }
+ else if (role == BaseModel::WidgetRole)
{
QWidget* widget = new PokemodUI(static_cast<Pokemod*>(m_object), NULL);
return QVariant::fromValue(widget);
@@ -814,7 +740,7 @@ int PokemodModel::rowCount() const
bool PokemodModel::setData(const QVariant& value, int role)
{
- if (role == Qt::UserRole)
+ if (role == BaseModel::XmlRole)
{
if (value.canConvert<QString>())
{
@@ -913,11 +839,6 @@ bool PokemodModel::removeRows(const int position, const int rows)
return false;
}
-// bool PokemodModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }
-
void PokemodModel::setupData()
{
m_rules = new RulesModel(this, static_cast<Pokemod*>(m_object)->rules());